MediaWiki:Common.js: відмінності між версіями
Wiki (обговорення | внесок) Немає опису редагування |
Wiki (обговорення | внесок) Немає опису редагування |
||
| Рядок 919: | Рядок 919: | ||
// Також запускаємо при завантаженні | // Також запускаємо при завантаженні | ||
document.addEventListener('DOMContentLoaded', addToMenu); | document.addEventListener('DOMContentLoaded', addToMenu); | ||
// Створення плаваючих кнопок для мобільної версії | |||
function createMobileButtons() { | |||
// Перевіряємо чи це мобільна версія | |||
if (!document.body.classList.contains('skin-minerva')) return; | |||
// Перевіряємо чи кнопки вже існують | |||
if (document.getElementById('mobile-random-btn')) return; | |||
// Створюємо контейнер для кнопок | |||
const buttonContainer = document.createElement('div'); | |||
buttonContainer.id = 'mobile-buttons-container'; | |||
buttonContainer.style.cssText = ` | |||
position: fixed; | |||
bottom: 80px; | |||
right: 15px; | |||
z-index: 10000; | |||
display: flex; | |||
flex-direction: column; | |||
gap: 10px; | |||
`; | |||
// Кнопка "Випадкова сторінка" | |||
const randomButton = document.createElement('button'); | |||
randomButton.id = 'mobile-random-btn'; | |||
randomButton.innerHTML = '🎲'; | |||
randomButton.title = 'Випадкова сторінка'; | |||
randomButton.style.cssText = ` | |||
width: 60px; | |||
height: 60px; | |||
border-radius: 50%; | |||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |||
border: none; | |||
color: white; | |||
font-size: 24px; | |||
cursor: pointer; | |||
box-shadow: 0 4px 15px rgba(0,0,0,0.3); | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
transition: all 0.3s ease; | |||
`; | |||
// Кнопка "Головна сторінка" | |||
const homeButton = document.createElement('button'); | |||
homeButton.id = 'mobile-home-btn'; | |||
homeButton.innerHTML = '🏠'; | |||
homeButton.title = 'Головна сторінка'; | |||
homeButton.style.cssText = ` | |||
width: 60px; | |||
height: 60px; | |||
border-radius: 50%; | |||
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); | |||
border: none; | |||
color: white; | |||
font-size: 24px; | |||
cursor: pointer; | |||
box-shadow: 0 4px 15px rgba(0,0,0,0.3); | |||
display: flex; | |||
align-items: center; | |||
justify-content: center; | |||
transition: all 0.3s ease; | |||
`; | |||
// Додаємо обробники подій | |||
randomButton.addEventListener('click', function() { | |||
window.location.href = '/w/index.php/%D0%A1%D0%BF%D0%B5%D1%86%D1%96%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0:%D0%92%D0%B8%D0%BF%D0%B0%D0%B4%D0%BA%D0%BE%D0%B2%D0%B0_%D1%81%D1%82%D0%BE%D1%80%D1%96%D0%BD%D0%BA%D0%B0'; | |||
}); | |||
homeButton.addEventListener('click', function() { | |||
window.location.href = '/w/index.php/%D0%93%D0%BE%D0%BB%D0%BE%D0%B2%D0%BD%D0%B0_%D1%81%D1%82%D0%BE%D1%80%D1%96%D0%BD%D0%BA%D0%B0'; | |||
}); | |||
// Ефекти при наведенні | |||
randomButton.addEventListener('mouseenter', function() { | |||
this.style.transform = 'scale(1.1)'; | |||
this.style.boxShadow = '0 6px 20px rgba(0,0,0,0.4)'; | |||
}); | |||
randomButton.addEventListener('mouseleave', function() { | |||
this.style.transform = 'scale(1)'; | |||
this.style.boxShadow = '0 4px 15px rgba(0,0,0,0.3)'; | |||
}); | |||
homeButton.addEventListener('mouseenter', function() { | |||
this.style.transform = 'scale(1.1)'; | |||
this.style.boxShadow = '0 6px 20px rgba(0,0,0,0.4)'; | |||
}); | |||
homeButton.addEventListener('mouseleave', function() { | |||
this.style.transform = 'scale(1)'; | |||
this.style.boxShadow = '0 4px 15px rgba(0,0,0,0.3)'; | |||
}); | |||
// Додаємо кнопки в контейнер | |||
buttonContainer.appendChild(randomButton); | |||
buttonContainer.appendChild(homeButton); | |||
// Додаємо контейнер на сторінку | |||
document.body.appendChild(buttonContainer); | |||
} | |||
// Запускаємо при завантаженні | |||
document.addEventListener('DOMContentLoaded', createMobileButtons); | |||