diff --git a/static/css/style.css b/static/css/style.css index 28f5e1f..33fb56b 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1357,10 +1357,10 @@ p { left: 50%; transform: translateX(-50%); padding: 10px; - background-color: var(--html-bg); + background-color: var(--search-bg); border: 1px solid var(--border); - border-radius: 15px; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + border-radius: 5px; + box-shadow: 0 0 10px var(--box-shadow); z-index: 1000; width: auto; max-width: 80%; @@ -1370,9 +1370,9 @@ p { /* Map container */ #map { - height: calc(100% - 60px); /* Adjust this value based on the header height */ + height: calc(100% - 60px); width: 100%; - top: 60px; /* Same value as in the results-search-container margin-top */ + top: 60px; } /* Leaflet control buttons */ @@ -1465,86 +1465,22 @@ p { text-shadow: 1px 1px 2px var(--border) !important; /* Adjust text shadow */ } -/* Ensuring dark theme compliance */ -@media (prefers-color-scheme: dark) { - .leaflet-control-locate, - .leaflet-control-layers-toggle, - .leaflet-bar a, - .leaflet-bar a:hover, - .leaflet-popup-content-wrapper, - .leaflet-popup-tip, - .leaflet-control-attribution, - .leaflet-control-scale, - .leaflet-control-scale-line { - background-color: var(--button) !important; - border: 1px solid var(--border) !important; - color: var(--fg) !important; - text-shadow: 1px 1px 2px var(--background-color) !important; /* Dark theme shadow adjustment */ - } - - .leaflet-control-attribution a { - color: var(--link) !important; - } -} - -/* --- */ - -/* Variables for light theme */ -:root { - --background-color: #ffffff; - --text-color: #000000; - --highlight: #007bff; - --border-color: #dddddd; - --search-bg: #f1f3f4; - --search-bg-input: #ffffff; - --search-bg-input-border: #dfe1e5; - --button: #f8f9fa; - --link: #1a0dab; - --fg: #202124; - --html-bg: #ffffff; - --snip-border: #dfe1e5; - --snip-background: #ffffff; - --image-view: #ffffff; - --image-view-titlebar: #f1f3f4; - --search-button: #5f6368; - --image-select: #e8f0fe; - --view-image-color: #f8f9fa; - --footer-bg: #f2f2f2; - --footer-font: #70757a; - --border: #e0e0e0; - --link-visited: #660099; - --publish-info: #70757a; - --green: #3c802c; -} - -/* Styles for dark theme */ -@media (prefers-color-scheme: dark) { - :root { - --background-color: #202124; - --text-color: #e8eaed; - --highlight: #8ab4f8; - --border-color: #5f6368; - --search-bg: #303134; - --search-bg-input: #202124; - --search-bg-input-border: #5f6368; - --button: #3c4043; - --link: #8ab4f8; - --fg: #e8eaed; - --html-bg: #202124; - --snip-border: #5f6368; - --snip-background: #303134; - --image-view: #202124; - --image-view-titlebar: #303134; - --search-button: #e8eaed; - --image-select: #5f6368; - --view-image-color: #202124; - --footer-bg: #303134; - --footer-font: #e8eaed; - --border: #5f6368; - --link-visited: #c79fff; - --publish-info: #e8eaed; - --green: #8ab4f8; - } +.message-bottom-left { + display: none; + align-items: center; + justify-content: center; + position: fixed; + bottom: 20px; + right: 20px; + background-color: var(--search-bg); + color: var(--text-color); + padding: 10px; + border-radius: 5px; + z-index: 1000; + text-align: center; + flex-direction: column; + border: 1px solid var(--border); + box-shadow: 0 0 10px var(--box-shadow); } body, h1, p, a, input, button { @@ -1889,3 +1825,87 @@ body, h1, p, a, input, button { } } + +/* --- */ + +/* Ensuring dark theme compliance */ +@media (prefers-color-scheme: dark) { + .leaflet-control-locate, + .leaflet-control-layers-toggle, + .leaflet-bar a, + .leaflet-bar a:hover, + .leaflet-popup-content-wrapper, + .leaflet-popup-tip, + .leaflet-control-attribution, + .leaflet-control-scale, + .leaflet-control-scale-line { + background-color: var(--button) !important; + border: 1px solid var(--border) !important; + color: var(--fg) !important; + text-shadow: 1px 1px 2px var(--background-color) !important; /* Dark theme shadow adjustment */ + } + + .leaflet-control-attribution a { + color: var(--link) !important; + } +} + +/* Variables for light theme */ +:root { + --background-color: #ffffff; + --text-color: #000000; + --highlight: #007bff; + --border-color: #dddddd; + --search-bg: #f1f3f4; + --search-bg-input: #ffffff; + --search-bg-input-border: #dfe1e5; + --button: #f8f9fa; + --link: #1a0dab; + --fg: #202124; + --html-bg: #ffffff; + --snip-border: #dfe1e5; + --snip-background: #ffffff; + --image-view: #ffffff; + --image-view-titlebar: #f1f3f4; + --search-button: #5f6368; + --image-select: #e8f0fe; + --view-image-color: #f8f9fa; + --footer-bg: #f2f2f2; + --footer-font: #70757a; + --border: #e0e0e0; + --link-visited: #660099; + --publish-info: #70757a; + --green: #3c802c; + --box-shadow: #00000020; +} + +/* Styles for dark theme */ +@media (prefers-color-scheme: dark) { + :root { + --background-color: #202124; + --text-color: #e8eaed; + --highlight: #8ab4f8; + --border-color: #5f6368; + --search-bg: #303134; + --search-bg-input: #202124; + --search-bg-input-border: #5f6368; + --button: #3c4043; + --link: #8ab4f8; + --fg: #e8eaed; + --html-bg: #202124; + --snip-border: #5f6368; + --snip-background: #303134; + --image-view: #202124; + --image-view-titlebar: #303134; + --search-button: #e8eaed; + --image-select: #5f6368; + --view-image-color: #202124; + --footer-bg: #303134; + --footer-font: #e8eaed; + --border: #5f6368; + --link-visited: #c79fff; + --publish-info: #e8eaed; + --green: #8ab4f8; + --box-shadow: #ffffff20; + } +} diff --git a/templates/images.html b/templates/images.html index 3ae4a86..9ef54fe 100644 --- a/templates/images.html +++ b/templates/images.html @@ -11,15 +11,15 @@

Ocásek

- - - -
+ + + +
-
+
@@ -33,17 +33,16 @@
-
- - -
+
+ + +
-
@@ -58,27 +57,10 @@
-
+
{{ if .Results }}
- -
- - -
- - - -
- - -
- Selected Image -
-
- -
{{ range .Results }}
@@ -93,29 +75,90 @@
{{ end }}
- -
-
- - - {{ if .HasPrevPage }} - - - {{ end }} - {{ if .HasNextPage }} - - - {{ end }} -
-
- {{ else }} + + {{ else if .NoResults }}
No results found for '{{ .Query }}'. Try different keywords.
+ {{ else }} +
Looks like this is the end of results.
{{ end }}
- +
+ Searching for new results... +
- \ No newline at end of file + diff --git a/templates/text.html b/templates/text.html index 319397d..92d1ed9 100644 --- a/templates/text.html +++ b/templates/text.html @@ -73,6 +73,9 @@
Looks like this is the end of results.
{{end}}
+
+ Searching for new results... +
@@ -94,13 +97,23 @@ const query = "{{ .Query }}"; let loading = false; let hasMoreResults = true; + const loadingIndicator = document.getElementById('message-bottom-left'); + let loadingTimeout; function loadResults(newPage) { if (loading || !hasMoreResults) return; loading = true; + + // Show loading indicator if taking more than 100ms + loadingTimeout = setTimeout(() => { + loadingIndicator.style.display = 'flex'; + }, 100); + fetch(`/search?q=${encodeURIComponent(query)}&t=text&p=${newPage}`) .then(response => response.text()) .then(data => { + clearTimeout(loadingTimeout); + loadingIndicator.style.display = 'none'; const parser = new DOMParser(); const doc = parser.parseFromString(data, 'text/html'); const newResults = doc.getElementById('results').innerHTML; @@ -116,6 +129,8 @@ loading = false; }) .catch(error => { + clearTimeout(loadingTimeout); + loadingIndicator.style.display = 'none'; console.error('Error loading results:', error); loading = false; });