summaryrefslogtreecommitdiff
path: root/searx/static/themes/oscar/js/searxng.js
diff options
context:
space:
mode:
Diffstat (limited to 'searx/static/themes/oscar/js/searxng.js')
-rw-r--r--searx/static/themes/oscar/js/searxng.js376
1 files changed, 188 insertions, 188 deletions
diff --git a/searx/static/themes/oscar/js/searxng.js b/searx/static/themes/oscar/js/searxng.js
index edeeaee84..29423e1dd 100644
--- a/searx/static/themes/oscar/js/searxng.js
+++ b/searx/static/themes/oscar/js/searxng.js
@@ -184,191 +184,6 @@ $(document).ready(function(){
searxng.image_thumbnail_layout.watch();
});
;/**
- * @license
- * (C) Copyright Contributors to the SearXNG project.
- * (C) Copyright Contributors to the searx project (2014 - 2021).
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-$(document).ready(function() {
- function hasScrollbar() {
- var root = document.compatMode=='BackCompat'? document.body : document.documentElement;
- return root.scrollHeight>root.clientHeight;
- }
-
- function loadNextPage() {
- var formData = $('#pagination form:last').serialize();
- if (formData) {
- $('#pagination').html('<div class="loading-spinner"></div>');
- $.ajax({
- type: "POST",
- url: $('#search_form').prop('action'),
- data: formData,
- dataType: 'html',
- success: function(data) {
- var body = $(data);
- $('#pagination').remove();
- $('#main_results').append('<hr/>');
- $('#main_results').append(body.find('.result'));
- $('#main_results').append(body.find('#pagination'));
- if(!hasScrollbar()) {
- loadNextPage();
- }
- }
- });
- }
- }
-
- if (searxng.infinite_scroll) {
- var win = $(window);
- $("html").addClass('infinite_scroll');
- if(!hasScrollbar()) {
- loadNextPage();
- }
- win.on('scroll', function() {
- if ($(document).height() - win.height() - win.scrollTop() < 150) {
- loadNextPage();
- }
- });
- }
-
-});
-;/**
- * @license
- * (C) Copyright Contributors to the SearXNG project.
- * (C) Copyright Contributors to the searx project (2014 - 2021).
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-window.addEventListener('load', function() {
- // Hide infobox toggle if shrunk size already fits all content.
- $('.infobox').each(function() {
- var infobox_body = $(this).find('.infobox_body');
- var total_height = infobox_body.prop('scrollHeight') + infobox_body.find('img.infobox_part').height();
- var max_height = infobox_body.css('max-height').replace('px', '');
- if (total_height <= max_height) {
- $(this).find('.infobox_toggle').hide();
- }
- });
-});
-;/**
- * @license
- * (C) Copyright Contributors to the SearXNG project.
- * (C) Copyright Contributors to the searx project (2014 - 2021).
- * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-$(document).ready(function(){
- $(".searxng_init_map").on( "click", function( event ) {
- var leaflet_target = $(this).data('leaflet-target');
- var map_lon = $(this).data('map-lon');
- var map_lat = $(this).data('map-lat');
- var map_zoom = $(this).data('map-zoom');
- var map_boundingbox = $(this).data('map-boundingbox');
- var map_geojson = $(this).data('map-geojson');
-
- if(map_boundingbox) {
- southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]);
- northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]);
- map_bounds = L.latLngBounds(southWest, northEast);
- }
-
- // change default imagePath
- L.Icon.Default.imagePath = "./static/themes/oscar/css/images/";
-
- // init map
- var map = L.map(leaflet_target);
-
- // create the tile layer with correct attribution
- var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
- var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
- var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
-
- var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';
- var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
- var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
-
- // init map view
- setTimeout(function() {
- if(map_bounds) {
- map.fitBounds(map_bounds, {
- maxZoom:17
- });
- } else if (map_lon && map_lat) {
- if(map_zoom)
- map.setView(new L.LatLng(map_lat, map_lon),map_zoom);
- else
- map.setView(new L.LatLng(map_lat, map_lon),8);
- }
- }, 0);
-
- map.addLayer(osmMapnik);
-
- var baseLayers = {
- "OSM Mapnik": osmMapnik/*,
- "OSM Wikimedia": osmWikimedia*/
- };
-
- L.control.layers(baseLayers).addTo(map);
-
- if(map_geojson)
- L.geoJson(map_geojson).addTo(map);
- /*else if(map_bounds)
- L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/
-
- // this event occour only once per element
- $( this ).off( event );
- });
-});
-;/**
- * @license
- * (C) Copyright Contributors to the SearXNG project.
- * (C) Copyright Contributors to the searx project (2014 - 2021).
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-$(document).ready(function(){
- let engine_descriptions = null;
- function load_engine_descriptions() {
- if (engine_descriptions == null) {
- $.ajax("engine_descriptions.json", dataType="json").done(function(data) {
- engine_descriptions = data;
- for (const [engine_name, description] of Object.entries(data)) {
- let elements = $('[data-engine-name="' + engine_name + '"] .description');
- for(const element of elements) {
- let source = ' (<i>' + searxng.translations.Source + ':&nbsp;' + description[1] + '</i>)';
- element.innerHTML = description[0] + source;
- }
- }
- });
- }
- }
-
- if (document.querySelector('body[class="preferences_endpoint"]')) {
- $('[data-engine-name]').hover(function() {
- load_engine_descriptions();
- });
- }
-});
-;/**
- * @license
- * (C) Copyright Contributors to the SearXNG project.
- * (C) Copyright Contributors to the searx project (2014 - 2021).
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-$(document).ready(function(){
- $("#allow-all-engines").click(function() {
- $(".onoffswitch-checkbox").each(function() { this.checked = false;});
- });
-
- $("#disable-all-engines").click(function() {
- $(".onoffswitch-checkbox").each(function() { this.checked = true;});
- });
-});
-
-;/**
*
* Google Image Layout v0.0.1
* Description, by Anh Trinh.
@@ -498,7 +313,7 @@ $(document).ready(function(){
obj.trottleCallToAlign = null;
}, 20);
}
- }
+ };
ImageLayout.prototype.align = function () {
var i;
@@ -553,7 +368,7 @@ $(document).ready(function(){
img.classList.add('aligned');
}
}
- }
+ };
ImageLayout.prototype.watch = function () {
var objthrottleAlign = this.throttleAlign.bind(this);
@@ -586,9 +401,194 @@ $(document).ready(function(){
subtree: true,
attributes: false,
characterData: false,
- })
+ });
};
w.searxng.ImageLayout = ImageLayout;
}(window, document));
+;/**
+ * @license
+ * (C) Copyright Contributors to the SearXNG project.
+ * (C) Copyright Contributors to the searx project (2014 - 2021).
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+$(document).ready(function() {
+ function hasScrollbar() {
+ var root = document.compatMode=='BackCompat'? document.body : document.documentElement;
+ return root.scrollHeight>root.clientHeight;
+ }
+
+ function loadNextPage() {
+ var formData = $('#pagination form:last').serialize();
+ if (formData) {
+ $('#pagination').html('<div class="loading-spinner"></div>');
+ $.ajax({
+ type: "POST",
+ url: $('#search_form').prop('action'),
+ data: formData,
+ dataType: 'html',
+ success: function(data) {
+ var body = $(data);
+ $('#pagination').remove();
+ $('#main_results').append('<hr/>');
+ $('#main_results').append(body.find('.result'));
+ $('#main_results').append(body.find('#pagination'));
+ if(!hasScrollbar()) {
+ loadNextPage();
+ }
+ }
+ });
+ }
+ }
+
+ if (searxng.infinite_scroll) {
+ var win = $(window);
+ $("html").addClass('infinite_scroll');
+ if(!hasScrollbar()) {
+ loadNextPage();
+ }
+ win.on('scroll', function() {
+ if ($(document).height() - win.height() - win.scrollTop() < 150) {
+ loadNextPage();
+ }
+ });
+ }
+
+});
+;/**
+ * @license
+ * (C) Copyright Contributors to the SearXNG project.
+ * (C) Copyright Contributors to the searx project (2014 - 2021).
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+window.addEventListener('load', function() {
+ // Hide infobox toggle if shrunk size already fits all content.
+ $('.infobox').each(function() {
+ var infobox_body = $(this).find('.infobox_body');
+ var total_height = infobox_body.prop('scrollHeight') + infobox_body.find('img.infobox_part').height();
+ var max_height = infobox_body.css('max-height').replace('px', '');
+ if (total_height <= max_height) {
+ $(this).find('.infobox_toggle').hide();
+ }
+ });
+});
+;/**
+ * @license
+ * (C) Copyright Contributors to the SearXNG project.
+ * (C) Copyright Contributors to the searx project (2014 - 2021).
+ * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+$(document).ready(function(){
+ $(".searxng_init_map").on( "click", function( event ) {
+ var leaflet_target = $(this).data('leaflet-target');
+ var map_lon = $(this).data('map-lon');
+ var map_lat = $(this).data('map-lat');
+ var map_zoom = $(this).data('map-zoom');
+ var map_boundingbox = $(this).data('map-boundingbox');
+ var map_geojson = $(this).data('map-geojson');
+
+ if(map_boundingbox) {
+ southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]);
+ northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]);
+ map_bounds = L.latLngBounds(southWest, northEast);
+ }
+
+ // change default imagePath
+ L.Icon.Default.imagePath = "./static/themes/oscar/css/images/";
+
+ // init map
+ var map = L.map(leaflet_target);
+
+ // create the tile layer with correct attribution
+ var osmMapnikUrl='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
+ var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
+ var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
+
+ var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';
+ var osmWikimediaAttrib = 'Wikimedia maps beta | Maps data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
+ var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
+
+ // init map view
+ setTimeout(function() {
+ if(map_bounds) {
+ map.fitBounds(map_bounds, {
+ maxZoom:17
+ });
+ } else if (map_lon && map_lat) {
+ if(map_zoom)
+ map.setView(new L.LatLng(map_lat, map_lon),map_zoom);
+ else
+ map.setView(new L.LatLng(map_lat, map_lon),8);
+ }
+ }, 0);
+
+ map.addLayer(osmMapnik);
+
+ var baseLayers = {
+ "OSM Mapnik": osmMapnik/*,
+ "OSM Wikimedia": osmWikimedia*/
+ };
+
+ L.control.layers(baseLayers).addTo(map);
+
+ if(map_geojson)
+ L.geoJson(map_geojson).addTo(map);
+ /*else if(map_bounds)
+ L.rectangle(map_bounds, {color: "#ff7800", weight: 3, fill:false}).addTo(map);*/
+
+ // this event occour only once per element
+ $( this ).off( event );
+ });
+});
+;/**
+ * @license
+ * (C) Copyright Contributors to the SearXNG project.
+ * (C) Copyright Contributors to the searx project (2014 - 2021).
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+$(document).ready(function(){
+ let engine_descriptions = null;
+ function load_engine_descriptions() {
+ if (engine_descriptions == null) {
+ $.ajax("engine_descriptions.json", dataType="json").done(function(data) {
+ engine_descriptions = data;
+ for (const [engine_name, description] of Object.entries(data)) {
+ let elements = $('[data-engine-name="' + engine_name + '"] .description');
+ for(const element of elements) {
+ let source = ' (<i>' + searxng.translations.Source + ':&nbsp;' + description[1] + '</i>)';
+ element.innerHTML = description[0] + source;
+ }
+ }
+ });
+ }
+ }
+
+ if (document.querySelector('body[class="preferences_endpoint"]')) {
+ $('[data-engine-name]').hover(function() {
+ load_engine_descriptions();
+ });
+ }
+});
+;/**
+ * @license
+ * (C) Copyright Contributors to the SearXNG project.
+ * (C) Copyright Contributors to the searx project (2014 - 2021).
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+$(document).ready(function(){
+ $("#allow-all-engines").click(function() {
+ $(".onoffswitch-checkbox").each(function() { this.checked = false;});
+ });
+
+ $("#disable-all-engines").click(function() {
+ $(".onoffswitch-checkbox").each(function() { this.checked = true;});
+ });
+});
+