Spirit/functions/toggles.js
2024-08-29 17:14:50 -04:00

51 lines
No EOL
2.6 KiB
JavaScript

// Open Settings
function ShowSettings() {
var SettingsPopup = document.querySelector('.toolbar-popups > #settings-popup')
if (SettingsPopup.style.display === "block") {
SettingsPopup.style.display = "none";
} else {
SettingsPopup.style.display = "block";
}
}
// Search
function ToggleOnSearch() { localStorage.setItem('enable-search', "true"); location.href = '/' }
function ToggleOffSearch() { localStorage.setItem('enable-search', "false"); location.href = '/' }
if (localStorage.getItem('enable-search') === "true") {
document.getElementById('search-btn-toggle').setAttribute('onclick', 'ToggleOffSearch()')
document.querySelector('.search').style.display = 'block'
document.querySelector('#search-toggle-disabled').style.display = 'none'
} else {
document.getElementById('search-btn-toggle').setAttribute('onclick', 'ToggleOnSearch()')
document.querySelector('.search').style.display = 'none'
document.querySelector('#search-toggle-enabled').style.display = 'none'
}
// Clock
function ToggleOnClock() { localStorage.setItem('enable-clock', "true"); location.href = '/' }
function ToggleOffClock() { localStorage.setItem('enable-clock', "false"); location.href = '/' }
if (localStorage.getItem('enable-clock') === "true") {
document.getElementById('main-clock-btn-toggle').setAttribute('onclick', 'ToggleOffClock()')
document.getElementById('main-clock').style.display = 'block'
document.getElementById('main-clock-toggle-disabled').style.display = 'none'
} else {
document.getElementById('main-clock-btn-toggle').setAttribute('onclick', 'ToggleOnClock()')
document.getElementById('main-clock').style.display = 'none'
document.getElementById('main-clock-toggle-enabled').style.display = 'none'
}
// Wallpaper Credits
function ToggleOnWallpapercredits() { localStorage.setItem('enable-wallpaper-credits', "true"); location.href = '/' }
function ToggleOffWallpapercredits() { localStorage.setItem('enable-wallpaper-credits', "false"); location.href = '/' }
if (localStorage.getItem('enable-wallpaper-credits') === "true") {
document.getElementById('wallpaper-credit-btn-toggle').setAttribute('onclick', 'ToggleOffWallpapercredits()')
document.getElementById('wallpaper-credit').style.display = 'block'
document.getElementById('wallpaper-credit-toggle-disabled').style.display = 'none'
} else {
document.getElementById('wallpaper-credit-btn-toggle').setAttribute('onclick', 'ToggleOnWallpapercredits()')
document.getElementById('wallpaper-credit').style.display = 'none'
document.getElementById('wallpaper-credit-toggle-enabled').style.display = 'none'
}