re-added 'mini-menu'
All checks were successful
Run Integration Tests / test (push) Successful in 34s
All checks were successful
Run Integration Tests / test (push) Successful in 34s
This commit is contained in:
parent
28a721887c
commit
7e573e6928
3 changed files with 214 additions and 15 deletions
144
static/css/style-menu.css
Normal file
144
static/css/style-menu.css
Normal file
|
@ -0,0 +1,144 @@
|
|||
.settings-search-div-search {
|
||||
right: 20px;
|
||||
top: 25px;
|
||||
position: fixed;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.settings-icon-link-search {
|
||||
font-size: 25px;
|
||||
background-color: inherit;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.search-menu {
|
||||
position: fixed;
|
||||
height: 420px;
|
||||
width: 330px;
|
||||
right: 0;
|
||||
margin-top: 60px;
|
||||
z-index: 9999;
|
||||
margin-right: 20px;
|
||||
background-color: var(--html-bg);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
top: 24px;
|
||||
|
||||
/* Transition for fade in/out */
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.search-menu h2 {
|
||||
color: var(--font-fg);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
font-size: 1.5rem;
|
||||
margin: 14px;
|
||||
}
|
||||
|
||||
.search-menu button {
|
||||
margin-top: 10px;
|
||||
color: var(--font-fg);
|
||||
background-color: var(--button);
|
||||
font-size: 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
width: 90%;
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
.search-menu button:hover {
|
||||
border: 1px solid var(--font-fg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.settings-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Initially hidden state */
|
||||
.settings-menu-hidden {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Visible state triggers fade in */
|
||||
.settings-menu-visible {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.theme-settings {
|
||||
margin-top: 10px;
|
||||
width: 90%;
|
||||
border: 1px solid var(--snip-border);
|
||||
background: var(--snip-background);
|
||||
color: var(--font-fg);
|
||||
border-radius: 4px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.theme-settings p {
|
||||
margin: 0px;
|
||||
padding-top: 5px;
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.lang {
|
||||
margin-top: 10px;
|
||||
border: 1px solid var(--button);
|
||||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
font-size: 15px;
|
||||
color: var(--font-fg);
|
||||
width: 90%;
|
||||
background: var(--button);
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
.lang:hover {
|
||||
border: 1px solid var(--font-fg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.view-image-search {
|
||||
border: 1px solid var(--snip-border);
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
vertical-align: bottom;
|
||||
border-radius: 4px;
|
||||
transition: border 0.3s ease;
|
||||
}
|
||||
|
||||
.view-image-search:hover {
|
||||
border: 1px solid var(--font-fg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.themes-settings-menu {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
/* On screens 450px or less, make the menu cover the whole page */
|
||||
@media (max-width: 450px) {
|
||||
.search-menu {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
margin-top: 50;
|
||||
margin-right: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
42
static/js/minimenu.js
Normal file
42
static/js/minimenu.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Define the updateSettings function first
|
||||
function updateSettings(settingKey, settingValue) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/updateSettings', true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xhr.onload = function () {
|
||||
if (this.status >= 200 && this.status < 300) {
|
||||
console.log('Settings updated successfully!');
|
||||
} else {
|
||||
console.log('Failed to update settings.');
|
||||
}
|
||||
};
|
||||
xhr.send(encodeURI(settingKey + '=' + settingValue));
|
||||
}
|
||||
|
||||
const settingsIcon = document.querySelector('.settings-icon-link-search');
|
||||
const searchMenu = document.querySelector('.search-menu');
|
||||
|
||||
settingsIcon.addEventListener('click', function () {
|
||||
searchMenu.classList.toggle('settings-menu-hidden');
|
||||
searchMenu.classList.toggle('settings-menu-visible');
|
||||
});
|
||||
|
||||
// Theme change event listeners
|
||||
document.getElementById('dark_theme').addEventListener('click', function () {
|
||||
window.location.href = '/search?theme=dark';
|
||||
});
|
||||
document.getElementById('light_theme').addEventListener('click', function () {
|
||||
window.location.href = '/search?theme=light';
|
||||
});
|
||||
|
||||
// Event listener for Safe Search Selection
|
||||
document.getElementById('safeSearchSelect').addEventListener('change', function () {
|
||||
updateSettings('safe', this.value);
|
||||
});
|
||||
|
||||
// Event listener for Language Selection
|
||||
document.getElementById('languageSelect').addEventListener('change', function () {
|
||||
updateSettings('lang', this.value);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue