MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
document.documentElement.style.setProperty('--bodycontent-bg-color', '#ffffff'); | document.documentElement.style.setProperty('--bodycontent-bg-color', '#ffffff'); | ||
document.documentElement.style.setProperty('--table-bg-color', '#f6f6f6'); | document.documentElement.style.setProperty('--table-bg-color', '#f6f6f6'); | ||
document.documentElement.style.setProperty('--main-table-td-border', '1px solid var(--border-color-subtle,#c8ccd1)'); | document.documentElement.style.setProperty('--main-table-td-border', '1px solid var(--border-color-subtle, #c8ccd1)'); | ||
document.documentElement.style.setProperty('--main-table-td-box-shadow', '0 1px 1px rgba(0,0,0,0.15)'); | document.documentElement.style.setProperty('--main-table-td-box-shadow', '0 1px 1px rgba(0,0,0,0.15)'); | ||
document.documentElement.style.setProperty('--videoguides-bg-color', '#f6f6f6'); | document.documentElement.style.setProperty('--videoguides-bg-color', '#f6f6f6'); |
Revision as of 01:35, 1 July 2024
/* Any JavaScript here will be loaded for all users on every page load. */
mw.loader.using('mediawiki.util', function() {
$(document).ready(function() {
// Проверяем, что элемент существует
if ($('#ca-nstab-main').length) {
// Создаем новую вкладку
var newTab = $('<li id="ca-custom" style="color: #e69100 !important;"><a>Wiki light</a></li>');
// Добавляем новую вкладку после вкладки "Читать"
$('#ca-nstab-main').after(newTab);
}
});
});
$(document).ready(function(){
var myVariable = localStorage.getItem("isLightTheme");
if(myVariable == "true"){
// Применение стилей для светлой темы
document.documentElement.style.setProperty('--main-bg-color', '#f6f6f6');
document.documentElement.style.setProperty('--mw-head-back-image', '#ffffff');
document.documentElement.style.setProperty('--secondary-bg-color', '#f6f6f6');
document.documentElement.style.setProperty('--bodycontent-bg-color', '#ffffff');
document.documentElement.style.setProperty('--table-bg-color', '#f6f6f6');
document.documentElement.style.setProperty('--main-table-td-border', '1px solid var(--border-color-subtle, #c8ccd1)');
document.documentElement.style.setProperty('--main-table-td-box-shadow', '0 1px 1px rgba(0,0,0,0.15)');
document.documentElement.style.setProperty('--videoguides-bg-color', '#f6f6f6');
document.documentElement.style.setProperty('--video-guides-border', '1px solid var(--border-color-subtle, #c8ccd1)');
document.documentElement.style.setProperty('--video-guides-box-shadow', '0 1px 1px rgba(0, 0, 0, 0.15)');
document.documentElement.style.setProperty('--a-ul-span-color', 'initial');
document.documentElement.style.setProperty('--p-span-li-color', 'black');
document.documentElement.style.setProperty('--h1-span-h2-span-h3-span-h4-span-color', 'black');
document.documentElement.style.setProperty('--h1-h2-h3-h4-h5-h6-color', 'black');
document.documentElement.style.setProperty('--title-p-color', 'initial');
document.documentElement.style.setProperty('--b-color', 'initial');
document.documentElement.style.setProperty('--toc-background-color', 'var(--background-color-neutral-subtle,#f8f9fa)');
document.documentElement.style.setProperty('--toc-border', '1px solid var(--border-color-base,#a2a9b1)');
document.documentElement.style.setProperty('--toc-border-color', '#a2a9b1');
document.documentElement.style.setProperty('--toc-h2-color', 'initial !important');
document.documentElement.style.setProperty('--p-banner-label-color', 'initial');
document.documentElement.style.setProperty('--catlinks-background-color', 'initial');
document.documentElement.style.setProperty('--catlinks-border-color', 'initial');
document.documentElement.style.setProperty('--mw-body-color', 'initial');
document.documentElement.style.setProperty('--mw-body-border', '1px solid #a7d7f9');
document.documentElement.style.setProperty('--vector-menu-content-list-background-color', 'initial');
document.documentElement.style.setProperty('--div-simpleSearch-searchInput-background-color', 'initial');
document.documentElement.style.setProperty('--vector-menu-tabs-vector-menu-tabs-a-mw-head-vector-menu-dropdown-vector-menu-heading-background-image', 'linear-gradient(to bottom,rgba(167,215,249,0) 0,#a7d7f9 100%)');
document.documentElement.style.setProperty('--vector-menu-tabs-legacy-selected-background-color', 'none');
document.documentElement.style.setProperty('--vector-menu-tabs-legacy-li-background-image', 'linear-gradient(to top,#77c1f6 0,#e8f2f8 1px,#fff 100%)');
document.documentElement.style.setProperty('--project-settings-background-color', '#f3f5f7');
document.documentElement.style.setProperty('--project-settings-border', '1px solid var(--border-color-base,#a2a9b1)');
document.documentElement.style.setProperty('--logo-div-background-image', 'url(https://upload.wikimedia.org/wikipedia/commons/e/e3/Wikipedia_logo_letters_banner.svg)');
document.documentElement.style.setProperty('--logo-div-background-color', 'var(--background-color-neutral-subtle, #f8f9fa)');
document.documentElement.style.setProperty('--logo-div-border', '1px solid var(--border-color-subtle, #c8ccd1)');
document.documentElement.style.setProperty('--logo-div-border-radius', '2px');
document.documentElement.style.setProperty('--logo-div-box-shadow', '0 1px 1px rgba(0, 0, 0, .15)');
}
// Сохранение переменной в localStorage
$("#ca-custom").click(function(){
if(myVariable == "true"){
localStorage.setItem("isLightTheme", "false");
} else{
localStorage.setItem("isLightTheme", "true");
}
location.reload(true);
console.log(typeof localStorage.getItem("isLightTheme"));
});
});
document.body.style.display= "block";