140 lines
No EOL
6.7 KiB
HTML
Executable file
140 lines
No EOL
6.7 KiB
HTML
Executable file
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
{{ if .IsThemeDark }}
|
|
<meta name="darkreader-lock">
|
|
{{ end }}
|
|
<title>Search with Ocásek</title>
|
|
<link rel="stylesheet" href="/static/css/style.css">
|
|
<link rel="stylesheet" href="/static/css/style-search.css">
|
|
<link rel="stylesheet" href="/static/css/{{.Theme}}.css">
|
|
<link rel="search" type="application/opensearchdescription+xml" title="Ocásek" href="/opensearch.xml">
|
|
</head>
|
|
<body>
|
|
<script defer src="/static/js/autocomplete.js"></script>
|
|
<script>
|
|
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
|
|
if (siteLanguageSelect) {
|
|
siteLanguageSelect.addEventListener('change', function () {
|
|
updateSettings('site_lang', this.value);
|
|
});
|
|
}
|
|
|
|
// if (searchLanguageSelect) {
|
|
// searchLanguageSelect.addEventListener('change', function () {
|
|
// updateSettings('search_lang', this.value);
|
|
// });
|
|
// }
|
|
});
|
|
</script>
|
|
<div class="settings-search-div settings-search-div-search">
|
|
<button class="material-icons-round clickable settings-icon-link settings-icon-link-search">menu</button>
|
|
</div>
|
|
<div class="search-menu settings-menu-hidden">
|
|
<h2>Settings</h2>
|
|
<div class="settings-content">
|
|
<button id="settingsButton" onclick="window.location.href='/settings'">All settings</button> <!-- Well its unessesary to use js here but this menu will not work without js anyway -->
|
|
<div class="theme-settings theme-mini-settings">
|
|
<p><span class="highlight">Current theme: </span> <span id="theme_name">{{.Theme}}</span></p>
|
|
<div class="themes-settings-menu">
|
|
<div><img class="view-image-search clickable" id="dark_theme" alt="Dark Theme" src="/static/images/dark.webp"></div>
|
|
<div><img class="view-image-search clickable" id="light_theme" alt="Light Theme" src="/static/images/light.webp"></div>
|
|
</div>
|
|
</div>
|
|
<select class="lang" name="safe" id="safeSearchSelect">
|
|
<option value="disabled" {{if eq .Safe "disabled"}}selected{{end}}>Safe Search Off</option>
|
|
<option value="active" {{if eq .Safe "active"}}selected{{end}}>Safe Search On</option>
|
|
</select>
|
|
<select class="lang" name="site_lang" id="siteLanguageSelect">
|
|
{{range .LanguageOptions}}
|
|
<option value="{{.Code}}" {{if eq .Code $.CurrentLang}}selected{{end}}>{{.Name}}</option>
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<form action="/search" class="search-container" method="post" autocomplete="off">
|
|
<div class="search-page-content">
|
|
<h1>Ocásek</h1>
|
|
<div class="wrapper">
|
|
<input type="text" name="q" autofocus id="search-input"/> <!-- placeholder="Type to search..." -->
|
|
<button id="search-wrapper-ico" class="material-icons-round" name="t" value="web" type="submit">search</button>
|
|
<div class="autocomplete">
|
|
<ul></ul>
|
|
</div>
|
|
</div>
|
|
<div class="search-type-icons">
|
|
<input type="hidden" name="p" value="1">
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="text">search</button>
|
|
<p>Web</p>
|
|
</div>
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="image">image</button>
|
|
<p>Images</p>
|
|
</div>
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="video">movie</button>
|
|
<p>Videos</p>
|
|
</div>
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
|
<p>Forums</p>
|
|
</div>
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
|
<p>Maps</p>
|
|
</div>
|
|
|
|
<div class="icon-button">
|
|
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="file">share</button>
|
|
<p>Torrents</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</body>
|
|
</html> |