ElEditors, Interface administrators, Administrators
70,857
edits
No edit summary |
No edit summary |
||
Line 304: | Line 304: | ||
$('table[cellpadding="5"][border="1"][style] tr[style*="rgb(68, 68, 68)"] th').css('border-color', 'black'); | $('table[cellpadding="5"][border="1"][style] tr[style*="rgb(68, 68, 68)"] th').css('border-color', 'black'); | ||
function matchHeaderText() { | |||
$('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 colors = rgb.match(/\d+/g); | |||
var o = Math.round(((parseInt(colors[0]) * 299) + (parseInt(colors[1]) * 587) + (parseInt(colors[2]) * 114)) / 1000); | |||
if (o < 155 && rgb != 'rgba(0, 0, 0, 0)') { | |||
$(this).css('color', 'white').css('text-shadow', '1px 1px 1px #000'); | |||
} else if ($(this).parents('.instance-page').length) { | |||
$(this).css('color', 'black').css('text-shadow', 'none'); | |||
} | |||
setTimeout(function() { | }); | ||
$('.segment-partial .mw-collapsible-text').each(function() { | setTimeout(function () { | ||
var color = $(this).parents('.segment').find('.segment-header:eq(0)').css('color'); | $('.segment-partial .mw-collapsible-text').each(function () { | ||
var color = $(this).parents('.segment').find('.segment-header:eq(0)').css('color'); | |||
var shadow = $(this).parents('.segment').find('.segment-header:eq(0)').css('text-shadow'); | |||
}); | $(this).css({ color: color, textShadow: shadow }) | ||
}, 50); | }); | ||
}, 50); | |||
} | |||
matchHeaderText(); | |||
}); | }); | ||
Line 423: | Line 427: | ||
$('#dark-mode-switch').after('<div id="dark-mode-notif"></div>'); | $('#dark-mode-switch').after('<div id="dark-mode-notif"></div>'); | ||
$('#dark-mode-switch').click(function() { | $('#dark-mode-switch').click(function () { | ||
$('body').toggleClass('dark-mode'); | $('body').toggleClass('dark-mode'); | ||
matchHeaderText(); | |||
if ($('body').hasClass('dark-mode')) { | if ($('body').hasClass('dark-mode')) { | ||
setCookie('elwiki-dark-mode', 'true'); | setCookie('elwiki-dark-mode', 'true'); |