м Wiki перейменував сторінку з MediaWiki:Common.js на MediaWiki:Common1.js
Немає опису редагування
Рядок 91: Рядок 91:
         $accessBtn.text('Доступність  ON');
         $accessBtn.text('Доступність  ON');
     }
     }
  // ================== КІОСКОВИЙ РЕЖИМ ДЛЯ ЗОБРАЖЕНЬ ==================
$(document).ready(function() {
    // Перевіряємо чи це сторінка з зображенням
    var isImagePage = window.location.pathname.indexOf('/images/') !== -1 &&
                    /\.(png|jpg|jpeg|gif)$/i.test(window.location.pathname);
   
    if (isImagePage) {
        addKioskImageInterface();
    }
});
function addKioskImageInterface() {
    console.log('Додаємо кіосковий інтерфейс для зображення');
   
    // Створюємо контейнер для кнопок
    var interfaceHTML = `
        <div id="kiosk-interface" style="
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 10000;
            pointer-events: none;
        ">
            <!-- Кнопка ЗАКРИТИ -->
            <button onclick="window.history.back()" style="
                position: absolute;
                top: 20px;
                right: 20px;
                background: red;
                color: white;
                border: none;
                padding: 25px 30px;
                font-size: 28px;
                border-radius: 15px;
                cursor: pointer;
                pointer-events: auto;
                z-index: 10001;
                box-shadow: 0 4px 10px rgba(0,0,0,0.5);
            ">✕ ЗАКРИТИ</button>
           
            <!-- Кнопка ДОДОМУ -->
            <button onclick="window.location.href='/wiki/'" style="
                position: absolute;
                top: 20px;
                left: 20px;
                background: blue;
                color: white;
                border: none;
                padding: 25px 30px;
                font-size: 28px;
                border-radius: 15px;
                cursor: pointer;
                pointer-events: auto;
                z-index: 10001;
                box-shadow: 0 4px 10px rgba(0,0,0,0.5);
            ">⌂ ДОДОМУ</button>
           
            <!-- Затемнення -->
            <div style="
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0,0,0,0.8);
                pointer-events: auto;
            "></div>
        </div>
    `;
   
    // Додаємо в body
    $('body').prepend(interfaceHTML);
   
    // Додаємо стилі для зображення
    $('img').css({
        'position': 'relative',
        'z-index': '10002',
        'max-width': '90%',
        'max-height': '90%',
        'margin': 'auto',
        'display': 'block',
        'margin-top': '100px'
    });
   
    // Додаємо обробку кліку на затемнення
    $('#kiosk-interface > div').click(function() {
        window.history.back();
    });
   
    // Обробка свайпів для тачскрінів
    var startY;
    document.addEventListener('touchstart', function(e) {
        startY = e.touches[0].clientY;
    });
   
    document.addEventListener('touchend', function(e) {
        if (!startY) return;
       
        var endY = e.changedTouches[0].clientY;
        if (endY - startY > 100) { // Свайп вниз
            window.history.back();
        }
        startY = null;
    });
   
    // Клавіша ESC
    document.addEventListener('keydown', function(e) {
        if (e.key === 'Escape') {
            window.history.back();
        }
    });
   
    console.log('Кіосковий інтерфейс додано');
}