|
Метки: очистка ручная отмена |
(не показано 56 промежуточных версий этого же участника) |
Строка 1: |
Строка 1: |
| $(document).ready(function() {
| |
| function loadCSS(url) {
| |
| var link = document.createElement('link');
| |
| link.rel = 'stylesheet';
| |
| link.type = 'text/css';
| |
| link.href = url;
| |
| document.head.appendChild(link);
| |
| }
| |
|
| |
|
| function loadJS(url, callback) {
| |
| var script = document.createElement('script');
| |
| script.type = 'text/javascript';
| |
| if (script.readyState) {
| |
| script.onreadystatechange = function() {
| |
| if (script.readyState == 'loaded' || script.readyState == 'complete') {
| |
| script.onreadystatechange = null;
| |
| callback();
| |
| }
| |
| };
| |
| } else {
| |
| script.onload = function() {
| |
| callback();
| |
| };
| |
| }
| |
| script.src = url;
| |
| document.head.appendChild(script);
| |
| }
| |
|
| |
| loadCSS('/wiki/common.css');
| |
|
| |
| loadJS('/wiki/common.js', function() {
| |
| });
| |
|
| |
| $(window).on('load', function() {
| |
| });
| |
| });
| |
|
| |
| $(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);
| |
| }
| |