forked from Ponysearch/Ponysearch
Merge pull request #276 from dalf/simple_eslint
Simple theme: eslint and bug fix
This commit is contained in:
commit
37b3d8c33b
14 changed files with 116 additions and 104 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -15,6 +15,7 @@
|
||||||
* (C) 2019 by Alexandre Flament
|
* (C) 2019 by Alexandre Flament
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
/* global DocumentTouch:readonly */
|
||||||
(function(w, d) {
|
(function(w, d) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"searx.head.min.js","sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":"CAiBA,SAAUA,EAAGC,gBAIT,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX"}
|
{"version":3,"file":"searx.head.min.js","sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":"CAkBA,SAAUA,EAAGC,gBAIT,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX"}
|
|
@ -70,7 +70,7 @@ window.searx = (function(w, d) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.http = function(method, url, callback) {
|
searx.http = function(method, url) {
|
||||||
var req = new XMLHttpRequest(),
|
var req = new XMLHttpRequest(),
|
||||||
resolve = function() {},
|
resolve = function() {},
|
||||||
reject = function() {},
|
reject = function() {},
|
||||||
|
@ -148,21 +148,22 @@ window.searx = (function(w, d) {
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.insertBefore = function (newNode, referenceNode) {
|
searx.insertBefore = function (newNode, referenceNode) {
|
||||||
element.parentNode.insertBefore(newNode, referenceNode);
|
referenceNode.parentNode.insertBefore(newNode, referenceNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.insertAfter = function(newNode, referenceNode) {
|
searx.insertAfter = function(newNode, referenceNode) {
|
||||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
referenceNode.parentNode.insertAfter(newNode, referenceNode.nextSibling);
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.on('.close', 'click', function(e) {
|
searx.on('.close', 'click', function() {
|
||||||
var el = e.target || e.srcElement;
|
|
||||||
this.parentNode.classList.add('invisible');
|
this.parentNode.classList.add('invisible');
|
||||||
});
|
});
|
||||||
|
|
||||||
return searx;
|
return searx;
|
||||||
})(window, document);
|
})(window, document);
|
||||||
;searx.ready(function() {
|
;/*global searx*/
|
||||||
|
|
||||||
|
searx.ready(function() {
|
||||||
|
|
||||||
searx.on('.result', 'click', function() {
|
searx.on('.result', 'click', function() {
|
||||||
highlightResult(this)(true);
|
highlightResult(this)(true);
|
||||||
|
@ -244,13 +245,13 @@ window.searx = (function(w, d) {
|
||||||
},
|
},
|
||||||
80: {
|
80: {
|
||||||
key: 'p',
|
key: 'p',
|
||||||
fun: pageButtonClick(0),
|
fun: GoToPreviousPage(),
|
||||||
des: 'go to previous page',
|
des: 'go to previous page',
|
||||||
cat: 'Results'
|
cat: 'Results'
|
||||||
},
|
},
|
||||||
78: {
|
78: {
|
||||||
key: 'n',
|
key: 'n',
|
||||||
fun: pageButtonClick(1),
|
fun: GoToNextPage(),
|
||||||
des: 'go to next page',
|
des: 'go to next page',
|
||||||
cat: 'Results'
|
cat: 'Results'
|
||||||
},
|
},
|
||||||
|
@ -282,7 +283,7 @@ window.searx = (function(w, d) {
|
||||||
|
|
||||||
searx.on(document, "keydown", function(e) {
|
searx.on(document, "keydown", function(e) {
|
||||||
// check for modifiers so we don't break browser's hotkeys
|
// check for modifiers so we don't break browser's hotkeys
|
||||||
if (vimKeys.hasOwnProperty(e.keyCode) && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
|
if (Object.prototype.hasOwnProperty.call(vimKeys, e.keyCode) && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
|
||||||
var tagName = e.target.tagName.toLowerCase();
|
var tagName = e.target.tagName.toLowerCase();
|
||||||
if (e.keyCode === 27) {
|
if (e.keyCode === 27) {
|
||||||
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') {
|
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') {
|
||||||
|
@ -380,21 +381,23 @@ window.searx = (function(w, d) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageButtonClick(num) {
|
function pageButtonClick(css_selector) {
|
||||||
return function() {
|
return function() {
|
||||||
var buttons = $('div#pagination button[type="submit"]');
|
var button = document.querySelector(css_selector);
|
||||||
if (buttons.length !== 2) {
|
if (button) {
|
||||||
console.log('page navigation with this theme is not supported');
|
button.click();
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (num >= 0 && num < buttons.length) {
|
|
||||||
buttons[num].click();
|
|
||||||
} else {
|
|
||||||
console.log('pageButtonClick(): invalid argument');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GoToNextPage() {
|
||||||
|
return pageButtonClick('nav#pagination .next_page button[type="submit"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
function GoToPreviousPage() {
|
||||||
|
return pageButtonClick('nav#pagination .previous_page button[type="submit"]');
|
||||||
|
}
|
||||||
|
|
||||||
function scrollPageToSelected() {
|
function scrollPageToSelected() {
|
||||||
var sel = document.querySelector('.result[data-vim-selected]');
|
var sel = document.querySelector('.result[data-vim-selected]');
|
||||||
if (sel === null) {
|
if (sel === null) {
|
||||||
|
@ -472,9 +475,9 @@ window.searx = (function(w, d) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '<a href="#" class="close" aria-label="close" title="close">×</a>';
|
var html = '<a href="#" class="close" aria-label="close" title="close">×</a>';
|
||||||
html += '<h3>How to navigate searx with Vim-like hotkeys</h3>';
|
html += '<h3>How to navigate searx with Vim-like hotkeys</h3>';
|
||||||
html += '<table>';
|
html += '<table>';
|
||||||
|
|
||||||
for (var i = 0; i < sorted.length; i++) {
|
for (var i = 0; i < sorted.length; i++) {
|
||||||
var cat = categories[sorted[i]];
|
var cat = categories[sorted[i]];
|
||||||
|
@ -502,31 +505,31 @@ window.searx = (function(w, d) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</table>';
|
html += '</table>';
|
||||||
|
|
||||||
divElement.innerHTML = html;
|
divElement.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleHelp() {
|
function toggleHelp() {
|
||||||
var helpPanel = document.querySelector('#vim-hotkeys-help');
|
var helpPanel = document.querySelector('#vim-hotkeys-help');
|
||||||
console.log(helpPanel);
|
console.log(helpPanel);
|
||||||
if (helpPanel === undefined || helpPanel === null) {
|
if (helpPanel === undefined || helpPanel === null) {
|
||||||
// first call
|
// first call
|
||||||
helpPanel = document.createElement('div');
|
helpPanel = document.createElement('div');
|
||||||
helpPanel.id = 'vim-hotkeys-help';
|
helpPanel.id = 'vim-hotkeys-help';
|
||||||
helpPanel.className='dialog-modal';
|
helpPanel.className='dialog-modal';
|
||||||
helpPanel.style='width: 40%';
|
helpPanel.style='width: 40%';
|
||||||
|
initHelpContent(helpPanel);
|
||||||
initHelpContent(helpPanel);
|
initHelpContent(helpPanel);
|
||||||
var body = document.getElementsByTagName('body')[0];
|
initHelpContent(helpPanel);
|
||||||
body.appendChild(helpPanel);
|
var body = document.getElementsByTagName('body')[0];
|
||||||
} else {
|
body.appendChild(helpPanel);
|
||||||
// togggle hidden
|
} else {
|
||||||
helpPanel.classList.toggle('invisible');
|
// togggle hidden
|
||||||
return;
|
helpPanel.classList.toggle('invisible');
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
;/**
|
;/**
|
||||||
* searx is free software: you can redistribute it and/or modify
|
* searx is free software: you can redistribute it and/or modify
|
||||||
|
@ -545,6 +548,7 @@ window.searx = (function(w, d) {
|
||||||
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
|
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
|
||||||
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
||||||
*/
|
*/
|
||||||
|
/* global L */
|
||||||
(function (w, d, searx) {
|
(function (w, d, searx) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -577,7 +581,7 @@ window.searx = (function(w, d) {
|
||||||
var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
|
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 osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
|
||||||
var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';
|
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 osmWikimediaAttrib = 'Wikimedia maps | Maps data © <a href="https://openstreetmap.org">OpenStreetMap contributors</a>';
|
||||||
var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
|
var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
|
||||||
// init map view
|
// init map view
|
||||||
if(map_bounds) {
|
if(map_bounds) {
|
||||||
|
@ -599,8 +603,8 @@ window.searx = (function(w, d) {
|
||||||
map.addLayer(osmMapnik);
|
map.addLayer(osmMapnik);
|
||||||
|
|
||||||
var baseLayers = {
|
var baseLayers = {
|
||||||
"OSM Mapnik": osmMapnik/*,
|
"OSM Mapnik": osmMapnik,
|
||||||
"OSM Wikimedia": osmWikimedia*/
|
"OSM Wikimedia": osmWikimedia,
|
||||||
};
|
};
|
||||||
|
|
||||||
L.control.layers(baseLayers).addTo(map);
|
L.control.layers(baseLayers).addTo(map);
|
||||||
|
@ -640,7 +644,7 @@ window.searx = (function(w, d) {
|
||||||
searx.image_thumbnail_layout = new searx.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 10, 200);
|
searx.image_thumbnail_layout = new searx.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 10, 200);
|
||||||
searx.image_thumbnail_layout.watch();
|
searx.image_thumbnail_layout.watch();
|
||||||
|
|
||||||
searx.on('.btn-collapse', 'click', function(event) {
|
searx.on('.btn-collapse', 'click', function() {
|
||||||
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
|
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
|
||||||
var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');
|
var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');
|
||||||
var target = this.getAttribute('data-target');
|
var target = this.getAttribute('data-target');
|
||||||
|
@ -656,7 +660,7 @@ window.searx = (function(w, d) {
|
||||||
targetElement.classList.toggle('invisible');
|
targetElement.classList.toggle('invisible');
|
||||||
});
|
});
|
||||||
|
|
||||||
searx.on('.media-loader', 'click', function(event) {
|
searx.on('.media-loader', 'click', function() {
|
||||||
var target = this.getAttribute('data-target');
|
var target = this.getAttribute('data-target');
|
||||||
var iframe_load = d.querySelector(target + ' > iframe');
|
var iframe_load = d.querySelector(target + ' > iframe');
|
||||||
var srctest = iframe_load.getAttribute('src');
|
var srctest = iframe_load.getAttribute('src');
|
||||||
|
@ -696,6 +700,7 @@ window.searx = (function(w, d) {
|
||||||
*
|
*
|
||||||
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
||||||
*/
|
*/
|
||||||
|
/* global AutoComplete */
|
||||||
(function(w, d, searx) {
|
(function(w, d, searx) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -738,7 +743,7 @@ window.searx = (function(w, d) {
|
||||||
searx.ready(function() {
|
searx.ready(function() {
|
||||||
qinput = d.getElementById(qinput_id);
|
qinput = d.getElementById(qinput_id);
|
||||||
|
|
||||||
function placeCursorAtEndOnce(e) {
|
function placeCursorAtEndOnce() {
|
||||||
if (firstFocus) {
|
if (firstFocus) {
|
||||||
placeCursorAtEnd(qinput);
|
placeCursorAtEnd(qinput);
|
||||||
firstFocus = false;
|
firstFocus = false;
|
||||||
|
@ -780,7 +785,7 @@ window.searx = (function(w, d) {
|
||||||
if (qinput !== null && searx.search_on_category_select) {
|
if (qinput !== null && searx.search_on_category_select) {
|
||||||
d.querySelector('.help').className='invisible';
|
d.querySelector('.help').className='invisible';
|
||||||
|
|
||||||
searx.on('#categories input', 'change', function(e) {
|
searx.on('#categories input', 'change', function() {
|
||||||
var i, categories = d.querySelectorAll('#categories input[type="checkbox"]');
|
var i, categories = d.querySelectorAll('#categories input[type="checkbox"]');
|
||||||
for(i=0; i<categories.length; i++) {
|
for(i=0; i<categories.length; i++) {
|
||||||
if (categories[i] !== this && categories[i].checked) {
|
if (categories[i] !== this && categories[i].checked) {
|
||||||
|
|
2
searx/static/themes/simple/js/searx.min.js
vendored
2
searx/static/themes/simple/js/searx.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
|
@ -15,6 +15,7 @@
|
||||||
* (C) 2019 by Alexandre Flament
|
* (C) 2019 by Alexandre Flament
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
/* global DocumentTouch:readonly */
|
||||||
(function(w, d) {
|
(function(w, d) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ window.searx = (function(w, d) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.http = function(method, url, callback) {
|
searx.http = function(method, url) {
|
||||||
var req = new XMLHttpRequest(),
|
var req = new XMLHttpRequest(),
|
||||||
resolve = function() {},
|
resolve = function() {},
|
||||||
reject = function() {},
|
reject = function() {},
|
||||||
|
@ -148,15 +148,14 @@ window.searx = (function(w, d) {
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.insertBefore = function (newNode, referenceNode) {
|
searx.insertBefore = function (newNode, referenceNode) {
|
||||||
element.parentNode.insertBefore(newNode, referenceNode);
|
referenceNode.parentNode.insertBefore(newNode, referenceNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.insertAfter = function(newNode, referenceNode) {
|
searx.insertAfter = function(newNode, referenceNode) {
|
||||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
referenceNode.parentNode.insertAfter(newNode, referenceNode.nextSibling);
|
||||||
};
|
};
|
||||||
|
|
||||||
searx.on('.close', 'click', function(e) {
|
searx.on('.close', 'click', function() {
|
||||||
var el = e.target || e.srcElement;
|
|
||||||
this.parentNode.classList.add('invisible');
|
this.parentNode.classList.add('invisible');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/*global searx*/
|
||||||
|
|
||||||
searx.ready(function() {
|
searx.ready(function() {
|
||||||
|
|
||||||
searx.on('.result', 'click', function() {
|
searx.on('.result', 'click', function() {
|
||||||
|
@ -80,13 +82,13 @@ searx.ready(function() {
|
||||||
},
|
},
|
||||||
80: {
|
80: {
|
||||||
key: 'p',
|
key: 'p',
|
||||||
fun: pageButtonClick(0),
|
fun: GoToPreviousPage(),
|
||||||
des: 'go to previous page',
|
des: 'go to previous page',
|
||||||
cat: 'Results'
|
cat: 'Results'
|
||||||
},
|
},
|
||||||
78: {
|
78: {
|
||||||
key: 'n',
|
key: 'n',
|
||||||
fun: pageButtonClick(1),
|
fun: GoToNextPage(),
|
||||||
des: 'go to next page',
|
des: 'go to next page',
|
||||||
cat: 'Results'
|
cat: 'Results'
|
||||||
},
|
},
|
||||||
|
@ -118,7 +120,7 @@ searx.ready(function() {
|
||||||
|
|
||||||
searx.on(document, "keydown", function(e) {
|
searx.on(document, "keydown", function(e) {
|
||||||
// check for modifiers so we don't break browser's hotkeys
|
// check for modifiers so we don't break browser's hotkeys
|
||||||
if (vimKeys.hasOwnProperty(e.keyCode) && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
|
if (Object.prototype.hasOwnProperty.call(vimKeys, e.keyCode) && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
|
||||||
var tagName = e.target.tagName.toLowerCase();
|
var tagName = e.target.tagName.toLowerCase();
|
||||||
if (e.keyCode === 27) {
|
if (e.keyCode === 27) {
|
||||||
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') {
|
if (tagName === 'input' || tagName === 'select' || tagName === 'textarea') {
|
||||||
|
@ -216,21 +218,23 @@ searx.ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageButtonClick(num) {
|
function pageButtonClick(css_selector) {
|
||||||
return function() {
|
return function() {
|
||||||
var buttons = $('div#pagination button[type="submit"]');
|
var button = document.querySelector(css_selector);
|
||||||
if (buttons.length !== 2) {
|
if (button) {
|
||||||
console.log('page navigation with this theme is not supported');
|
button.click();
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (num >= 0 && num < buttons.length) {
|
|
||||||
buttons[num].click();
|
|
||||||
} else {
|
|
||||||
console.log('pageButtonClick(): invalid argument');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function GoToNextPage() {
|
||||||
|
return pageButtonClick('nav#pagination .next_page button[type="submit"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
function GoToPreviousPage() {
|
||||||
|
return pageButtonClick('nav#pagination .previous_page button[type="submit"]');
|
||||||
|
}
|
||||||
|
|
||||||
function scrollPageToSelected() {
|
function scrollPageToSelected() {
|
||||||
var sel = document.querySelector('.result[data-vim-selected]');
|
var sel = document.querySelector('.result[data-vim-selected]');
|
||||||
if (sel === null) {
|
if (sel === null) {
|
||||||
|
@ -308,9 +312,9 @@ searx.ready(function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '<a href="#" class="close" aria-label="close" title="close">×</a>';
|
var html = '<a href="#" class="close" aria-label="close" title="close">×</a>';
|
||||||
html += '<h3>How to navigate searx with Vim-like hotkeys</h3>';
|
html += '<h3>How to navigate searx with Vim-like hotkeys</h3>';
|
||||||
html += '<table>';
|
html += '<table>';
|
||||||
|
|
||||||
for (var i = 0; i < sorted.length; i++) {
|
for (var i = 0; i < sorted.length; i++) {
|
||||||
var cat = categories[sorted[i]];
|
var cat = categories[sorted[i]];
|
||||||
|
@ -338,29 +342,29 @@ searx.ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</table>';
|
html += '</table>';
|
||||||
|
|
||||||
divElement.innerHTML = html;
|
divElement.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleHelp() {
|
function toggleHelp() {
|
||||||
var helpPanel = document.querySelector('#vim-hotkeys-help');
|
var helpPanel = document.querySelector('#vim-hotkeys-help');
|
||||||
console.log(helpPanel);
|
console.log(helpPanel);
|
||||||
if (helpPanel === undefined || helpPanel === null) {
|
if (helpPanel === undefined || helpPanel === null) {
|
||||||
// first call
|
// first call
|
||||||
helpPanel = document.createElement('div');
|
helpPanel = document.createElement('div');
|
||||||
helpPanel.id = 'vim-hotkeys-help';
|
helpPanel.id = 'vim-hotkeys-help';
|
||||||
helpPanel.className='dialog-modal';
|
helpPanel.className='dialog-modal';
|
||||||
helpPanel.style='width: 40%';
|
helpPanel.style='width: 40%';
|
||||||
|
initHelpContent(helpPanel);
|
||||||
initHelpContent(helpPanel);
|
initHelpContent(helpPanel);
|
||||||
var body = document.getElementsByTagName('body')[0];
|
initHelpContent(helpPanel);
|
||||||
body.appendChild(helpPanel);
|
var body = document.getElementsByTagName('body')[0];
|
||||||
} else {
|
body.appendChild(helpPanel);
|
||||||
// togggle hidden
|
} else {
|
||||||
helpPanel.classList.toggle('invisible');
|
// togggle hidden
|
||||||
return;
|
helpPanel.classList.toggle('invisible');
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
|
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
|
||||||
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
||||||
*/
|
*/
|
||||||
|
/* global L */
|
||||||
(function (w, d, searx) {
|
(function (w, d, searx) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -47,7 +48,7 @@
|
||||||
var osmMapnikAttrib='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors';
|
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 osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});
|
||||||
var osmWikimediaUrl='https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';
|
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 osmWikimediaAttrib = 'Wikimedia maps | Maps data © <a href="https://openstreetmap.org">OpenStreetMap contributors</a>';
|
||||||
var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
|
var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});
|
||||||
// init map view
|
// init map view
|
||||||
if(map_bounds) {
|
if(map_bounds) {
|
||||||
|
@ -69,8 +70,8 @@
|
||||||
map.addLayer(osmMapnik);
|
map.addLayer(osmMapnik);
|
||||||
|
|
||||||
var baseLayers = {
|
var baseLayers = {
|
||||||
"OSM Mapnik": osmMapnik/*,
|
"OSM Mapnik": osmMapnik,
|
||||||
"OSM Wikimedia": osmWikimedia*/
|
"OSM Wikimedia": osmWikimedia,
|
||||||
};
|
};
|
||||||
|
|
||||||
L.control.layers(baseLayers).addTo(map);
|
L.control.layers(baseLayers).addTo(map);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
searx.image_thumbnail_layout = new searx.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 10, 200);
|
searx.image_thumbnail_layout = new searx.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 10, 200);
|
||||||
searx.image_thumbnail_layout.watch();
|
searx.image_thumbnail_layout.watch();
|
||||||
|
|
||||||
searx.on('.btn-collapse', 'click', function(event) {
|
searx.on('.btn-collapse', 'click', function() {
|
||||||
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
|
var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');
|
||||||
var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');
|
var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');
|
||||||
var target = this.getAttribute('data-target');
|
var target = this.getAttribute('data-target');
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
targetElement.classList.toggle('invisible');
|
targetElement.classList.toggle('invisible');
|
||||||
});
|
});
|
||||||
|
|
||||||
searx.on('.media-loader', 'click', function(event) {
|
searx.on('.media-loader', 'click', function() {
|
||||||
var target = this.getAttribute('data-target');
|
var target = this.getAttribute('data-target');
|
||||||
var iframe_load = d.querySelector(target + ' > iframe');
|
var iframe_load = d.querySelector(target + ' > iframe');
|
||||||
var srctest = iframe_load.getAttribute('src');
|
var srctest = iframe_load.getAttribute('src');
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
*
|
*
|
||||||
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
* (C) 2017 by Alexandre Flament, <alex@al-f.net>
|
||||||
*/
|
*/
|
||||||
|
/* global AutoComplete */
|
||||||
(function(w, d, searx) {
|
(function(w, d, searx) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
searx.ready(function() {
|
searx.ready(function() {
|
||||||
qinput = d.getElementById(qinput_id);
|
qinput = d.getElementById(qinput_id);
|
||||||
|
|
||||||
function placeCursorAtEndOnce(e) {
|
function placeCursorAtEndOnce() {
|
||||||
if (firstFocus) {
|
if (firstFocus) {
|
||||||
placeCursorAtEnd(qinput);
|
placeCursorAtEnd(qinput);
|
||||||
firstFocus = false;
|
firstFocus = false;
|
||||||
|
@ -98,7 +99,7 @@
|
||||||
if (qinput !== null && searx.search_on_category_select) {
|
if (qinput !== null && searx.search_on_category_select) {
|
||||||
d.querySelector('.help').className='invisible';
|
d.querySelector('.help').className='invisible';
|
||||||
|
|
||||||
searx.on('#categories input', 'change', function(e) {
|
searx.on('#categories input', 'change', function() {
|
||||||
var i, categories = d.querySelectorAll('#categories input[type="checkbox"]');
|
var i, categories = d.querySelectorAll('#categories input[type="checkbox"]');
|
||||||
for(i=0; i<categories.length; i++) {
|
for(i=0; i<categories.length; i++) {
|
||||||
if (categories[i] !== this && categories[i].checked) {
|
if (categories[i] !== this && categories[i].checked) {
|
||||||
|
|
|
@ -146,7 +146,7 @@
|
||||||
{% if paging %}
|
{% if paging %}
|
||||||
<nav id="pagination">
|
<nav id="pagination">
|
||||||
{% if pageno > 1 %}
|
{% if pageno > 1 %}
|
||||||
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
|
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="previous_page">
|
||||||
<div class="{% if rtl %}right{% else %}left{% endif %}">
|
<div class="{% if rtl %}right{% else %}left{% endif %}">
|
||||||
<input type="hidden" name="q" value="{{ q|e }}" >
|
<input type="hidden" name="q" value="{{ q|e }}" >
|
||||||
{{- engine_data_form(engine_data) -}}
|
{{- engine_data_form(engine_data) -}}
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}">
|
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="next_page">
|
||||||
<div class="{% if rtl %}left{% else %}right{% endif %}">
|
<div class="{% if rtl %}left{% else %}right{% endif %}">
|
||||||
<input type="hidden" name="q" value="{{ q|e }}" >
|
<input type="hidden" name="q" value="{{ q|e }}" >
|
||||||
{{- engine_data_form(engine_data) -}}
|
{{- engine_data_form(engine_data) -}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue