mirror of
https://github.com/searxng/searxng.git
synced 2026-08-04 06:11:25 +00:00
Compare commits
4 Commits
176079977d
...
06f6ee4e36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06f6ee4e36 | ||
|
|
9beff8212b | ||
|
|
cf4e183790 | ||
|
|
c1fcee9d9f |
@@ -33,14 +33,19 @@
|
|||||||
``autocomplete``:
|
``autocomplete``:
|
||||||
Existing autocomplete backends, leave blank to turn it off.
|
Existing autocomplete backends, leave blank to turn it off.
|
||||||
|
|
||||||
- ``dbpedia``
|
- ``baidu```
|
||||||
- ``duckduckgo``
|
- ``brave```
|
||||||
- ``google``
|
- ``dbpedia```
|
||||||
- ``mwmbl``
|
- ``duckduckgo```
|
||||||
- ``startpage``
|
- ``google```
|
||||||
- ``swisscows``
|
- ``mwmbl```
|
||||||
- ``qwant``
|
- ``qwant```
|
||||||
- ``wikipedia``
|
- ``seznam```
|
||||||
|
- ``startpage```
|
||||||
|
- ``stract```
|
||||||
|
- ``swisscows```
|
||||||
|
- ``wikipedia```
|
||||||
|
- ``yandex```
|
||||||
|
|
||||||
``favicon_resolver``:
|
``favicon_resolver``:
|
||||||
To activate favicons in SearXNG's result list select a default
|
To activate favicons in SearXNG's result list select a default
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ brand:
|
|||||||
search:
|
search:
|
||||||
# Filter results. 0: None, 1: Moderate, 2: Strict
|
# Filter results. 0: None, 1: Moderate, 2: Strict
|
||||||
safe_search: 0
|
safe_search: 0
|
||||||
# Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "yandex", "mwmbl",
|
# Existing autocomplete backends: "baidu", "brave", "dbpedia", "duckduckgo", "google", "yandex",
|
||||||
# "seznam", "startpage", "stract", "swisscows", "qwant", "wikipedia" - leave blank to turn it off
|
# "mwmbl", "seznam", "startpage", "stract", "swisscows", "qwant", "wikipedia" -
|
||||||
# by default.
|
# leave blank to turn it off by default.
|
||||||
autocomplete: ""
|
autocomplete: ""
|
||||||
# minimun characters to type before autocompleter starts
|
# minimun characters to type before autocompleter starts
|
||||||
autocomplete_min: 4
|
autocomplete_min: 4
|
||||||
|
|||||||
2
searx/static/themes/simple/js/searxng.min.js
vendored
2
searx/static/themes/simple/js/searxng.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -52,43 +52,80 @@
|
|||||||
this.innerText = this.dataset.copiedText;
|
this.innerText = this.dataset.copiedText;
|
||||||
});
|
});
|
||||||
|
|
||||||
const isMobile = screen.orientation.type.startsWith('portrait');
|
// searxng.selectImage (gallery)
|
||||||
searxng.selectImage = function (resultElement) {
|
// -----------------------------
|
||||||
/* eslint no-unused-vars: 0 */
|
|
||||||
if (resultElement) {
|
|
||||||
// load full size image in background
|
|
||||||
const imgElement = resultElement.querySelector('.result-images-source img');
|
|
||||||
const thumbnailElement = resultElement.querySelector('.image_thumbnail');
|
|
||||||
const detailElement = resultElement.querySelector('.detail');
|
|
||||||
if (imgElement) {
|
|
||||||
const imgSrc = imgElement.getAttribute('data-src');
|
|
||||||
if (imgSrc) {
|
|
||||||
const loader = d.createElement('div');
|
|
||||||
const imgLoader = new Image();
|
|
||||||
|
|
||||||
loader.classList.add('loader');
|
// setTimeout() ID, needed to cancel *last* loadImage
|
||||||
detailElement.appendChild(loader);
|
let imgTimeoutID;
|
||||||
|
|
||||||
imgLoader.onload = e => {
|
// progress spinner, while an image is loading
|
||||||
imgElement.src = imgSrc;
|
const imgLoaderSpinner = d.createElement('div');
|
||||||
loader.remove();
|
imgLoaderSpinner.classList.add('loader');
|
||||||
};
|
|
||||||
imgLoader.onerror = e => {
|
// singleton image object, which is used for all loading processes of a
|
||||||
loader.remove();
|
// detailed image
|
||||||
};
|
const imgLoader = new Image();
|
||||||
imgLoader.src = imgSrc;
|
|
||||||
imgElement.src = thumbnailElement.src;
|
const loadImage = (imgSrc, onSuccess) => {
|
||||||
imgElement.removeAttribute('data-src');
|
// if defered image load exists, stop defered task.
|
||||||
}
|
if (imgTimeoutID) clearTimeout(imgTimeoutID);
|
||||||
}
|
|
||||||
}
|
// defer load of the detail image for 1 sec
|
||||||
|
imgTimeoutID = setTimeout(() => {
|
||||||
|
imgLoader.src = imgSrc;
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
// set handlers in the on-properties
|
||||||
|
imgLoader.onload = () => {
|
||||||
|
onSuccess();
|
||||||
|
imgLoaderSpinner.remove();
|
||||||
|
};
|
||||||
|
imgLoader.onerror = () => {
|
||||||
|
imgLoaderSpinner.remove();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
searxng.selectImage = (resultElement) => {
|
||||||
|
|
||||||
|
// add a class that can be evaluated in the CSS and indicates that the
|
||||||
|
// detail view is open
|
||||||
d.getElementById('results').classList.add('image-detail-open');
|
d.getElementById('results').classList.add('image-detail-open');
|
||||||
|
|
||||||
// add a hash to the browser history so that pressing back doesn't return to the previous page
|
// add a hash to the browser history so that pressing back doesn't return
|
||||||
// this allows us to dismiss the image details on pressing the back button on mobile devices
|
// to the previous page this allows us to dismiss the image details on
|
||||||
|
// pressing the back button on mobile devices
|
||||||
window.location.hash = '#image-viewer';
|
window.location.hash = '#image-viewer';
|
||||||
|
|
||||||
searxng.scrollPageToSelected();
|
searxng.scrollPageToSelected();
|
||||||
|
|
||||||
|
// if there is none element given by the caller, stop here
|
||||||
|
if (!resultElement) return;
|
||||||
|
|
||||||
|
// find <img> object in the element, if there is none, stop here.
|
||||||
|
const img = resultElement.querySelector('.result-images-source img');
|
||||||
|
if (!img) return;
|
||||||
|
|
||||||
|
// <img src="" data-src="http://example.org/image.jpg">
|
||||||
|
const src = img.getAttribute('data-src');
|
||||||
|
|
||||||
|
// already loaded high-res image or no high-res image available
|
||||||
|
if (!src) return;
|
||||||
|
|
||||||
|
// use the image thumbnail until the image is fully loaded
|
||||||
|
const thumbnail = resultElement.querySelector('.image_thumbnail');
|
||||||
|
img.src = thumbnail.src;
|
||||||
|
|
||||||
|
// show a progress spinner
|
||||||
|
const detailElement = resultElement.querySelector('.detail');
|
||||||
|
detailElement.appendChild(imgLoaderSpinner);
|
||||||
|
|
||||||
|
// load full size image in background
|
||||||
|
loadImage(src, () => {
|
||||||
|
// after the singelton loadImage has loaded the detail image into the
|
||||||
|
// cache, it can be used in the origin <img> as src property.
|
||||||
|
img.src = src;
|
||||||
|
img.removeAttribute('data-src');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
searxng.closeDetail = function () {
|
searxng.closeDetail = function () {
|
||||||
@@ -117,10 +154,10 @@
|
|||||||
|
|
||||||
d.querySelectorAll('.swipe-horizontal').forEach(
|
d.querySelectorAll('.swipe-horizontal').forEach(
|
||||||
obj => {
|
obj => {
|
||||||
obj.addEventListener('swiped-left', function (e) {
|
obj.addEventListener('swiped-left', function () {
|
||||||
searxng.selectNext(false);
|
searxng.selectNext(false);
|
||||||
});
|
});
|
||||||
obj.addEventListener('swiped-right', function (e) {
|
obj.addEventListener('swiped-right', function () {
|
||||||
searxng.selectPrevious(false);
|
searxng.selectPrevious(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user