mirror of
https://github.com/searxng/searxng
synced 2024-11-01 15:40:29 +00:00
[enh] new plugin: search on category select (currently only in oscar theme)
TODO purge mootools from default/courgette and integrate jquery ++ this theme
This commit is contained in:
parent
dd84814b68
commit
973c97c85b
@ -1,4 +1,5 @@
|
|||||||
from searx.plugins import self_ip
|
from searx.plugins import (self_ip,
|
||||||
|
search_on_category_select)
|
||||||
from searx import logger
|
from searx import logger
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
||||||
@ -52,3 +53,4 @@ class PluginStore():
|
|||||||
|
|
||||||
plugins = PluginStore()
|
plugins = PluginStore()
|
||||||
plugins.register(self_ip)
|
plugins.register(self_ip)
|
||||||
|
plugins.register(search_on_category_select)
|
||||||
|
6
searx/plugins/search_on_category_select.py
Normal file
6
searx/plugins/search_on_category_select.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from flask.ext.babel import gettext
|
||||||
|
name = 'Search on category select'
|
||||||
|
description = gettext('Perform search immediately if a category selected')
|
||||||
|
default_on = False
|
||||||
|
|
||||||
|
js_dependencies = ('js/search_on_category_select.js',)
|
14
searx/static/js/search_on_category_select.js
Normal file
14
searx/static/js/search_on_category_select.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
if($('#q')) {
|
||||||
|
$('#categories label').click(function(e) {
|
||||||
|
$('#categories input[type="checkbox"]').each(function(i, checkbox) {
|
||||||
|
$(checkbox).prop('checked', false);
|
||||||
|
});
|
||||||
|
$('#categories label').removeClass('btn-primary').removeClass('active').addClass('btn-default');
|
||||||
|
$(this).removeClass('btn-default').addClass('btn-primary').addClass('active');
|
||||||
|
$($(this).children()[0]).prop('checked', 'checked');
|
||||||
|
$('#search_form').submit();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user