Difference between revisions of User:NottNott/common.js
Jump to navigation
Jump to search
(Replaced content with "$( document ).ready( function() { var refToggle = mw.util.addPortletLink( "p-tb", "#", "Toggle references"); $( refToggle ).click( function() { $( ".reference" ).toggl...") Tag: Replaced |
Tag: Undo |
||
Line 5: | Line 5: | ||
} ); | } ); | ||
} ); | } ); | ||
//<nowiki> | |||
$(function() { | |||
var nighttime = 'on' === mw.storage.get('nightpedia'), | |||
cssLoaded = nighttime ? lightsOff() : false; | |||
mw.util.addPortletLink('p-personal', '#', nighttime ? 'Daypedia' : 'Nightpedia', 'pt-nightpedia', '', 'np', '#pt-watchlist'); | |||
$('#pt-nightpedia').on('click', function(e) { | |||
e.preventDefault(); | |||
nighttime = !nighttime; | |||
if (nighttime) { | |||
lightsOff(); | |||
} else { | |||
lightsOn(); | |||
} | |||
}); | |||
function lightsOn() { | |||
$('html').removeClass('nighttime'); | |||
$('#pt-nightpedia a').text('Nightpedia'); | |||
mw.storage.set('nightpedia', 'off'); | |||
} | |||
function lightsOff() { | |||
if(!cssLoaded) { | |||
/** Some refinements courtesy of [[User:AHollender (WMF)/night mode.css]] **/ | |||
html.nighttime { | |||
background-color: #000000; | |||
} | |||
html.nighttime, html.nighttime img, html.nighttime video, html.nighttime svg, html.nighttime iframe, | |||
html.nighttime .mw-no-invert, html.nighttime .mw-mmv-overlay, html.nighttime .mw-mmv-pre-image, | |||
html.nighttime .mw-kartographer-map, html.nighttime .mw-kartographer-mapDialog-map { | |||
filter: invert(1) hue-rotate(180deg); | |||
} | |||
/* backgrounds */ | |||
html.nighttime .infobox, html.nighttime .toc, html.nighttime div.thumbinner, | |||
html.nighttime #simpleSearch, html.nighttime #simpleSearch #searchInput, html.nighttime #simpleSearch #searchButton, | |||
html.nighttime table, html.nighttime .wikitable, html.nighttime table.ambox-content, html.nighttime table.toccolours, | |||
html.nighttime .mw-notification, html.nighttime .mwe-popups, html.nighttime div.cbnnr-main, html.nighttime .cx-callout { | |||
background-color: #DDDDDD; | |||
} | |||
/* borders */ | |||
html.nighttime body, html.nighttime #mw-head, html.nighttime #mw-panel, html.nighttime #content.mw-body, | |||
html.nighttime h1, html.nighttime h2, html.nighttime h3, html.nighttime h4, html.nighttime h5, html.nighttime h6, | |||
html.nighttime .infobox, html.nighttime .toc, html.nighttime div.thumbinner, html.nighttime #simpleSearch, | |||
html.nighttime #simpleSearch #searchInput, html.nighttime table.ambox-content, html.nighttime table.toccolours, | |||
html.nighttime .mw-notification { | |||
border-color: #CDCBC8; | |||
} | |||
/* normal links */ | |||
html.nighttime a, html.nighttime #mw-panel .portal .body li a, html.nighttime .vectorTabs li a, | |||
html.nighttime .toctogglelabel, html.nighttime .mw-parser-output a.external, html.nighttime .mw-parser-output a.extiw, | |||
html.nighttime .mw-parser-output a.extiw:active { | |||
color: #6699FF; | |||
} | |||
/* visited links */ | |||
html.nighttime a:visited, html.nighttime #mw-panel .portal .body li a:visited, | |||
html.nighttime .mw-parser-output a.extiw:visited { | |||
color: #709BBD; | |||
} | |||
/* red links */ | |||
html.nighttime a.new, html.nighttime .vectorTabs li.new a { | |||
color: #FF6E6E; | |||
} | |||
/* ==== SPECIAL FIXES ==== */ | |||
/* image thumbnais */ | |||
html.nighttime .thumbimage { | |||
border: none; | |||
} | |||
/* svgs */ | |||
/*html.nighttime img[src*="svg"] {*/ | |||
/* background: #FFFFFF;*/ | |||
/*}*/ | |||
/* page previews */ | |||
html.nighttime .mwe-popups { | |||
-webkit-box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px #000000; | |||
box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px #000000; | |||
} | |||
html.nighttime .mwe-popups .mwe-popups-extract[dir='ltr']:after { | |||
background-image: linear-gradient(to right,rgba(221,221,221,0),#DDDDDD 50%); | |||
} | |||
html.nighttime .mwe-popups.flipped-y:after, html.nighttime .mwe-popups.flipped-x-y:after { | |||
border-top: 11px solid #DDDDDD; | |||
} | |||
html.nighttime .mwe-popups.mwe-popups-no-image-pointer:after { | |||
border-bottom: 11px solid #DDDDDD;; | |||
} | |||
/* contributions menu */ | |||
html.nighttime .cx-callout-1:after { | |||
border-bottom-color: #DDDDDD; | |||
} | |||
} | |||
$('html').addClass('nighttime'); | |||
$('#pt-nightpedia a').text('Daypedia'); | |||
mw.storage.set('nightpedia', 'on'); | |||
return true; | |||
} | |||
}); | |||
//</nowiki> |
Revision as of 02:07, 14 June 2020
$( document ).ready( function() { var refToggle = mw.util.addPortletLink( "p-tb", "#", "Toggle references"); $( refToggle ).click( function() { $( ".reference" ).toggle(); } ); } ); //<nowiki> $(function() { var nighttime = 'on' === mw.storage.get('nightpedia'), cssLoaded = nighttime ? lightsOff() : false; mw.util.addPortletLink('p-personal', '#', nighttime ? 'Daypedia' : 'Nightpedia', 'pt-nightpedia', '', 'np', '#pt-watchlist'); $('#pt-nightpedia').on('click', function(e) { e.preventDefault(); nighttime = !nighttime; if (nighttime) { lightsOff(); } else { lightsOn(); } }); function lightsOn() { $('html').removeClass('nighttime'); $('#pt-nightpedia a').text('Nightpedia'); mw.storage.set('nightpedia', 'off'); } function lightsOff() { if(!cssLoaded) { /** Some refinements courtesy of [[User:AHollender (WMF)/night mode.css]] **/ html.nighttime { background-color: #000000; } html.nighttime, html.nighttime img, html.nighttime video, html.nighttime svg, html.nighttime iframe, html.nighttime .mw-no-invert, html.nighttime .mw-mmv-overlay, html.nighttime .mw-mmv-pre-image, html.nighttime .mw-kartographer-map, html.nighttime .mw-kartographer-mapDialog-map { filter: invert(1) hue-rotate(180deg); } /* backgrounds */ html.nighttime .infobox, html.nighttime .toc, html.nighttime div.thumbinner, html.nighttime #simpleSearch, html.nighttime #simpleSearch #searchInput, html.nighttime #simpleSearch #searchButton, html.nighttime table, html.nighttime .wikitable, html.nighttime table.ambox-content, html.nighttime table.toccolours, html.nighttime .mw-notification, html.nighttime .mwe-popups, html.nighttime div.cbnnr-main, html.nighttime .cx-callout { background-color: #DDDDDD; } /* borders */ html.nighttime body, html.nighttime #mw-head, html.nighttime #mw-panel, html.nighttime #content.mw-body, html.nighttime h1, html.nighttime h2, html.nighttime h3, html.nighttime h4, html.nighttime h5, html.nighttime h6, html.nighttime .infobox, html.nighttime .toc, html.nighttime div.thumbinner, html.nighttime #simpleSearch, html.nighttime #simpleSearch #searchInput, html.nighttime table.ambox-content, html.nighttime table.toccolours, html.nighttime .mw-notification { border-color: #CDCBC8; } /* normal links */ html.nighttime a, html.nighttime #mw-panel .portal .body li a, html.nighttime .vectorTabs li a, html.nighttime .toctogglelabel, html.nighttime .mw-parser-output a.external, html.nighttime .mw-parser-output a.extiw, html.nighttime .mw-parser-output a.extiw:active { color: #6699FF; } /* visited links */ html.nighttime a:visited, html.nighttime #mw-panel .portal .body li a:visited, html.nighttime .mw-parser-output a.extiw:visited { color: #709BBD; } /* red links */ html.nighttime a.new, html.nighttime .vectorTabs li.new a { color: #FF6E6E; } /* ==== SPECIAL FIXES ==== */ /* image thumbnais */ html.nighttime .thumbimage { border: none; } /* svgs */ /*html.nighttime img[src*="svg"] {*/ /* background: #FFFFFF;*/ /*}*/ /* page previews */ html.nighttime .mwe-popups { -webkit-box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px #000000; box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px #000000; } html.nighttime .mwe-popups .mwe-popups-extract[dir='ltr']:after { background-image: linear-gradient(to right,rgba(221,221,221,0),#DDDDDD 50%); } html.nighttime .mwe-popups.flipped-y:after, html.nighttime .mwe-popups.flipped-x-y:after { border-top: 11px solid #DDDDDD; } html.nighttime .mwe-popups.mwe-popups-no-image-pointer:after { border-bottom: 11px solid #DDDDDD;; } /* contributions menu */ html.nighttime .cx-callout-1:after { border-bottom-color: #DDDDDD; } } $('html').addClass('nighttime'); $('#pt-nightpedia a').text('Daypedia'); mw.storage.set('nightpedia', 'on'); return true; } }); //</nowiki>