MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 293: Line 293:
genSetRandDARTNumber();
genSetRandDARTNumber();


function matchHeaderText() {
function matchHeaderText(force) {
     $('table[cellpadding="5"][border="1"][style] tr:not(.dungeon-page-fields tr), .segment-header:not(.job-change-collapsible .segment-header)').each(function () {
     $('table[cellpadding="5"][border="1"][style] tr:not(.dungeon-page-fields tr), .segment-header:not(.job-change-collapsible .segment-header)').each(function () {
         var rgb = $(this).css('backgroundColor');
         var rgb = $(this).css('backgroundColor');
Line 300: Line 300:
         if (o < 155 && rgb != 'rgba(0, 0, 0, 0)') {
         if (o < 155 && rgb != 'rgba(0, 0, 0, 0)') {
             $(this).css('color', 'white').css('text-shadow', '1px 1px 1px #000');
             $(this).css('color', 'white').css('text-shadow', '1px 1px 1px #000');
         } else if ($(this).parents('.instance-page').length) {
         } else if ($(this).parents('.instance-page').length || force) {
             $(this).css('color', 'black').css('text-shadow', 'none');
             $(this).css('color', 'black').css('text-shadow', 'none');
         }
         }
Line 435: Line 435:
     $('#dark-mode-switch').click(function () {
     $('#dark-mode-switch').click(function () {
         $('body').toggleClass('dark-mode');
         $('body').toggleClass('dark-mode');
         matchHeaderText();
         matchHeaderText(true);
         if ($('body').hasClass('dark-mode')) {
         if ($('body').hasClass('dark-mode')) {
             setCookie('elwiki-dark-mode', 'true');
             setCookie('elwiki-dark-mode', 'true');
Line 442: Line 442:
         } else {
         } else {
             setCookie('elwiki-dark-mode', 'true');
             setCookie('elwiki-dark-mode', 'true');
             $('#dark-mode-notif').attr('data-state', 'off');
             $('#dark-mode-notif').attr('data-state', 'off').addClass('toast-visible');
             removeModeToast();
             removeModeToast();
         }
         }