mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[fix] remove js_dependencies & css_dependencies
Previously plugins could declare js_dependencies and css_dependencies which in theory would then be embedded in the page by themes. Practically this does not make sense when you have multiple themes since the JS & CSS needs to be written with a specific theme in mind in order to support it. Which is also why js_dependencies and css_dependencies was actually only used by the Oscar theme and ignored by the Simple theme because the Simple theme doesn't bundle jQuery and has a slightly different page markup. This commit removes this broken feature and also moves the *.js files in searx/static/plugins/js/ to searx/static/themes/oscar/src/js/plugins (where they actually belong). The oscar-specific CSS is now simply injected via the oscar-specific JS. Fixes #769.
This commit is contained in:
parent
96a1f79c6d
commit
132917ff42
17 changed files with 78 additions and 105 deletions
|
|
@ -1,19 +0,0 @@
|
|||
@keyframes rotate-forever {
|
||||
0% { transform: rotate(0deg) }
|
||||
100% { transform: rotate(360deg) }
|
||||
}
|
||||
.loading-spinner {
|
||||
animation-duration: 0.75s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-name: rotate-forever;
|
||||
animation-timing-function: linear;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
border: 8px solid #666;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50% !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#pagination button {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
.vim-hotkeys-help {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 9999999;
|
||||
overflow-y: auto;
|
||||
max-height: 80%;
|
||||
box-shadow: 0 0 1em;
|
||||
}
|
||||
|
||||
.dflex {
|
||||
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
||||
display: -ms-flexbox; /* TWEENER - IE 10 */
|
||||
display: -webkit-flex; /* NEW - Chrome */
|
||||
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
|
||||
}
|
||||
|
||||
.iflex {
|
||||
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
-moz-box-flex: 1; /* OLD - Firefox 19- */
|
||||
-webkit-flex: 1; /* Chrome */
|
||||
-ms-flex: 1; /* IE 10 */
|
||||
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ module.exports = function(grunt) {
|
|||
separator: ';'
|
||||
},
|
||||
dist: {
|
||||
src: ['src/js/*.js', '../__common__/js/image_layout.js'],
|
||||
src: ['src/js/*.js', '../__common__/js/image_layout.js', 'src/js/plugins/*.js'],
|
||||
dest: 'js/searxng.js'
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ window.searxng = (function(d) {
|
|||
return {
|
||||
autocompleter: script.getAttribute('data-autocompleter') === 'true',
|
||||
method: script.getAttribute('data-method'),
|
||||
translations: JSON.parse(script.getAttribute('data-translations'))
|
||||
translations: JSON.parse(script.getAttribute('data-translations')),
|
||||
plugins: JSON.parse(script.getAttribute('data-plugins'))
|
||||
};
|
||||
})(document);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
if (searxng.plugins['searx.plugins.infinite_scroll']) {
|
||||
function hasScrollbar() {
|
||||
var root = document.compatMode=='BackCompat'? document.body : document.documentElement;
|
||||
return root.scrollHeight>root.clientHeight;
|
||||
|
|
@ -38,3 +39,28 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
@keyframes rotate-forever {
|
||||
0% { transform: rotate(0deg) }
|
||||
100% { transform: rotate(360deg) }
|
||||
}
|
||||
.loading-spinner {
|
||||
animation-duration: 0.75s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-name: rotate-forever;
|
||||
animation-timing-function: linear;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
border: 8px solid #666;
|
||||
border-right-color: transparent;
|
||||
border-radius: 50% !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#pagination button {
|
||||
visibility: hidden;
|
||||
}
|
||||
`;
|
||||
document.head.append(style);
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
if (searxng.plugins['searx.plugins.search_on_category_select']) {
|
||||
$(document).ready(function() {
|
||||
if($('#q').length) {
|
||||
$('#categories label').click(function(e) {
|
||||
|
|
@ -40,3 +41,4 @@ function getHttpRequest() {
|
|||
}
|
||||
return httpRequest;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
if (searxng.plugins['searx.plugins.vim_hotkeys']) {
|
||||
$(document).ready(function() {
|
||||
highlightResult('top')();
|
||||
|
||||
|
|
@ -343,3 +344,35 @@ $(document).ready(function() {
|
|||
$('body').append(html);
|
||||
}
|
||||
});
|
||||
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.vim-hotkeys-help {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 9999999;
|
||||
overflow-y: auto;
|
||||
max-height: 80%;
|
||||
box-shadow: 0 0 1em;
|
||||
}
|
||||
|
||||
.dflex {
|
||||
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
|
||||
display: -ms-flexbox; /* TWEENER - IE 10 */
|
||||
display: -webkit-flex; /* NEW - Chrome */
|
||||
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
|
||||
}
|
||||
|
||||
.iflex {
|
||||
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
|
||||
-moz-box-flex: 1; /* OLD - Firefox 19- */
|
||||
-webkit-flex: 1; /* Chrome */
|
||||
-ms-flex: 1; /* IE 10 */
|
||||
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
|
||||
}
|
||||
`;
|
||||
document.head.append(style);
|
||||
}
|
||||
|
|
@ -14,14 +14,16 @@
|
|||
return scripts[scripts.length - 1];
|
||||
})();
|
||||
|
||||
const enabledPluginIds = JSON.parse(script.getAttribute('data-plugins'));
|
||||
|
||||
// try to detect touch screen
|
||||
w.searxng = {
|
||||
touch: (("ontouchstart" in w) || w.DocumentTouch && document instanceof DocumentTouch) || false,
|
||||
method: script.getAttribute('data-method'),
|
||||
autocompleter: script.getAttribute('data-autocompleter') === 'true',
|
||||
search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true',
|
||||
infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true',
|
||||
hotkeys: script.getAttribute('data-hotkeys') === 'true',
|
||||
search_on_category_select: enabledPluginIds['searx.plugins.search_on_category_select'] == true,
|
||||
infinite_scroll: enabledPluginIds['searx.plugins.infinite_scroll'] == true,
|
||||
hotkeys: enabledPluginIds['searx.plugins.vim_hotkeys'] == true,
|
||||
static_path: script.getAttribute('data-static-path'),
|
||||
translations: JSON.parse(script.getAttribute('data-translations')),
|
||||
theme: {
|
||||
|
|
@ -37,4 +39,4 @@
|
|||
if (w.searxng.touch) {
|
||||
hmtlElement.classList.add('touch');
|
||||
}
|
||||
})(window, document);
|
||||
})(window, document);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue