map improvements + added forums search
This commit is contained in:
parent
c848c72aea
commit
8da387f8e9
12 changed files with 424 additions and 65 deletions
90
templates/forums.html
Normal file
90
templates/forums.html
Normal file
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{.Query}} - Ocásek</title>
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<form action="/search" id="prev-next-form" class="results-search-container" method="GET" autocomplete="off">
|
||||
<h1 class="logomobile"><a class="no-decoration" href="./">Ocásek</a></h1>
|
||||
<div class="wrapper-results">
|
||||
<input type="text" name="q" value="{{ .Query }}" id="search-input" placeholder="Type to search..." />
|
||||
<button id="search-wrapper-ico" class="material-icons-round" name="t" value="forum">search</button>
|
||||
<input type="submit" class="hide" name="t" value="forum" />
|
||||
</div>
|
||||
<div class="sub-search-button-wrapper">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="text">search</button>
|
||||
<button name="t" value="text" class="clickable">Web</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="image">image</button>
|
||||
<button name="t" value="image" class="clickable">Images</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="video">movie</button>
|
||||
<button name="t" value="video" class="clickable">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable search-active" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable search-active">Forums</button>
|
||||
</div>
|
||||
<div id="content" class="js-enabled">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable">Maps</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="torrent">share</button>
|
||||
<button name="t" value="torrent" class="clickable">Torrents</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form class="results_settings" action="/search" method="get">
|
||||
<input type="hidden" name="q" value="{{ .Query }}">
|
||||
<select class="results-settings" name="safe" id="safeSearchSelect">
|
||||
<option value="">Safe Search Off</option>
|
||||
<option value="active">Safe Search On</option>
|
||||
</select>
|
||||
<select class="results-settings" name="lang" id="languageSelect">
|
||||
{{range .LanguageOptions}}
|
||||
<option value="{{.Code}}" {{if eq .Code $.CurrentLang}}selected{{end}}>{{.Name}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
<button class="results-save" name="t" value="text">Apply settings</button>
|
||||
</form>
|
||||
<div class="results">
|
||||
{{if .Results}}
|
||||
{{range .Results}}
|
||||
<div class="result_item">
|
||||
<a href="{{.URL}}">{{.URL}}</a>
|
||||
<a href="{{.URL}}"><h3>{{.Header}}</h3></a>
|
||||
<p>{{.Description}}</p>
|
||||
</div>
|
||||
<br>
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="no-results">No results found for '{{ .Query }}'. Try different keywords.</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="prev-next prev-img">
|
||||
<form action="/search" method="get">
|
||||
<input type="hidden" name="q" value="{{ .Query }}">
|
||||
<input type="hidden" name="t" value="text">
|
||||
{{ if .HasPrevPage }}
|
||||
<button type="submit" name="p" value="{{ sub .Page 1 }}">Previous</button>
|
||||
{{ end }}
|
||||
{{ if .HasNextPage }}
|
||||
<button type="submit" name="p" value="{{ add .Page 1 }}">Next</button>
|
||||
{{ end }}
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
// Check if JavaScript is enabled and modify the DOM accordingly
|
||||
document.getElementById('content').classList.remove('js-enabled');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -28,13 +28,13 @@
|
|||
<button name="t" value="video" class="clickable">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="reddit">forum</button>
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable">Forums</button>
|
||||
</div>
|
||||
<div id="content" class="js-enabled">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable">Map</button>
|
||||
<button name="t" value="map" class="clickable">Maps</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
|
|
|
@ -15,18 +15,9 @@
|
|||
overflow: hidden;
|
||||
}
|
||||
#map {
|
||||
height: 100%;
|
||||
height: calc(100% - 100px);
|
||||
width: 100%;
|
||||
}
|
||||
.no-decoration {
|
||||
padding: 1px;
|
||||
border-radius: 5px;
|
||||
left: 20px;
|
||||
}
|
||||
/* Reposition the Leaflet control container */
|
||||
.leaflet-top.leaflet-left {
|
||||
top: 70px; /* Adjust this value based on your logo's height */
|
||||
left: 10px;
|
||||
top: 100px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
@ -38,28 +29,118 @@
|
|||
<button id="search-wrapper-ico" class="material-icons-round" name="t" value="map">search</button>
|
||||
<input type="submit" class="hide" name="t" value="map" />
|
||||
</div>
|
||||
<div class="sub-search-button-wrapper">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="text">search</button>
|
||||
<button name="t" value="text" class="clickable">Web</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="image">image</button>
|
||||
<button name="t" value="image" class="clickable">Images</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="video">movie</button>
|
||||
<button name="t" value="video" class="clickable">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable">Forums</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable search-active" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable search-active">Maps</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="torrent">share</button>
|
||||
<button name="t" value="torrent" class="clickable">Torrents</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div id="map"></div>
|
||||
<script>
|
||||
var map = L.map('map').setView([50.0755, 14.4378], 13); // Default to Prague, Czech Republic
|
||||
{{ if .Found }}
|
||||
<div id="map"></div>
|
||||
{{ else }}
|
||||
<div id="map"></div>
|
||||
<div class="message">No results found for "{{ .Query }}". Please try another search.</div>
|
||||
{{ end }}
|
||||
{{ if .Found }}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var map = L.map('map').setView([{{ .Latitude }}, {{ .Longitude }}], 13); // Set view to found coordinates
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
// Base layers
|
||||
var streets = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
});
|
||||
|
||||
// Use the passed coordinates to update the map
|
||||
var latitude = {{ .Latitude }};
|
||||
var longitude = {{ .Longitude }};
|
||||
var satellite = L.tileLayer('https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
});
|
||||
|
||||
L.marker([latitude, longitude]).addTo(map)
|
||||
.bindPopup('{{ .Query }}')
|
||||
var esriSat = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{x}/{y}', {
|
||||
maxZoom: 19,
|
||||
attribution: 'Tiles © Esri'
|
||||
});
|
||||
|
||||
function updateMap(latitude, longitude) {
|
||||
map.setView([latitude, longitude], 13); // Set view to new coordinates
|
||||
}
|
||||
var topo = L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 17,
|
||||
attribution: '© OpenTopoMap contributors'
|
||||
});
|
||||
|
||||
updateMap(latitude, longitude); // Update the map view to the new location
|
||||
</script>
|
||||
var baseMaps = {
|
||||
"Streets": streets,
|
||||
"Satellite": satellite,
|
||||
"Esri Satellite": esriSat,
|
||||
"Topographic": topo
|
||||
};
|
||||
|
||||
streets.addTo(map); // Add default layer
|
||||
|
||||
// Layer control
|
||||
L.control.layers(baseMaps).addTo(map);
|
||||
|
||||
// Marker with passed coordinates
|
||||
L.marker([{{ .Latitude }}, {{ .Longitude }}]).addTo(map)
|
||||
.bindPopup('{{ .Query }}');
|
||||
|
||||
// Add scale control
|
||||
L.control.scale().addTo(map);
|
||||
|
||||
// Add custom control for geolocation
|
||||
L.Control.geolocate = L.Control.extend({
|
||||
onAdd: function(map) {
|
||||
var div = L.DomUtil.create('div', 'leaflet-control-locate');
|
||||
div.title = 'Locate Me';
|
||||
L.DomEvent.on(div, 'click', function() {
|
||||
map.locate({setView: true, maxZoom: 16});
|
||||
});
|
||||
return div;
|
||||
}
|
||||
});
|
||||
|
||||
L.control.geolocate = function(opts) {
|
||||
return new L.Control.geolocate(opts);
|
||||
}
|
||||
|
||||
L.control.geolocate({ position: 'topright' }).addTo(map);
|
||||
|
||||
// Geolocation function
|
||||
function onLocationFound(e) {
|
||||
var radius = e.accuracy / 2;
|
||||
L.marker(e.latlng).addTo(map)
|
||||
.bindPopup("You are within " + radius + " meters from this point").openPopup();
|
||||
L.circle(e.latlng, radius).addTo(map);
|
||||
}
|
||||
|
||||
function onLocationError(e) {
|
||||
alert(e.message);
|
||||
}
|
||||
|
||||
map.on('locationfound', onLocationFound);
|
||||
map.on('locationerror', onLocationError);
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -28,9 +28,15 @@
|
|||
<button name="t" value="video" class="clickable">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="reddit">forum</button>
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable">Forums</button>
|
||||
</div>
|
||||
<div id="content" class="js-enabled">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable">Maps</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="torrent">share</button>
|
||||
<button name="t" value="torrent" class="clickable">Torrents</button>
|
||||
|
@ -66,5 +72,9 @@
|
|||
<input type="submit" class="results-settings" value="Save">
|
||||
</form>
|
||||
<div>
|
||||
<script>
|
||||
// Check if JavaScript is enabled and modify the DOM accordingly
|
||||
document.getElementById('content').classList.remove('js-enabled');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
<button name="t" value="video" class="clickable">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="reddit">forum</button>
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable">Forums</button>
|
||||
</div>
|
||||
<div id="content" class="js-enabled">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable">Map</button>
|
||||
<button name="t" value="map" class="clickable">Maps</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
<button name="t" value="video" class="clickable search-active">Videos</button>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="reddit">forum</button>
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="forum">forum</button>
|
||||
<button name="t" value="forum" class="clickable">Forums</button>
|
||||
</div>
|
||||
<div id="content" class="js-enabled">
|
||||
<div class="search-container-results-btn">
|
||||
<button id="sub-search-wrapper-ico" class="material-icons-round clickable" name="t" value="map">map</button>
|
||||
<button name="t" value="map" class="clickable">Map</button>
|
||||
<button name="t" value="map" class="clickable">Maps</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-container-results-btn">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue