MediaWiki:Common.js — различия между версиями
Материал из Oktell
Admin (обсуждение | вклад) |
Admin (обсуждение | вклад) |
||
| Строка 1: | Строка 1: | ||
| − | |||
| − | |||
| − | |||
| − | |||
(function () { | (function () { | ||
var STORAGE_KEY = 'oktell_cookie_consent'; | var STORAGE_KEY = 'oktell_cookie_consent'; | ||
| Строка 67: | Строка 63: | ||
document.addEventListener('DOMContentLoaded', createCookieBanner); | document.addEventListener('DOMContentLoaded', createCookieBanner); | ||
| + | })(); | ||
| + | |||
| + | |||
| + | /* Фиксированная дата для UI_Designer */ | ||
| + | (function () { | ||
| + | function fixUIDesignerDate() { | ||
| + | if (mw.config.get('wgPageName') !== 'UI_Designer') { | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | var lastmod = document.getElementById('footer-info-lastmod'); | ||
| + | |||
| + | if (lastmod) { | ||
| + | lastmod.textContent = | ||
| + | 'Последнее изменение этой страницы: 11:13, 18 августа 2026.'; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | if (document.readyState === 'loading') { | ||
| + | document.addEventListener('DOMContentLoaded', fixUIDesignerDate); | ||
| + | } else { | ||
| + | fixUIDesignerDate(); | ||
| + | } | ||
})(); | })(); | ||
Текущая версия на 08:26, 18 августа 2026
(function () {
var STORAGE_KEY = 'oktell_cookie_consent';
function hasConsent() {
return localStorage.getItem(STORAGE_KEY) === 'accepted';
}
function hasDeclined() {
return localStorage.getItem(STORAGE_KEY) === 'declined';
}
function saveConsent(value) {
localStorage.setItem(STORAGE_KEY, value);
}
function createCookieBanner() {
if (hasConsent() || hasDeclined()) {
return;
}
var banner = document.createElement('div');
banner.className = 'oktell-cookie-banner';
banner.innerHTML =
'<div class="oktell-cookie-text">' +
'Мы используем cookies для корректной работы сайта, анализа посещаемости и улучшения пользовательского опыта. ' +
'Продолжая пользоваться сайтом, вы можете согласиться с использованием cookies. ' +
'<a href="/index.php?title=Политика_конфиденциальности">Подробнее в Политике конфиденциальности</a>.' +
'</div>' +
'<div class="oktell-cookie-actions">' +
'<button type="button" class="oktell-cookie-btn oktell-cookie-decline">Не согласен</button>' +
'<button type="button" class="oktell-cookie-btn oktell-cookie-accept">Согласен</button>' +
'</div>';
document.body.appendChild(banner);
setTimeout(function () {
banner.classList.add('is-visible');
}, 300);
var acceptBtn = banner.querySelector('.oktell-cookie-accept');
var declineBtn = banner.querySelector('.oktell-cookie-decline');
acceptBtn.addEventListener('click', function () {
saveConsent('accepted');
banner.classList.remove('is-visible');
setTimeout(function () {
banner.remove();
}, 300);
if (typeof window.oktellLoadAnalytics === 'function') {
window.oktellLoadAnalytics();
}
});
declineBtn.addEventListener('click', function () {
saveConsent('declined');
banner.classList.remove('is-visible');
setTimeout(function () {
banner.remove();
}, 300);
});
}
document.addEventListener('DOMContentLoaded', createCookieBanner);
})();
/* Фиксированная дата для UI_Designer */
(function () {
function fixUIDesignerDate() {
if (mw.config.get('wgPageName') !== 'UI_Designer') {
return;
}
var lastmod = document.getElementById('footer-info-lastmod');
if (lastmod) {
lastmod.textContent =
'Последнее изменение этой страницы: 11:13, 18 августа 2026.';
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', fixUIDesignerDate);
} else {
fixUIDesignerDate();
}
})();