Fixes #39 Simple Inversion setting

Former-commit-id: cc618799c4fe2a32ca330634360e9a96648913df [formerly 38d2ab861c6787815cd93cfa75fb764d0ac31ea8]
Former-commit-id: 20f9c8ebfd7df7d822ca932ca86334b19041216f
This commit is contained in:
Jaifroid 2018-01-05 15:42:56 +00:00
parent b934cc809a
commit dedc79c2a8
5 changed files with 17 additions and 11 deletions

View File

@ -150,6 +150,7 @@
<Content Include="www\-\s\css_modules\mw.MediaWikiPlayer.loader.css" />
<Content Include="www\-\s\css_modules\mw.PopUpMediaTransform.css" />
<Content Include="www\-\s\css_modules\mw.TMHGalleryHook.js.css" />
<Content Include="www\-\s\style-dark-invert.css" />
<Content Include="www\-\s\style-dark.css" />
<Content Include="www\-\s\style-mobile.css" />
<Content Include="www\-\s\style.css" />

View File

@ -168,11 +168,12 @@ tr[bgcolor] {
}
table[style*="background-color:#fff;"], .search-form fieldset, table.ambox, tr[style*="background-color: #fff;"],
.mw-ui-button[style*="background-color:#008B6D"], tr[style*="background-color: #f5faff;"],
.mw-ui-button[style*="background-color:#008B6D"], tr[style*="background-color: #f5faff;"], tr[style*="background:#EF"], tr[style*="background:#FF"],
tr[style*="background:#E9E9E9"] > *, table.infobox.hproduct > tbody > tr[style*="background: #F0F0F0;"],
td[style*="background:lightgray"], td[style*="background:#f0f0f0"], td[style*="background:#eeeeff"], td[style*="background:#e8e8e8"],
td[style*="background:#ddddff"], td[style*="background:#efefef"], td[style*="background:#e9e9e9"], td[style*="background:#f1f1f1"],
.oo-ui-buttonElement-button:hover, .tracklist tr[style*="background-color:#f7f7f7"], caption[style*="background:#e3e3e3"] { background-color: #282828 !important;
.oo-ui-buttonElement-button:hover, .tracklist tr[style*="background-color:#f7f7f7"], caption[style*="background:#e3e3e3"] {
background-color: #282828 !important;
}
table.wikitable > tr > th, table.wikitable > * > tr > th, div.barbox > table > tbody > tr > th
@ -336,7 +337,7 @@ span[style*="color:black"] {
color: whitesmoke !important;
}
span[style*="color:#555"] {
span[style*="color:#555"], span[style*="background-color:#EE"] {
color: darkgray !important;
}

View File

@ -76,6 +76,12 @@ div.infobox_v3{padding:5px;width:25em;background:#f9f9f9;border:1px solid #aaa;c
max-width: 100% !important;
}
div.float-right, table.float-right, ul.float-right, .float-right {
float: right;
margin: 1em 0 1em 1em;
}
/* end http://en.wikipedia.org/w/load.php?debug=false&lang=en&modules=ext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.sectionAnchor%7Cmediawiki.skinning.interface%7Cskins.vector.styles&only=styles&skin=vector */

View File

@ -87,7 +87,6 @@ define(['util', 'uiUtil'], function (util, uiUtil) {
}
function toMobileCSS(html, zim, cc, cs, css) {
var cssTheme = document.getElementById("cssWikiDarkThemeCheck").checked ? "dark" : "light";
//DEV: Careful not to add styles twice...
//NB Can't relocate to filterCSS function above because it filters styles serially and code would be called for every style...
if (zim != cs) { //If ZIM doesn't match user-requested style, add in stylesheets if they're missing
@ -140,15 +139,14 @@ define(['util', 'uiUtil'], function (util, uiUtil) {
html = html.match(/table\s+(?=[^>]*class\s*=\s*["'][^"']*(?:infobox|vertical-navbox|qbRight|wikitable))/i) ? html.replace(/(<h2\s+[^<]*<\/h2>)/ig, '<div style="width: 60%;">$1</div>') : html;
}
//Add dark theme if requested
css += (cssTheme == "dark") ? '<link href="../-/s/style-dark.css" rel="stylesheet" type="text/css">\r\n' : (cssTheme == "invert") ? '<link href="../-/s/style-dark-invert.css" rel="stylesheet" type="text/css">\r\n' :"";
html = (cssTheme == "dark") ? html.replace(/(<h1\s+[^>]*)background-color\s*:\s*white;\s*/i, "$1") : html;
html = (cssTheme == "dark") ? html.replace(/(<div\s+[^>]*)background-image\s*:\s*linear-gradient[^;]+white[^;]*;\s*/i, "$1") : html;
css += (params.cssTheme == "dark") ? '<link href="../-/s/style-dark.css" rel="stylesheet" type="text/css">\r\n' : (params.cssTheme == "invert") ? '<link href="../-/s/style-dark-invert.css" rel="stylesheet" type="text/css">\r\n' :"";
html = (params.cssTheme == "dark") ? html.replace(/(<h1\s+[^>]*)background-color\s*:\s*white;\s*/i, "$1") : html;
html = (params.cssTheme == "dark") ? html.replace(/(<div\s+[^>]*)background-image\s*:\s*linear-gradient[^;]+white[^;]*;\s*/i, "$1") : html;
return { html : html, css : css };
}
function toDesktopCSS(html, zim, cc, cs, css) {
var cssTheme = document.getElementById("cssWikiDarkThemeCheck").checked ? "dark" : "light";
if (cc || (zim != cs)) {
if (/class\s*=\s*["']gallery/i.test(html) && !/gallery/i.test(css)) {
console.log("Inserting missing css required for gallery display [mediawiki.page.gallery.styles.css]...");
@ -181,9 +179,9 @@ define(['util', 'uiUtil'], function (util, uiUtil) {
html = html.replace(/<h1\s*[^>]+titleHeading[^>]+>\s*<\/h1>\s*/ig, "");
}
//Add dark theme if requested
css += (cssTheme == "dark") ? '<link href="../-/s/style-dark.css" rel="stylesheet" type="text/css">\r\n' : (cssTheme == "invert") ? '<link href="../-/s/style-dark-invert.css" rel="stylesheet" type="text/css">\r\n' : "";
html = (cssTheme == "dark") ? html.replace(/(<h1\s+[^>]*)background-color:\s*white;\s*/i, "$1") : html;
html = (cssTheme == "dark") ? html.replace(/(<div\s+[^>]*)background-image\s*:\s*linear-gradient[^;]+white[^;]*;\s*/i, "$1") : html;
css += (params.cssTheme == "dark") ? '<link href="../-/s/style-dark.css" rel="stylesheet" type="text/css">\r\n' : (params.cssTheme == "invert") ? '<link href="../-/s/style-dark-invert.css" rel="stylesheet" type="text/css">\r\n' : "";
html = (params.cssTheme == "dark") ? html.replace(/(<h1\s+[^>]*)background-color:\s*white;\s*/i, "$1") : html;
html = (params.cssTheme == "dark") ? html.replace(/(<div\s+[^>]*)background-image\s*:\s*linear-gradient[^;]+white[^;]*;\s*/i, "$1") : html;
return { html : html, css : css };
}