Немає опису редагування
Немає опису редагування
Рядок 92: Рядок 92:
     }
     }


    // Лупа - ТЕПЕР ПРАЦЮЄ В РЕЖИМІ ДОСТУПНОСТІ
  // ================== КІОСКОВИЙ РЕЖИМ ДЛЯ ЗОБРАЖЕНЬ ==================
    createButton('🔍 +', 130, function () {
$(document).ready(function() {
        fontSize += 2;
    // Перевіряємо чи це сторінка з зображенням
        if (fontSize > 30) fontSize = 30; // Максимальний розмір
    var isImagePage = window.location.pathname.indexOf('/images/') !== -1 &&
        localStorage.setItem('fontSize', fontSize);
                    /\.(png|jpg|jpeg|gif)$/i.test(window.location.pathname);
        applyFontSize(); // Застосовуємо з урахуванням режиму
      
    }, 'Збільшити шрифт');
     if (isImagePage) {
 
         addKioskImageInterface();
    createButton('🔍 -', 170, function () {
        fontSize -= 2;
        if (fontSize < 12) fontSize = 12; // Мінімальний розмір
        localStorage.setItem('fontSize', fontSize);
        applyFontSize(); // Застосовуємо з урахуванням режиму
     }, 'Зменшити шрифт');
 
    // Відновлення розміру шрифту при завантаженні
     if (localStorage.getItem('fontSize')) {
         fontSize = parseInt(localStorage.getItem('fontSize'), 10);
     }
     }
    applyFontSize(); // Застосовуємо початковий розмір
    // Додатково: кнопка скидання шрифту
    createButton('🔍 📏', 210, function () {
        fontSize = 16; // Стандартний розмір
        localStorage.setItem('fontSize', fontSize);
        applyFontSize();
    }, 'Скинути розмір шрифту');
});
});


// Автоматичне визначення тачскріна
function addKioskImageInterface() {
function initKioskFeatures() {
     console.log('Додаємо кіосковий інтерфейс для зображення');
     const isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
      
      
     if (isTouchDevice) {
     // Створюємо контейнер для кнопок
        // Додаємо стиль для тачскріна
    var interfaceHTML = `
         const style = document.createElement('style');
         <div id="kiosk-interface" style="
        style.textContent = `
            position: fixed;
             .touch-friendly { min-height: 44px; font-size: 18px; }
            top: 0;
             a { min-height: 44px; display: flex; align-items: center; }
            left: 0;
         `;
            width: 100%;
         document.head.appendChild(style);
            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;
        const footer = document.querySelector('#footer') || document.body;
        if (endY - startY > 100) { // Свайп вниз
         const modeSwitcher = document.createElement('div');
            window.history.back();
         modeSwitcher.innerHTML = `
         }
             <div style="position:fixed; bottom:10px; right:10px; background:#333; color:white; padding:10px; border-radius:5px;">
        startY = null;
                📱 Кіосковий режим |
    });
                <a href="?kiosk=0" style="color:white;">Звичайний режим</a>
   
            </div>
    // Клавіша ESC
        `;
    document.addEventListener('keydown', function(e) {
        footer.appendChild(modeSwitcher);
         if (e.key === 'Escape') {
    }
             window.history.back();
        }
    });
   
    console.log('Кіосковий інтерфейс додано');
}
}
// Запускаємо при завантаженні
$(document).ready(initKioskFeatures);