MediaWiki:Vector.js: различия между версиями
Aylong (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
Aylong (обсуждение | вклад) Нет описания правки Метка: отменено |
||
| Строка 22: | Строка 22: | ||
localStorage.setItem("isLightTheme", isLightTheme); | localStorage.setItem("isLightTheme", isLightTheme); | ||
} | } | ||
$(document).ready(function() { | |||
$('a').click(function(event) { | |||
var href = $(this).attr('href'); | |||
$.ajax({ | |||
url: href, | |||
dataType: 'html', | |||
success: function(data) { | |||
setTimeout(function() { | |||
$('body').html(data); | |||
}, 1000); | |||
} | |||
}); | |||
event.preventDefault(); | |||
}); | |||
}); | |||
Версия от 17:35, 4 мая 2024
$(document).ready(function() {
var button = document.createElement("button");
button.innerHTML = "Сменить тему";
button.className = "theme-button";
button.onclick = toggleTheme;
var container = document.getElementById("p-personal");
if (container) {
container.parentNode.insertBefore(button, container);
}
var isLightTheme = localStorage.getItem("isLightTheme");
if (isLightTheme === "true") {
document.documentElement.classList.add('light');
} else {
document.documentElement.classList.remove('light');
}
});
function toggleTheme() {
var isLightTheme = document.documentElement.classList.toggle('light');
localStorage.setItem("isLightTheme", isLightTheme);
}
$(document).ready(function() {
$('a').click(function(event) {
var href = $(this).attr('href');
$.ajax({
url: href,
dataType: 'html',
success: function(data) {
setTimeout(function() {
$('body').html(data);
}, 1000);
}
});
event.preventDefault();
});
});