diff --git a/.travis.yml b/.travis.yml index 5cc51e84b..751a0ca68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ before_install: - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - npm install -g less grunt-cli - - ( cd searx/static/oscar;npm install ) + - ( cd searx/static/themes/oscar;npm install ) install: - "make" - pip install coveralls diff --git a/AUTHORS.rst b/AUTHORS.rst index ef1ae7809..6af81acab 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -29,3 +29,6 @@ generally made searx better: - @kernc - @Cqoicebordel - @Reventl0v +- Caner Başaran +- Benjamin Sonntag +- @opi diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 000000000..e411fc4a0 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,27 @@ +0.6.0 - 2014.12.25 +================== + +- Changelog added +- New engines + + - Flickr (api) + - Subtitleseeker + - photon + - 500px + - Searchcode + - Searchcode doc + - Kickass torrent +- Precise search request timeout handling +- Better favicon support +- Stricter config parsing +- Translation updates +- Multiple ui fixes +- Flickr (noapi) engine fix +- Pep8 fixes + + +News +~~~~ + +Health status of searx instances and engines: http://stats.searx.oe5tpo.com +(source: https://github.com/pointhi/searx_stats) diff --git a/Makefile b/Makefile index f9882e5ac..5d4ccd148 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,6 @@ $(python): virtualenv -p python$(version) --no-site-packages . @touch $@ -tests: .installed.cfg - @bin/test - @grunt test --gruntfile searx/static/oscar/gruntfile.js - robot: .installed.cfg @bin/robot @@ -29,6 +25,10 @@ flake8: .installed.cfg @bin/flake8 setup.py @bin/flake8 ./searx/ +tests: .installed.cfg flake8 + @bin/test + @grunt test --gruntfile searx/static/themes/oscar/gruntfile.js + coverage: .installed.cfg @bin/coverage run bin/test @bin/coverage report @@ -45,18 +45,18 @@ minimal: bin/buildout minimal.cfg setup.py bin/buildout -c minimal.cfg $(options) styles: - @lessc -x searx/static/default/less/style.less > searx/static/default/css/style.css - @lessc -x searx/static/oscar/less/bootstrap/bootstrap.less > searx/static/oscar/css/bootstrap.min.css - @lessc -x searx/static/oscar/less/oscar/oscar.less > searx/static/oscar/css/oscar.min.css + @lessc -x searx/static/themes/default/less/style.less > searx/static/themes/default/css/style.css + @lessc -x searx/static/themes/oscar/less/bootstrap/bootstrap.less > searx/static/themes/oscar/css/bootstrap.min.css + @lessc -x searx/static/themes/oscar/less/oscar/oscar.less > searx/static/themes/oscar/css/oscar.min.css grunt: - @grunt --gruntfile searx/static/oscar/gruntfile.js + @grunt --gruntfile searx/static/themes/oscar/gruntfile.js locales: @pybabel compile -d searx/translations clean: @rm -rf .installed.cfg .mr.developer.cfg bin parts develop-eggs \ - searx.egg-info lib include .coverage coverage searx/static/default/css/*.css + searx.egg-info lib include .coverage coverage searx/static/themes/default/css/*.css .PHONY: all tests robot flake8 coverage production minimal styles locales clean diff --git a/README.rst b/README.rst index bd6896aa1..669741ef3 100644 --- a/README.rst +++ b/README.rst @@ -14,16 +14,17 @@ See the `wiki `__ for more information. Features ~~~~~~~~ -- Tracking free -- Supports multiple output formats - - json ``curl https://searx.me/?format=json&q=[query]`` - - csv ``curl https://searx.me/?format=csv&q=[query]`` - - opensearch/rss ``curl https://searx.me/?format=rss&q=[query]`` -- Opensearch support (you can set as default search engine) -- Configurable search engines/categories -- Different search languages -- Duckduckgo like !bang functionality with engine shortcuts -- Parallel queries - relatively fast +- Tracking free +- Supports multiple output formats + + - json ``curl https://searx.me/?format=json&q=[query]`` + - csv ``curl https://searx.me/?format=csv&q=[query]`` + - opensearch/rss ``curl https://searx.me/?format=rss&q=[query]`` +- Opensearch support (you can set as default search engine) +- Configurable search engines/categories +- Different search languages +- Duckduckgo like !bang functionality with engine shortcuts +- Parallel queries - relatively fast Installation ~~~~~~~~~~~~ @@ -131,14 +132,11 @@ next time you run any other ``make`` command it will rebuild everithing. TODO ~~~~ -- Moar engines -- Better ui -- Browser integration -- Documentation -- Fix ``flake8`` errors, ``make flake8`` will be merged into - ``make tests`` when it does not fail anymore -- Tests -- When we have more tests, we can integrate Travis-CI +- Moar engines +- Better ui +- Browser integration +- Documentation +- Tests Bugs ~~~~ diff --git a/searx/__init__.py b/searx/__init__.py index 46685817a..110f46af8 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -15,9 +15,9 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. (C) 2013- by Adam Tauber, ''' +import logging from os import environ from os.path import realpath, dirname, join, abspath -from searx.https_rewrite import load_https_rules try: from yaml import load except: @@ -45,7 +45,17 @@ else: with open(settings_path) as settings_yaml: settings = load(settings_yaml) +if settings.get('server', {}).get('debug'): + logging.basicConfig(level=logging.DEBUG) +else: + logging.basicConfig(level=logging.WARNING) + +logger = logging.getLogger('searx') + # load https rules only if https rewrite is enabled if settings.get('server', {}).get('https_rewrite'): # loade https rules + from searx.https_rewrite import load_https_rules load_https_rules(https_rewrite_path) + +logger.info('Initialisation done') diff --git a/searx/engines/500px.py b/searx/engines/500px.py index 5d53af32c..3b95619a1 100644 --- a/searx/engines/500px.py +++ b/searx/engines/500px.py @@ -35,9 +35,9 @@ def request(query, params): # get response from search-request def response(resp): results = [] - + dom = html.fromstring(resp.text) - + # parse results for result in dom.xpath('//div[@class="photo"]'): link = result.xpath('.//a')[0] diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index d42339af8..643b107a5 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -22,6 +22,10 @@ from imp import load_source from flask.ext.babel import gettext from operator import itemgetter from searx import settings +from searx import logger + + +logger = logger.getChild('engines') engine_dir = dirname(realpath(__file__)) @@ -81,7 +85,7 @@ def load_engine(engine_data): if engine_attr.startswith('_'): continue if getattr(engine, engine_attr) is None: - print('[E] Engine config error: Missing attribute "{0}.{1}"'\ + logger.error('Missing engine config attribute: "{0}.{1}"' .format(engine.name, engine_attr)) sys.exit(1) @@ -100,9 +104,8 @@ def load_engine(engine_data): categories['general'].append(engine) if engine.shortcut: - # TODO check duplications if engine.shortcut in engine_shortcuts: - print('[E] Engine config error: ambigious shortcut: {0}'\ + logger.error('Engine config error: ambigious shortcut: {0}' .format(engine.shortcut)) sys.exit(1) engine_shortcuts[engine.shortcut] = engine.name @@ -199,7 +202,7 @@ def get_engines_stats(): if 'engines' not in settings or not settings['engines']: - print '[E] Error no engines found. Edit your settings.yml' + logger.error('No engines found. Edit your settings.yml') exit(2) for engine_data in settings['engines']: diff --git a/searx/engines/dailymotion.py b/searx/engines/dailymotion.py index a5bffa866..03b1dbb8b 100644 --- a/searx/engines/dailymotion.py +++ b/searx/engines/dailymotion.py @@ -6,12 +6,14 @@ # @using-api yes # @results JSON # @stable yes -# @parse url, title, thumbnail +# @parse url, title, thumbnail, publishedDate, embedded # # @todo set content-parameter with correct data from urllib import urlencode from json import loads +from cgi import escape +from datetime import datetime # engine dependent config categories = ['videos'] @@ -20,7 +22,9 @@ language_support = True # search-url # see http://www.dailymotion.com/doc/api/obj-video.html -search_url = 'https://api.dailymotion.com/videos?fields=title,description,duration,url,thumbnail_360_url&sort=relevance&limit=5&page={pageno}&{query}' # noqa +search_url = 'https://api.dailymotion.com/videos?fields=created_time,title,description,duration,url,thumbnail_360_url,id&sort=relevance&limit=5&page={pageno}&{query}' # noqa +embedded_url = '' # do search-request @@ -51,14 +55,17 @@ def response(resp): for res in search_res['list']: title = res['title'] url = res['url'] - #content = res['description'] - content = '' + content = escape(res['description']) thumbnail = res['thumbnail_360_url'] + publishedDate = datetime.fromtimestamp(res['created_time'], None) + embedded = embedded_url.format(videoid=res['id']) results.append({'template': 'videos.html', 'url': url, 'title': title, 'content': content, + 'publishedDate': publishedDate, + 'embedded': embedded, 'thumbnail': thumbnail}) # return results diff --git a/searx/engines/deezer.py b/searx/engines/deezer.py new file mode 100644 index 000000000..433ceffa1 --- /dev/null +++ b/searx/engines/deezer.py @@ -0,0 +1,61 @@ +## Deezer (Music) +# +# @website https://deezer.com +# @provide-api yes (http://developers.deezer.com/api/) +# +# @using-api yes +# @results JSON +# @stable yes +# @parse url, title, content, embedded + +from json import loads +from urllib import urlencode + +# engine dependent config +categories = ['music'] +paging = True + +# search-url +url = 'http://api.deezer.com/' +search_url = url + 'search?{query}&index={offset}' + +embedded_url = '' + + +# do search-request +def request(query, params): + offset = (params['pageno'] - 1) * 25 + + params['url'] = search_url.format(query=urlencode({'q': query}), + offset=offset) + + return params + + +# get response from search-request +def response(resp): + results = [] + + search_res = loads(resp.text) + + # parse results + for result in search_res.get('data', []): + if result['type'] == 'track': + title = result['title'] + url = result['link'] + content = result['artist']['name'] +\ + " • " +\ + result['album']['title'] +\ + " • " + result['title'] + embedded = embedded_url.format(audioid=result['id']) + + # append result + results.append({'url': url, + 'title': title, + 'embedded': embedded, + 'content': content}) + + # return results + return results diff --git a/searx/engines/digg.py b/searx/engines/digg.py new file mode 100644 index 000000000..8c457d6b9 --- /dev/null +++ b/searx/engines/digg.py @@ -0,0 +1,70 @@ +## Digg (News, Social media) +# +# @website https://digg.com/ +# @provide-api no +# +# @using-api no +# @results HTML (using search portal) +# @stable no (HTML can change) +# @parse url, title, content, publishedDate, thumbnail + +from urllib import quote_plus +from json import loads +from lxml import html +from cgi import escape +from dateutil import parser + +# engine dependent config +categories = ['news', 'social media'] +paging = True + +# search-url +base_url = 'https://digg.com/' +search_url = base_url+'api/search/{query}.json?position={position}&format=html' + +# specific xpath variables +results_xpath = '//article' +link_xpath = './/small[@class="time"]//a' +title_xpath = './/h2//a//text()' +content_xpath = './/p//text()' +pubdate_xpath = './/time' + + +# do search-request +def request(query, params): + offset = (params['pageno'] - 1) * 10 + params['url'] = search_url.format(position=offset, + query=quote_plus(query)) + return params + + +# get response from search-request +def response(resp): + results = [] + + search_result = loads(resp.text) + + if search_result['html'] == '': + return results + + dom = html.fromstring(search_result['html']) + + # parse results + for result in dom.xpath(results_xpath): + url = result.attrib.get('data-contenturl') + thumbnail = result.xpath('.//img')[0].attrib.get('src') + title = ''.join(result.xpath(title_xpath)) + content = escape(''.join(result.xpath(content_xpath))) + pubdate = result.xpath(pubdate_xpath)[0].attrib.get('datetime') + publishedDate = parser.parse(pubdate) + + # append result + results.append({'url': url, + 'title': title, + 'content': content, + 'template': 'videos.html', + 'publishedDate': publishedDate, + 'thumbnail': thumbnail}) + + # return results + return results diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index 8f81d2c8e..b66d6c0f2 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -1,6 +1,7 @@ import json from urllib import urlencode from lxml import html +from searx.utils import html_to_text from searx.engines.xpath import extract_text url = 'https://api.duckduckgo.com/'\ @@ -17,11 +18,6 @@ def result_to_text(url, text, htmlResult): return text -def html_to_text(htmlFragment): - dom = html.fromstring(htmlFragment) - return extract_text(dom) - - def request(query, params): # TODO add kl={locale} params['url'] = url.format(query=urlencode({'q': query})) diff --git a/searx/engines/flickr-noapi.py b/searx/engines/flickr-noapi.py new file mode 100644 index 000000000..aa2fa5d3b --- /dev/null +++ b/searx/engines/flickr-noapi.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python + +# Flickr (Images) +# +# @website https://www.flickr.com +# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html) +# +# @using-api no +# @results HTML +# @stable no +# @parse url, title, thumbnail, img_src + +from urllib import urlencode +from json import loads +import re + +categories = ['images'] + +url = 'https://secure.flickr.com/' +search_url = url+'search/?{query}&page={page}' +photo_url = 'https://www.flickr.com/photos/{userid}/{photoid}' +regex = re.compile(r"\"search-photos-models\",\"photos\":(.*}),\"totalItems\":", re.DOTALL) +image_sizes = ('o', 'k', 'h', 'b', 'c', 'z', 'n', 'm', 't', 'q', 's') + +paging = True + + +def build_flickr_url(user_id, photo_id): + return photo_url.format(userid=user_id, photoid=photo_id) + + +def request(query, params): + params['url'] = search_url.format(query=urlencode({'text': query}), + page=params['pageno']) + return params + + +def response(resp): + results = [] + + matches = regex.search(resp.text) + + if matches is None: + return results + + match = matches.group(1) + search_results = loads(match) + + if '_data' not in search_results: + return [] + + photos = search_results['_data'] + + for photo in photos: + + # In paged configuration, the first pages' photos + # are represented by a None object + if photo is None: + continue + + img_src = None + # From the biggest to the lowest format + for image_size in image_sizes: + if image_size in photo['sizes']: + img_src = photo['sizes'][image_size]['displayUrl'] + break + + if not img_src: + continue + + if 'id' not in photo['owner']: + continue + + url = build_flickr_url(photo['owner']['id'], photo['id']) + + title = photo['title'] + + content = '' +\ + photo['owner']['username'] +\ + '
' + + if 'description' in photo: + content = content +\ + '' +\ + photo['description'] +\ + '' + + # append result + results.append({'url': url, + 'title': title, + 'img_src': img_src, + 'content': content, + 'template': 'images.html'}) + + return results diff --git a/searx/engines/flickr.py b/searx/engines/flickr.py index 4ec2841dd..4dadd80a6 100644 --- a/searx/engines/flickr.py +++ b/searx/engines/flickr.py @@ -1,54 +1,87 @@ #!/usr/bin/env python +## Flickr (Images) +# +# @website https://www.flickr.com +# @provide-api yes (https://secure.flickr.com/services/api/flickr.photos.search.html) +# +# @using-api yes +# @results JSON +# @stable yes +# @parse url, title, thumbnail, img_src +#More info on api-key : https://www.flickr.com/services/apps/create/ + from urllib import urlencode -#from json import loads -from urlparse import urljoin -from lxml import html -from time import time +from json import loads categories = ['images'] -url = 'https://secure.flickr.com/' -search_url = url+'search/?{query}&page={page}' -results_xpath = '//div[@class="view display-item-tile"]/figure/div' +nb_per_page = 15 +paging = True +api_key = None + + +url = 'https://api.flickr.com/services/rest/?method=flickr.photos.search' +\ + '&api_key={api_key}&{text}&sort=relevance' +\ + '&extras=description%2C+owner_name%2C+url_o%2C+url_z' +\ + '&per_page={nb_per_page}&format=json&nojsoncallback=1&page={page}' +photo_url = 'https://www.flickr.com/photos/{userid}/{photoid}' paging = True +def build_flickr_url(user_id, photo_id): + return photo_url.format(userid=user_id, photoid=photo_id) + + def request(query, params): - params['url'] = search_url.format(query=urlencode({'text': query}), - page=params['pageno']) - time_string = str(int(time())-3) - params['cookies']['BX'] = '3oqjr6d9nmpgl&b=3&s=dh' - params['cookies']['xb'] = '421409' - params['cookies']['localization'] = 'en-us' - params['cookies']['flrbp'] = time_string +\ - '-3a8cdb85a427a33efda421fbda347b2eaf765a54' - params['cookies']['flrbs'] = time_string +\ - '-ed142ae8765ee62c9ec92a9513665e0ee1ba6776' - params['cookies']['flrb'] = '9' + params['url'] = url.format(text=urlencode({'text': query}), + api_key=api_key, + nb_per_page=nb_per_page, + page=params['pageno']) return params def response(resp): results = [] - dom = html.fromstring(resp.text) - for result in dom.xpath(results_xpath): - img = result.xpath('.//img') - if not img: + search_results = loads(resp.text) + + # return empty array if there are no results + if not 'photos' in search_results: + return [] + + if not 'photo' in search_results['photos']: + return [] + + photos = search_results['photos']['photo'] + + # parse results + for photo in photos: + if 'url_o' in photo: + img_src = photo['url_o'] + elif 'url_z' in photo: + img_src = photo['url_z'] + else: continue - img = img[0] - img_src = 'https:'+img.attrib.get('src') + url = build_flickr_url(photo['owner'], photo['id']) - if not img_src: - continue + title = photo['title'] - href = urljoin(url, result.xpath('.//a')[0].attrib.get('href')) - title = img.attrib.get('alt', '') - results.append({'url': href, + content = '' +\ + photo['ownername'] +\ + '
' +\ + '' +\ + photo['description']['_content'] +\ + '' + + # append result + results.append({'url': url, 'title': title, 'img_src': img_src, + 'content': content, 'template': 'images.html'}) + + # return results return results diff --git a/searx/engines/kickass.py b/searx/engines/kickass.py index f1fcd9e1a..16e9d6de6 100644 --- a/searx/engines/kickass.py +++ b/searx/engines/kickass.py @@ -24,7 +24,7 @@ search_url = url + 'search/{search_term}/{pageno}/' # specific xpath variables magnet_xpath = './/a[@title="Torrent magnet link"]' -#content_xpath = './/font[@class="detDesc"]//text()' +content_xpath = './/span[@class="font11px lightgrey block"]' # do search-request @@ -56,7 +56,8 @@ def response(resp): link = result.xpath('.//a[@class="cellMainLink"]')[0] href = urljoin(url, link.attrib['href']) title = ' '.join(link.xpath('.//text()')) - content = escape(html.tostring(result.xpath('.//span[@class="font11px lightgrey block"]')[0], method="text")) + content = escape(html.tostring(result.xpath(content_xpath)[0], + method="text")) seed = result.xpath('.//td[contains(@class, "green")]/text()')[0] leech = result.xpath('.//td[contains(@class, "red")]/text()')[0] diff --git a/searx/engines/searchcode_doc.py b/searx/engines/searchcode_doc.py index 4d4d1ca5e..b5b7159be 100644 --- a/searx/engines/searchcode_doc.py +++ b/searx/engines/searchcode_doc.py @@ -38,10 +38,14 @@ def response(resp): for result in search_results['results']: href = result['url'] title = "[" + result['type'] + "] " +\ - result['namespace'] + " " + result['name'] - content = '[' + result['type'] + "] " +\ - result['name'] + " " + result['synopsis'] +\ - "
" + result['description'] + result['namespace'] +\ + " " + result['name'] + content = '[' +\ + result['type'] + "] " +\ + result['name'] + " " +\ + result['synopsis'] +\ + "
" +\ + result['description'] # append result results.append({'url': href, diff --git a/searx/engines/soundcloud.py b/searx/engines/soundcloud.py index 164a569a3..44374af6f 100644 --- a/searx/engines/soundcloud.py +++ b/searx/engines/soundcloud.py @@ -6,10 +6,11 @@ # @using-api yes # @results JSON # @stable yes -# @parse url, title, content +# @parse url, title, content, publishedDate, embedded from json import loads -from urllib import urlencode +from urllib import urlencode, quote_plus +from dateutil import parser # engine dependent config categories = ['music'] @@ -27,6 +28,10 @@ search_url = url + 'search?{query}'\ '&linked_partitioning=1'\ '&client_id={client_id}' # noqa +embedded_url = '' + # do search-request def request(query, params): @@ -50,10 +55,15 @@ def response(resp): if result['kind'] in ('track', 'playlist'): title = result['title'] content = result['description'] + publishedDate = parser.parse(result['last_modified']) + uri = quote_plus(result['uri']) + embedded = embedded_url.format(uri=uri) # append result results.append({'url': result['permalink_url'], 'title': title, + 'publishedDate': publishedDate, + 'embedded': embedded, 'content': content}) # return results diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py index 16da728cd..70b193952 100644 --- a/searx/engines/startpage.py +++ b/searx/engines/startpage.py @@ -66,7 +66,10 @@ def response(resp): continue link = links[0] url = link.attrib.get('href') - title = escape(link.text_content()) + try: + title = escape(link.text_content()) + except UnicodeDecodeError: + continue # block google-ad url's if re.match("^http(s|)://www.google.[a-z]+/aclk.*$", url): diff --git a/searx/engines/subtitleseeker.py b/searx/engines/subtitleseeker.py new file mode 100644 index 000000000..9aaf1947b --- /dev/null +++ b/searx/engines/subtitleseeker.py @@ -0,0 +1,78 @@ +## Subtitleseeker (Video) +# +# @website http://www.subtitleseeker.com +# @provide-api no +# +# @using-api no +# @results HTML +# @stable no (HTML can change) +# @parse url, title, content + +from cgi import escape +from urllib import quote_plus +from lxml import html +from searx.languages import language_codes + +# engine dependent config +categories = ['videos'] +paging = True +language = "" + +# search-url +url = 'http://www.subtitleseeker.com/' +search_url = url+'search/TITLES/{query}&p={pageno}' + +# specific xpath variables +results_xpath = '//div[@class="boxRows"]' + + +# do search-request +def request(query, params): + params['url'] = search_url.format(query=quote_plus(query), + pageno=params['pageno']) + return params + + +# get response from search-request +def response(resp): + results = [] + + dom = html.fromstring(resp.text) + + search_lang = "" + + if resp.search_params['language'] != 'all': + search_lang = [lc[1] + for lc in language_codes + if lc[0][:2] == resp.search_params['language']][0] + + # parse results + for result in dom.xpath(results_xpath): + link = result.xpath(".//a")[0] + href = link.attrib.get('href') + + if language is not "": + href = href + language + '/' + elif search_lang: + href = href + search_lang + '/' + + title = escape(link.xpath(".//text()")[0]) + + content = result.xpath('.//div[contains(@class,"red")]//text()')[0] + content = content + " - " + text = result.xpath('.//div[contains(@class,"grey-web")]')[0] + content = content + html.tostring(text, method='text') + + if result.xpath(".//span") != []: + content = content +\ + " - (" +\ + result.xpath(".//span//text()")[0].strip() +\ + ")" + + # append result + results.append({'url': href, + 'title': title, + 'content': escape(content)}) + + # return results + return results diff --git a/searx/engines/twitter.py b/searx/engines/twitter.py index 0689150c8..bd9a8c2fc 100644 --- a/searx/engines/twitter.py +++ b/searx/engines/twitter.py @@ -1,6 +1,6 @@ ## Twitter (Social media) # -# @website https://www.bing.com/news +# @website https://twitter.com/ # @provide-api yes (https://dev.twitter.com/docs/using-search) # # @using-api no @@ -14,6 +14,7 @@ from urlparse import urljoin from urllib import urlencode from lxml import html from cgi import escape +from datetime import datetime # engine dependent config categories = ['social media'] @@ -27,7 +28,8 @@ search_url = base_url+'search?' results_xpath = '//li[@data-item-type="tweet"]' link_xpath = './/small[@class="time"]//a' title_xpath = './/span[@class="username js-action-profile-name"]//text()' -content_xpath = './/p[@class="js-tweet-text tweet-text"]//text()' +content_xpath = './/p[@class="js-tweet-text tweet-text"]' +timestamp_xpath = './/span[contains(@class,"_timestamp")]' # do search-request @@ -52,12 +54,21 @@ def response(resp): link = tweet.xpath(link_xpath)[0] url = urljoin(base_url, link.attrib.get('href')) title = ''.join(tweet.xpath(title_xpath)) - content = escape(''.join(tweet.xpath(content_xpath))) - - # append result - results.append({'url': url, - 'title': title, - 'content': content}) + content = escape(html.tostring(tweet.xpath(content_xpath)[0], method='text', encoding='UTF-8').decode("utf-8")) + pubdate = tweet.xpath(timestamp_xpath) + if len(pubdate) > 0: + timestamp = float(pubdate[0].attrib.get('data-time')) + publishedDate = datetime.fromtimestamp(timestamp, None) + # append result + results.append({'url': url, + 'title': title, + 'content': content, + 'publishedDate': publishedDate}) + else: + # append result + results.append({'url': url, + 'title': title, + 'content': content}) # return results return results diff --git a/searx/engines/vimeo.py b/searx/engines/vimeo.py index c66c4148a..39033c591 100644 --- a/searx/engines/vimeo.py +++ b/searx/engines/vimeo.py @@ -1,4 +1,4 @@ -## Vimeo (Videos) +# Vimeo (Videos) # # @website https://vimeo.com/ # @provide-api yes (http://developer.vimeo.com/api), @@ -7,14 +7,14 @@ # @using-api no (TODO, rewrite to api) # @results HTML (using search portal) # @stable no (HTML can change) -# @parse url, title, publishedDate, thumbnail +# @parse url, title, publishedDate, thumbnail, embedded # # @todo rewrite to api # @todo set content-parameter with correct data from urllib import urlencode -from HTMLParser import HTMLParser from lxml import html +from HTMLParser import HTMLParser from searx.engines.xpath import extract_text from dateutil import parser @@ -23,26 +23,26 @@ categories = ['videos'] paging = True # search-url -base_url = 'https://vimeo.com' +base_url = 'http://vimeo.com' search_url = base_url + '/search/page:{pageno}?{query}' # specific xpath variables -url_xpath = './a/@href' -content_xpath = './a/img/@src' -title_xpath = './a/div[@class="data"]/p[@class="title"]/text()' results_xpath = '//div[@id="browse_content"]/ol/li' +url_xpath = './a/@href' +title_xpath = './a/div[@class="data"]/p[@class="title"]' +content_xpath = './a/img/@src' publishedDate_xpath = './/p[@class="meta"]//attribute::datetime' +embedded_url = '' + # do search-request def request(query, params): params['url'] = search_url.format(pageno=params['pageno'], query=urlencode({'q': query})) - # TODO required? - params['cookies']['__utma'] =\ - '00000000.000#0000000.0000000000.0000000000.0000000000.0' - return params @@ -51,16 +51,17 @@ def response(resp): results = [] dom = html.fromstring(resp.text) - p = HTMLParser() # parse results for result in dom.xpath(results_xpath): - url = base_url + result.xpath(url_xpath)[0] + videoid = result.xpath(url_xpath)[0] + url = base_url + videoid title = p.unescape(extract_text(result.xpath(title_xpath))) thumbnail = extract_text(result.xpath(content_xpath)[0]) publishedDate = parser.parse(extract_text( result.xpath(publishedDate_xpath)[0])) + embedded = embedded_url.format(videoid=videoid) # append result results.append({'url': url, @@ -68,6 +69,7 @@ def response(resp): 'content': '', 'template': 'videos.html', 'publishedDate': publishedDate, + 'embedded': embedded, 'thumbnail': thumbnail}) # return results diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index ab799e6ce..df976ae35 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -1,6 +1,8 @@ import json from requests import get from urllib import urlencode +import locale +import dateutil.parser result_count = 1 wikidata_host = 'https://www.wikidata.org' @@ -35,6 +37,16 @@ def response(resp): language = resp.search_params['language'].split('_')[0] if language == 'all': language = 'en' + + try: + locale.setlocale(locale.LC_ALL, str(resp.search_params['language'])) + except: + try: + locale.setlocale(locale.LC_ALL, 'en_US') + except: + pass + pass + url = url_detail.format(query=urlencode({'ids': '|'.join(wikidata_ids), 'languages': language + '|en'})) @@ -164,10 +176,12 @@ def getDetail(jsonresponse, wikidata_id, language): date_of_birth = get_time(claims, 'P569', None) if date_of_birth is not None: + date_of_birth = dateutil.parser.parse(date_of_birth[8:]).strftime(locale.nl_langinfo(locale.D_FMT)) attributes.append({'label': 'Date of birth', 'value': date_of_birth}) date_of_death = get_time(claims, 'P570', None) if date_of_death is not None: + date_of_death = dateutil.parser.parse(date_of_death[8:]).strftime(locale.nl_langinfo(locale.D_FMT)) attributes.append({'label': 'Date of death', 'value': date_of_death}) if len(attributes) == 0 and len(urls) == 2 and len(description) == 0: diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py index 973e799f8..59f07c574 100644 --- a/searx/engines/youtube.py +++ b/searx/engines/youtube.py @@ -6,7 +6,7 @@ # @using-api yes # @results JSON # @stable yes -# @parse url, title, content, publishedDate, thumbnail +# @parse url, title, content, publishedDate, thumbnail, embedded from json import loads from urllib import urlencode @@ -19,7 +19,11 @@ language_support = True # search-url base_url = 'https://gdata.youtube.com/feeds/api/videos' -search_url = base_url + '?alt=json&{query}&start-index={index}&max-results=5' # noqa +search_url = base_url + '?alt=json&{query}&start-index={index}&max-results=5' + +embedded_url = '' # do search-request @@ -60,6 +64,8 @@ def response(resp): if url.endswith('&'): url = url[:-1] + videoid = url[32:] + title = result['title']['$t'] content = '' thumbnail = '' @@ -72,12 +78,15 @@ def response(resp): content = result['content']['$t'] + embedded = embedded_url.format(videoid=videoid) + # append result results.append({'url': url, 'title': title, 'content': content, 'template': 'videos.html', 'publishedDate': publishedDate, + 'embedded': embedded, 'thumbnail': thumbnail}) # return results diff --git a/searx/https_rewrite.py b/searx/https_rewrite.py index 408474a44..71aec1c9b 100644 --- a/searx/https_rewrite.py +++ b/searx/https_rewrite.py @@ -20,8 +20,11 @@ from urlparse import urlparse from lxml import etree from os import listdir from os.path import isfile, isdir, join +from searx import logger +logger = logger.getChild("https_rewrite") + # https://gitweb.torproject.org/\ # pde/https-everywhere.git/tree/4.0:/src/chrome/content/rules @@ -131,7 +134,7 @@ def load_single_https_ruleset(filepath): def load_https_rules(rules_path): # check if directory exists if not isdir(rules_path): - print("[E] directory not found: '" + rules_path + "'") + logger.error("directory not found: '" + rules_path + "'") return # search all xml files which are stored in the https rule directory @@ -151,8 +154,7 @@ def load_https_rules(rules_path): # append ruleset https_rules.append(ruleset) - print(' * {n} https-rules loaded'.format(n=len(https_rules))) - + logger.info('{n} rules loaded'.format(n=len(https_rules))) def https_url_rewrite(result): diff --git a/searx/search.py b/searx/search.py index d1d03805f..f58b6167c 100644 --- a/searx/search.py +++ b/searx/search.py @@ -29,21 +29,23 @@ from searx.engines import ( from searx.languages import language_codes from searx.utils import gen_useragent from searx.query import Query +from searx import logger +logger = logger.getChild('search') + number_of_searches = 0 def search_request_wrapper(fn, url, engine_name, **kwargs): try: return fn(url, **kwargs) - except Exception, e: + except: # increase errors stats engines[engine_name].stats['errors'] += 1 # print engine name and specific error message - print('[E] Error with engine "{0}":\n\t{1}'.format( - engine_name, str(e))) + logger.exception('engine crash: {0}'.format(engine_name)) return @@ -66,14 +68,19 @@ def threaded_requests(requests): remaining_time = max(0.0, timeout_limit - (time() - search_start)) th.join(remaining_time) if th.isAlive(): - print('engine timeout: {0}'.format(th._engine_name)) - + logger.warning('engine timeout: {0}'.format(th._engine_name)) # get default reqest parameter def default_request_params(): return { - 'method': 'GET', 'headers': {}, 'data': {}, 'url': '', 'cookies': {}, 'verify': True} + 'method': 'GET', + 'headers': {}, + 'data': {}, + 'url': '', + 'cookies': {}, + 'verify': True + } # create a callback wrapper for the search engine results @@ -487,14 +494,15 @@ class Search(object): continue # append request to list - requests.append((req, request_params['url'], request_args, selected_engine['name'])) + requests.append((req, request_params['url'], + request_args, + selected_engine['name'])) if not requests: return results, suggestions, answers, infoboxes # send all search-request threaded_requests(requests) - while not results_queue.empty(): engine_name, engine_results = results_queue.get_nowait() diff --git a/searx/settings.yml b/searx/settings.yml index 8cfe3f886..70c56fccd 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -35,6 +35,10 @@ engines: engine : currency_convert categories : general shortcut : cc + + - name : deezer + engine : deezer + shortcut : dz - name : deviantart engine : deviantart @@ -44,6 +48,10 @@ engines: - name : ddg definitions engine : duckduckgo_definitions shortcut : ddd + + - name : digg + engine : digg + shortcut : dg - name : wikidata engine : wikidata @@ -70,10 +78,14 @@ engines: shortcut : px - name : flickr - engine : flickr categories : images shortcut : fl - timeout: 3.0 +# You can use the engine using the official stable API, but you need an API key +# See : https://www.flickr.com/services/apps/create/ +# engine : flickr +# api_key: 'apikey' # required! +# Or you can use the html non-stable engine, activated by default + engine : flickr-noapi - name : general-file engine : generalfile @@ -95,6 +107,33 @@ engines: engine : google_news shortcut : gon + - name : google play apps + engine : xpath + search_url : https://play.google.com/store/search?q={query}&c=apps + url_xpath : //a[@class="title"]/@href + title_xpath : //a[@class="title"] + content_xpath : //a[@class="subtitle"] + categories : files + shortcut : gpa + + - name : google play movies + engine : xpath + search_url : https://play.google.com/store/search?q={query}&c=movies + url_xpath : //a[@class="title"]/@href + title_xpath : //a[@class="title"] + content_xpath : //a[@class="subtitle"] + categories : videos + shortcut : gpm + + - name : google play music + engine : xpath + search_url : https://play.google.com/store/search?q={query}&c=music + url_xpath : //a[@class="title"]/@href + title_xpath : //a[@class="title"] + content_xpath : //a[@class="subtitle"] + categories : music + shortcut : gps + - name : openstreetmap engine : openstreetmap shortcut : osm @@ -127,6 +166,13 @@ engines: engine : searchcode_code shortcut : scc + - name : subtitleseeker + engine : subtitleseeker + shortcut : ss +# The language is an option. You can put any language written in english +# Examples : English, French, German, Hungarian, Chinese... +# language : English + - name : startpage engine : startpage shortcut : sp @@ -194,3 +240,4 @@ locales: it : Italiano nl : Nederlands ja : 日本語 (Japanese) + tr : Türkçe diff --git a/searx/static/oscar/js/searx.min.js b/searx/static/oscar/js/searx.min.js deleted file mode 100644 index 0b3aa73f9..000000000 --- a/searx/static/oscar/js/searx.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! oscar/searx.min.js | 22-12-2014 | https://github.com/asciimoo/searx */ -requirejs.config({baseUrl:"./static/oscar/js",paths:{app:"../app"}}),searx.autocompleter&&(searx.searchResults=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:"/autocompleter?q=%QUERY"}),searx.searchResults.initialize()),$(document).ready(function(){searx.autocompleter&&$("#q").typeahead(null,{name:"search-results",displayKey:function(a){return a},source:searx.searchResults.ttAdapter()})}),$(document).ready(function(){$("#q.autofocus").focus(),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var a=$(this).data("btn-text-collapsed"),b=$(this).data("btn-text-not-collapsed");""!==a&&""!==b&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(a,b):$(this).html().replace(b,a),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var a="btn-"+$(this).data("btn-class"),b=$(this).data("btn-label-default"),c=$(this).data("btn-label-toggled");""!==c&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(b,c):$(this).html().replace(c,b),$(this).html(new_html)),$(this).toggleClass(a),$(this).toggleClass("btn-default")}),$(".btn-sm").dblclick(function(){var a="btn-"+$(this).data("btn-class");$(this).hasClass("btn-default")?($(".btn-sm > input").attr("checked","checked"),$(".btn-sm > input").prop("checked",!0),$(".btn-sm").addClass(a),$(".btn-sm").addClass("active"),$(".btn-sm").removeClass("btn-default")):($(".btn-sm > input").attr("checked",""),$(".btn-sm > input").removeAttr("checked"),$(".btn-sm > input").checked=!1,$(".btn-sm").removeClass(a),$(".btn-sm").removeClass("active"),$(".btn-sm").addClass("btn-default"))})}),$(document).ready(function(){$(".searx_overpass_request").on("click",function(a){var b="https://overpass-api.de/api/interpreter?data=",c=b+"[out:json][timeout:25];(",d=");out meta;",e=$(this).data("osm-id"),f=$(this).data("osm-type"),g=$(this).data("result-table"),h="#"+$(this).data("result-table-loadicon"),i=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(e&&f&&g){g="#"+g;var j=null;switch(f){case"node":j=c+"node("+e+");"+d;break;case"way":j=c+"way("+e+");"+d;break;case"relation":j=c+"relation("+e+");"+d}if(j){$.ajax(j).done(function(a){if(a&&a.elements&&a.elements[0]){var b=a.elements[0],c=$(g).html();for(var d in b.tags)if(null===b.tags.name||-1==i.indexOf(d)){switch(c+=""+d+"",d){case"phone":case"fax":c+=''+b.tags[d]+"";break;case"email":c+=''+b.tags[d]+"";break;case"website":case"url":c+=''+b.tags[d]+"";break;case"wikidata":c+=''+b.tags[d]+"";break;case"wikipedia":if(-1!=b.tags[d].indexOf(":")){c+=''+b.tags[d]+"";break}default:c+=b.tags[d]}c+=""}$(g).html(c),$(g).removeClass("hidden"),$(h).addClass("hidden")}}).fail(function(){$(h).html($(h).html()+'

could not load data!

')})}}$(this).off(a)}),$(".searx_init_map").on("click",function(a){var b=$(this).data("leaflet-target"),c=$(this).data("map-lon"),d=$(this).data("map-lat"),e=$(this).data("map-zoom"),f=$(this).data("map-boundingbox"),g=$(this).data("map-geojson");require(["leaflet-0.7.3.min"],function(){f&&(southWest=L.latLng(f[0],f[2]),northEast=L.latLng(f[1],f[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="./static/oscar/img/map";{var a=L.map(b),h="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",i='Map data © OpenStreetMap contributors',j=new L.TileLayer(h,{minZoom:1,maxZoom:19,attribution:i}),k="http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg",l='Map data © OpenStreetMap contributors | Tiles Courtesy of MapQuest ',m=new L.TileLayer(k,{minZoom:1,maxZoom:18,subdomains:"1234",attribution:l}),n="http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg",o='Map data © OpenStreetMap contributors | Tiles Courtesy of MapQuest | Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency';new L.TileLayer(n,{minZoom:1,maxZoom:11,subdomains:"1234",attribution:o})}map_bounds?setTimeout(function(){a.fitBounds(map_bounds,{maxZoom:17})},0):c&&d&&(e?a.setView(new L.LatLng(d,c),e):a.setView(new L.LatLng(d,c),8)),a.addLayer(m);var p={"OSM Mapnik":j,MapQuest:m};L.control.layers(p).addTo(a),g&&L.geoJson(g).addTo(a)}),$(this).off(a)})}); \ No newline at end of file diff --git a/searx/static/courgette/css/style.css b/searx/static/themes/courgette/css/style.css similarity index 100% rename from searx/static/courgette/css/style.css rename to searx/static/themes/courgette/css/style.css diff --git a/searx/static/courgette/img/bg-body-index.jpg b/searx/static/themes/courgette/img/bg-body-index.jpg similarity index 100% rename from searx/static/courgette/img/bg-body-index.jpg rename to searx/static/themes/courgette/img/bg-body-index.jpg diff --git a/searx/static/courgette/img/favicon.png b/searx/static/themes/courgette/img/favicon.png similarity index 100% rename from searx/static/courgette/img/favicon.png rename to searx/static/themes/courgette/img/favicon.png diff --git a/searx/static/courgette/img/github_ribbon.png b/searx/static/themes/courgette/img/github_ribbon.png similarity index 100% rename from searx/static/courgette/img/github_ribbon.png rename to searx/static/themes/courgette/img/github_ribbon.png diff --git a/searx/static/courgette/img/icon_dailymotion.ico b/searx/static/themes/courgette/img/icons/icon_dailymotion.ico similarity index 100% rename from searx/static/courgette/img/icon_dailymotion.ico rename to searx/static/themes/courgette/img/icons/icon_dailymotion.ico diff --git a/searx/static/courgette/img/icon_deviantart.ico b/searx/static/themes/courgette/img/icons/icon_deviantart.ico similarity index 100% rename from searx/static/courgette/img/icon_deviantart.ico rename to searx/static/themes/courgette/img/icons/icon_deviantart.ico diff --git a/searx/static/courgette/img/icon_github.ico b/searx/static/themes/courgette/img/icons/icon_github.ico similarity index 100% rename from searx/static/courgette/img/icon_github.ico rename to searx/static/themes/courgette/img/icons/icon_github.ico diff --git a/searx/static/courgette/img/icon_kickass.ico b/searx/static/themes/courgette/img/icons/icon_kickass.ico similarity index 100% rename from searx/static/courgette/img/icon_kickass.ico rename to searx/static/themes/courgette/img/icons/icon_kickass.ico diff --git a/searx/static/courgette/img/icon_soundcloud.ico b/searx/static/themes/courgette/img/icons/icon_soundcloud.ico similarity index 100% rename from searx/static/courgette/img/icon_soundcloud.ico rename to searx/static/themes/courgette/img/icons/icon_soundcloud.ico diff --git a/searx/static/courgette/img/icon_stackoverflow.ico b/searx/static/themes/courgette/img/icons/icon_stackoverflow.ico similarity index 100% rename from searx/static/courgette/img/icon_stackoverflow.ico rename to searx/static/themes/courgette/img/icons/icon_stackoverflow.ico diff --git a/searx/static/courgette/img/icon_twitter.ico b/searx/static/themes/courgette/img/icons/icon_twitter.ico similarity index 100% rename from searx/static/courgette/img/icon_twitter.ico rename to searx/static/themes/courgette/img/icons/icon_twitter.ico diff --git a/searx/static/courgette/img/icon_vimeo.ico b/searx/static/themes/courgette/img/icons/icon_vimeo.ico similarity index 100% rename from searx/static/courgette/img/icon_vimeo.ico rename to searx/static/themes/courgette/img/icons/icon_vimeo.ico diff --git a/searx/static/courgette/img/icon_wikipedia.ico b/searx/static/themes/courgette/img/icons/icon_wikipedia.ico similarity index 100% rename from searx/static/courgette/img/icon_wikipedia.ico rename to searx/static/themes/courgette/img/icons/icon_wikipedia.ico diff --git a/searx/static/courgette/img/icon_youtube.ico b/searx/static/themes/courgette/img/icons/icon_youtube.ico similarity index 100% rename from searx/static/courgette/img/icon_youtube.ico rename to searx/static/themes/courgette/img/icons/icon_youtube.ico diff --git a/searx/static/courgette/img/preference-icon.png b/searx/static/themes/courgette/img/preference-icon.png similarity index 100% rename from searx/static/courgette/img/preference-icon.png rename to searx/static/themes/courgette/img/preference-icon.png diff --git a/searx/static/courgette/img/search-icon.png b/searx/static/themes/courgette/img/search-icon.png similarity index 100% rename from searx/static/courgette/img/search-icon.png rename to searx/static/themes/courgette/img/search-icon.png diff --git a/searx/static/courgette/img/searx-mobile.png b/searx/static/themes/courgette/img/searx-mobile.png similarity index 100% rename from searx/static/courgette/img/searx-mobile.png rename to searx/static/themes/courgette/img/searx-mobile.png diff --git a/searx/static/courgette/img/searx.png b/searx/static/themes/courgette/img/searx.png similarity index 100% rename from searx/static/courgette/img/searx.png rename to searx/static/themes/courgette/img/searx.png diff --git a/searx/static/courgette/img/searx_logo.svg b/searx/static/themes/courgette/img/searx_logo.svg similarity index 100% rename from searx/static/courgette/img/searx_logo.svg rename to searx/static/themes/courgette/img/searx_logo.svg diff --git a/searx/static/courgette/js/mootools-autocompleter-1.1.2-min.js b/searx/static/themes/courgette/js/mootools-autocompleter-1.1.2-min.js similarity index 100% rename from searx/static/courgette/js/mootools-autocompleter-1.1.2-min.js rename to searx/static/themes/courgette/js/mootools-autocompleter-1.1.2-min.js diff --git a/searx/static/courgette/js/mootools-core-1.4.5-min.js b/searx/static/themes/courgette/js/mootools-core-1.4.5-min.js similarity index 100% rename from searx/static/courgette/js/mootools-core-1.4.5-min.js rename to searx/static/themes/courgette/js/mootools-core-1.4.5-min.js diff --git a/searx/static/courgette/js/searx.js b/searx/static/themes/courgette/js/searx.js similarity index 100% rename from searx/static/courgette/js/searx.js rename to searx/static/themes/courgette/js/searx.js diff --git a/searx/static/default/css/style.css b/searx/static/themes/default/css/style.css similarity index 100% rename from searx/static/default/css/style.css rename to searx/static/themes/default/css/style.css diff --git a/searx/static/default/img/favicon.png b/searx/static/themes/default/img/favicon.png similarity index 100% rename from searx/static/default/img/favicon.png rename to searx/static/themes/default/img/favicon.png diff --git a/searx/static/default/img/github_ribbon.png b/searx/static/themes/default/img/github_ribbon.png similarity index 100% rename from searx/static/default/img/github_ribbon.png rename to searx/static/themes/default/img/github_ribbon.png diff --git a/searx/static/default/img/icon_dailymotion.ico b/searx/static/themes/default/img/icons/icon_dailymotion.ico similarity index 100% rename from searx/static/default/img/icon_dailymotion.ico rename to searx/static/themes/default/img/icons/icon_dailymotion.ico diff --git a/searx/static/default/img/icon_deviantart.ico b/searx/static/themes/default/img/icons/icon_deviantart.ico similarity index 100% rename from searx/static/default/img/icon_deviantart.ico rename to searx/static/themes/default/img/icons/icon_deviantart.ico diff --git a/searx/static/default/img/icon_github.ico b/searx/static/themes/default/img/icons/icon_github.ico similarity index 100% rename from searx/static/default/img/icon_github.ico rename to searx/static/themes/default/img/icons/icon_github.ico diff --git a/searx/static/default/img/icon_kickass.ico b/searx/static/themes/default/img/icons/icon_kickass.ico similarity index 100% rename from searx/static/default/img/icon_kickass.ico rename to searx/static/themes/default/img/icons/icon_kickass.ico diff --git a/searx/static/default/img/icon_soundcloud.ico b/searx/static/themes/default/img/icons/icon_soundcloud.ico similarity index 100% rename from searx/static/default/img/icon_soundcloud.ico rename to searx/static/themes/default/img/icons/icon_soundcloud.ico diff --git a/searx/static/default/img/icon_stackoverflow.ico b/searx/static/themes/default/img/icons/icon_stackoverflow.ico similarity index 100% rename from searx/static/default/img/icon_stackoverflow.ico rename to searx/static/themes/default/img/icons/icon_stackoverflow.ico diff --git a/searx/static/default/img/icon_twitter.ico b/searx/static/themes/default/img/icons/icon_twitter.ico similarity index 100% rename from searx/static/default/img/icon_twitter.ico rename to searx/static/themes/default/img/icons/icon_twitter.ico diff --git a/searx/static/default/img/icon_vimeo.ico b/searx/static/themes/default/img/icons/icon_vimeo.ico similarity index 100% rename from searx/static/default/img/icon_vimeo.ico rename to searx/static/themes/default/img/icons/icon_vimeo.ico diff --git a/searx/static/default/img/icon_wikipedia.ico b/searx/static/themes/default/img/icons/icon_wikipedia.ico similarity index 100% rename from searx/static/default/img/icon_wikipedia.ico rename to searx/static/themes/default/img/icons/icon_wikipedia.ico diff --git a/searx/static/default/img/icon_youtube.ico b/searx/static/themes/default/img/icons/icon_youtube.ico similarity index 100% rename from searx/static/default/img/icon_youtube.ico rename to searx/static/themes/default/img/icons/icon_youtube.ico diff --git a/searx/static/default/img/preference-icon.png b/searx/static/themes/default/img/preference-icon.png similarity index 100% rename from searx/static/default/img/preference-icon.png rename to searx/static/themes/default/img/preference-icon.png diff --git a/searx/static/default/img/search-icon.png b/searx/static/themes/default/img/search-icon.png similarity index 100% rename from searx/static/default/img/search-icon.png rename to searx/static/themes/default/img/search-icon.png diff --git a/searx/static/default/img/searx.png b/searx/static/themes/default/img/searx.png similarity index 100% rename from searx/static/default/img/searx.png rename to searx/static/themes/default/img/searx.png diff --git a/searx/static/default/img/searx_logo.svg b/searx/static/themes/default/img/searx_logo.svg similarity index 100% rename from searx/static/default/img/searx_logo.svg rename to searx/static/themes/default/img/searx_logo.svg diff --git a/searx/static/default/js/mootools-autocompleter-1.1.2-min.js b/searx/static/themes/default/js/mootools-autocompleter-1.1.2-min.js similarity index 100% rename from searx/static/default/js/mootools-autocompleter-1.1.2-min.js rename to searx/static/themes/default/js/mootools-autocompleter-1.1.2-min.js diff --git a/searx/static/default/js/mootools-core-1.4.5-min.js b/searx/static/themes/default/js/mootools-core-1.4.5-min.js similarity index 100% rename from searx/static/default/js/mootools-core-1.4.5-min.js rename to searx/static/themes/default/js/mootools-core-1.4.5-min.js diff --git a/searx/static/default/js/searx.js b/searx/static/themes/default/js/searx.js similarity index 100% rename from searx/static/default/js/searx.js rename to searx/static/themes/default/js/searx.js diff --git a/searx/static/default/less/autocompleter.less b/searx/static/themes/default/less/autocompleter.less similarity index 100% rename from searx/static/default/less/autocompleter.less rename to searx/static/themes/default/less/autocompleter.less diff --git a/searx/static/default/less/code.less b/searx/static/themes/default/less/code.less similarity index 100% rename from searx/static/default/less/code.less rename to searx/static/themes/default/less/code.less diff --git a/searx/static/default/less/definitions.less b/searx/static/themes/default/less/definitions.less similarity index 100% rename from searx/static/default/less/definitions.less rename to searx/static/themes/default/less/definitions.less diff --git a/searx/static/default/less/mixins.less b/searx/static/themes/default/less/mixins.less similarity index 100% rename from searx/static/default/less/mixins.less rename to searx/static/themes/default/less/mixins.less diff --git a/searx/static/default/less/search.less b/searx/static/themes/default/less/search.less similarity index 100% rename from searx/static/default/less/search.less rename to searx/static/themes/default/less/search.less diff --git a/searx/static/default/less/style.less b/searx/static/themes/default/less/style.less similarity index 100% rename from searx/static/default/less/style.less rename to searx/static/themes/default/less/style.less diff --git a/searx/static/oscar/.gitignore b/searx/static/themes/oscar/.gitignore similarity index 100% rename from searx/static/oscar/.gitignore rename to searx/static/themes/oscar/.gitignore diff --git a/searx/static/oscar/README.rst b/searx/static/themes/oscar/README.rst similarity index 53% rename from searx/static/oscar/README.rst rename to searx/static/themes/oscar/README.rst index 7a1800add..e7daa8719 100644 --- a/searx/static/oscar/README.rst +++ b/searx/static/themes/oscar/README.rst @@ -1,14 +1,14 @@ install dependencies ~~~~~~~~~~~~~~~~~~~~ -run this command in the directory ``searx/static/oscar`` +run this command in the directory ``searx/static/themes/oscar`` ``npm install`` compile sources ~~~~~~~~~~~~~~~ -run this command in the directory ``searx/static/oscar`` +run this command in the directory ``searx/static/themes/oscar`` ``grunt`` diff --git a/searx/static/oscar/css/bootstrap.min.css b/searx/static/themes/oscar/css/bootstrap.min.css similarity index 100% rename from searx/static/oscar/css/bootstrap.min.css rename to searx/static/themes/oscar/css/bootstrap.min.css diff --git a/searx/static/oscar/css/leaflet.min.css b/searx/static/themes/oscar/css/leaflet.min.css similarity index 100% rename from searx/static/oscar/css/leaflet.min.css rename to searx/static/themes/oscar/css/leaflet.min.css diff --git a/searx/static/oscar/css/oscar.min.css b/searx/static/themes/oscar/css/oscar.min.css similarity index 100% rename from searx/static/oscar/css/oscar.min.css rename to searx/static/themes/oscar/css/oscar.min.css diff --git a/searx/static/oscar/fonts/glyphicons-halflings-regular.eot b/searx/static/themes/oscar/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from searx/static/oscar/fonts/glyphicons-halflings-regular.eot rename to searx/static/themes/oscar/fonts/glyphicons-halflings-regular.eot diff --git a/searx/static/oscar/fonts/glyphicons-halflings-regular.svg b/searx/static/themes/oscar/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from searx/static/oscar/fonts/glyphicons-halflings-regular.svg rename to searx/static/themes/oscar/fonts/glyphicons-halflings-regular.svg diff --git a/searx/static/oscar/fonts/glyphicons-halflings-regular.ttf b/searx/static/themes/oscar/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from searx/static/oscar/fonts/glyphicons-halflings-regular.ttf rename to searx/static/themes/oscar/fonts/glyphicons-halflings-regular.ttf diff --git a/searx/static/oscar/fonts/glyphicons-halflings-regular.woff b/searx/static/themes/oscar/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from searx/static/oscar/fonts/glyphicons-halflings-regular.woff rename to searx/static/themes/oscar/fonts/glyphicons-halflings-regular.woff diff --git a/searx/static/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js similarity index 100% rename from searx/static/oscar/gruntfile.js rename to searx/static/themes/oscar/gruntfile.js diff --git a/searx/static/oscar/img/favicon.png b/searx/static/themes/oscar/img/favicon.png similarity index 100% rename from searx/static/oscar/img/favicon.png rename to searx/static/themes/oscar/img/favicon.png diff --git a/searx/static/oscar/img/icons/README.md b/searx/static/themes/oscar/img/icons/README.md similarity index 100% rename from searx/static/oscar/img/icons/README.md rename to searx/static/themes/oscar/img/icons/README.md diff --git a/searx/static/oscar/img/icons/amazon.png b/searx/static/themes/oscar/img/icons/amazon.png similarity index 100% rename from searx/static/oscar/img/icons/amazon.png rename to searx/static/themes/oscar/img/icons/amazon.png diff --git a/searx/static/oscar/img/icons/dailymotion.png b/searx/static/themes/oscar/img/icons/dailymotion.png similarity index 100% rename from searx/static/oscar/img/icons/dailymotion.png rename to searx/static/themes/oscar/img/icons/dailymotion.png diff --git a/searx/static/oscar/img/icons/deviantart.png b/searx/static/themes/oscar/img/icons/deviantart.png similarity index 100% rename from searx/static/oscar/img/icons/deviantart.png rename to searx/static/themes/oscar/img/icons/deviantart.png diff --git a/searx/static/oscar/img/icons/facebook.png b/searx/static/themes/oscar/img/icons/facebook.png similarity index 100% rename from searx/static/oscar/img/icons/facebook.png rename to searx/static/themes/oscar/img/icons/facebook.png diff --git a/searx/static/oscar/img/icons/flickr.png b/searx/static/themes/oscar/img/icons/flickr.png similarity index 100% rename from searx/static/oscar/img/icons/flickr.png rename to searx/static/themes/oscar/img/icons/flickr.png diff --git a/searx/static/oscar/img/icons/github.png b/searx/static/themes/oscar/img/icons/github.png similarity index 100% rename from searx/static/oscar/img/icons/github.png rename to searx/static/themes/oscar/img/icons/github.png diff --git a/searx/static/oscar/img/icons/kickass.png b/searx/static/themes/oscar/img/icons/kickass.png similarity index 100% rename from searx/static/oscar/img/icons/kickass.png rename to searx/static/themes/oscar/img/icons/kickass.png diff --git a/searx/static/themes/oscar/img/icons/openstreetmap.png b/searx/static/themes/oscar/img/icons/openstreetmap.png new file mode 100644 index 000000000..4f88c9643 Binary files /dev/null and b/searx/static/themes/oscar/img/icons/openstreetmap.png differ diff --git a/searx/static/themes/oscar/img/icons/photon.png b/searx/static/themes/oscar/img/icons/photon.png new file mode 100644 index 000000000..0d0732027 Binary files /dev/null and b/searx/static/themes/oscar/img/icons/photon.png differ diff --git a/searx/static/themes/oscar/img/icons/searchcode code.png b/searx/static/themes/oscar/img/icons/searchcode code.png new file mode 100644 index 000000000..884c2660d Binary files /dev/null and b/searx/static/themes/oscar/img/icons/searchcode code.png differ diff --git a/searx/static/themes/oscar/img/icons/searchcode doc.png b/searx/static/themes/oscar/img/icons/searchcode doc.png new file mode 100644 index 000000000..884c2660d Binary files /dev/null and b/searx/static/themes/oscar/img/icons/searchcode doc.png differ diff --git a/searx/static/oscar/img/icons/soundcloud.png b/searx/static/themes/oscar/img/icons/soundcloud.png similarity index 100% rename from searx/static/oscar/img/icons/soundcloud.png rename to searx/static/themes/oscar/img/icons/soundcloud.png diff --git a/searx/static/oscar/img/icons/stackoverflow.png b/searx/static/themes/oscar/img/icons/stackoverflow.png similarity index 100% rename from searx/static/oscar/img/icons/stackoverflow.png rename to searx/static/themes/oscar/img/icons/stackoverflow.png diff --git a/searx/static/oscar/img/icons/twitter.png b/searx/static/themes/oscar/img/icons/twitter.png similarity index 100% rename from searx/static/oscar/img/icons/twitter.png rename to searx/static/themes/oscar/img/icons/twitter.png diff --git a/searx/static/oscar/img/icons/vimeo.png b/searx/static/themes/oscar/img/icons/vimeo.png similarity index 100% rename from searx/static/oscar/img/icons/vimeo.png rename to searx/static/themes/oscar/img/icons/vimeo.png diff --git a/searx/static/oscar/img/icons/wikipedia.png b/searx/static/themes/oscar/img/icons/wikipedia.png similarity index 100% rename from searx/static/oscar/img/icons/wikipedia.png rename to searx/static/themes/oscar/img/icons/wikipedia.png diff --git a/searx/static/oscar/img/icons/youtube.png b/searx/static/themes/oscar/img/icons/youtube.png similarity index 100% rename from searx/static/oscar/img/icons/youtube.png rename to searx/static/themes/oscar/img/icons/youtube.png diff --git a/searx/static/oscar/img/loader.gif b/searx/static/themes/oscar/img/loader.gif similarity index 100% rename from searx/static/oscar/img/loader.gif rename to searx/static/themes/oscar/img/loader.gif diff --git a/searx/static/oscar/img/map/layers-2x.png b/searx/static/themes/oscar/img/map/layers-2x.png similarity index 100% rename from searx/static/oscar/img/map/layers-2x.png rename to searx/static/themes/oscar/img/map/layers-2x.png diff --git a/searx/static/oscar/img/map/layers.png b/searx/static/themes/oscar/img/map/layers.png similarity index 100% rename from searx/static/oscar/img/map/layers.png rename to searx/static/themes/oscar/img/map/layers.png diff --git a/searx/static/themes/oscar/img/map/marker-icon-2x-green.png b/searx/static/themes/oscar/img/map/marker-icon-2x-green.png new file mode 100644 index 000000000..c359abb6c Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-2x-green.png differ diff --git a/searx/static/themes/oscar/img/map/marker-icon-2x-orange.png b/searx/static/themes/oscar/img/map/marker-icon-2x-orange.png new file mode 100644 index 000000000..c3c863211 Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-2x-orange.png differ diff --git a/searx/static/themes/oscar/img/map/marker-icon-2x-red.png b/searx/static/themes/oscar/img/map/marker-icon-2x-red.png new file mode 100644 index 000000000..1c26e9fc2 Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-2x-red.png differ diff --git a/searx/static/oscar/img/map/marker-icon-2x.png b/searx/static/themes/oscar/img/map/marker-icon-2x.png similarity index 100% rename from searx/static/oscar/img/map/marker-icon-2x.png rename to searx/static/themes/oscar/img/map/marker-icon-2x.png diff --git a/searx/static/themes/oscar/img/map/marker-icon-green.png b/searx/static/themes/oscar/img/map/marker-icon-green.png new file mode 100644 index 000000000..56db5ea9f Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-green.png differ diff --git a/searx/static/themes/oscar/img/map/marker-icon-orange.png b/searx/static/themes/oscar/img/map/marker-icon-orange.png new file mode 100644 index 000000000..fbbce7b2a Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-orange.png differ diff --git a/searx/static/themes/oscar/img/map/marker-icon-red.png b/searx/static/themes/oscar/img/map/marker-icon-red.png new file mode 100644 index 000000000..3e64e06d1 Binary files /dev/null and b/searx/static/themes/oscar/img/map/marker-icon-red.png differ diff --git a/searx/static/oscar/img/map/marker-icon.png b/searx/static/themes/oscar/img/map/marker-icon.png similarity index 100% rename from searx/static/oscar/img/map/marker-icon.png rename to searx/static/themes/oscar/img/map/marker-icon.png diff --git a/searx/static/oscar/img/map/marker-shadow.png b/searx/static/themes/oscar/img/map/marker-shadow.png similarity index 100% rename from searx/static/oscar/img/map/marker-shadow.png rename to searx/static/themes/oscar/img/map/marker-shadow.png diff --git a/searx/static/oscar/img/searx_logo.png b/searx/static/themes/oscar/img/searx_logo.png similarity index 100% rename from searx/static/oscar/img/searx_logo.png rename to searx/static/themes/oscar/img/searx_logo.png diff --git a/searx/static/oscar/js/bootstrap.min.js b/searx/static/themes/oscar/js/bootstrap.min.js similarity index 100% rename from searx/static/oscar/js/bootstrap.min.js rename to searx/static/themes/oscar/js/bootstrap.min.js diff --git a/searx/static/oscar/js/html5shiv.min.js b/searx/static/themes/oscar/js/html5shiv.min.js similarity index 100% rename from searx/static/oscar/js/html5shiv.min.js rename to searx/static/themes/oscar/js/html5shiv.min.js diff --git a/searx/static/oscar/js/jquery-1.11.1.min.js b/searx/static/themes/oscar/js/jquery-1.11.1.min.js similarity index 100% rename from searx/static/oscar/js/jquery-1.11.1.min.js rename to searx/static/themes/oscar/js/jquery-1.11.1.min.js diff --git a/searx/static/oscar/js/leaflet-0.7.3.min.js b/searx/static/themes/oscar/js/leaflet-0.7.3.min.js similarity index 100% rename from searx/static/oscar/js/leaflet-0.7.3.min.js rename to searx/static/themes/oscar/js/leaflet-0.7.3.min.js diff --git a/searx/static/oscar/js/require-2.1.15.min.js b/searx/static/themes/oscar/js/require-2.1.15.min.js similarity index 100% rename from searx/static/oscar/js/require-2.1.15.min.js rename to searx/static/themes/oscar/js/require-2.1.15.min.js diff --git a/searx/static/oscar/js/respond.min.js b/searx/static/themes/oscar/js/respond.min.js similarity index 100% rename from searx/static/oscar/js/respond.min.js rename to searx/static/themes/oscar/js/respond.min.js diff --git a/searx/static/themes/oscar/js/searx.min.js b/searx/static/themes/oscar/js/searx.min.js new file mode 100644 index 000000000..2015c4d6a --- /dev/null +++ b/searx/static/themes/oscar/js/searx.min.js @@ -0,0 +1,2 @@ +/*! oscar/searx.min.js | 09-01-2015 | https://github.com/asciimoo/searx */ +requirejs.config({baseUrl:"./static/themes/oscar/js",paths:{app:"../app"}}),searx.autocompleter&&(searx.searchResults=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:"/autocompleter?q=%QUERY"}),searx.searchResults.initialize()),$(document).ready(function(){searx.autocompleter&&$("#q").typeahead(null,{name:"search-results",displayKey:function(a){return a},source:searx.searchResults.ttAdapter()})}),$(document).ready(function(){$("#q.autofocus").focus(),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var a=$(this).data("btn-text-collapsed"),b=$(this).data("btn-text-not-collapsed");""!==a&&""!==b&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(a,b):$(this).html().replace(b,a),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var a="btn-"+$(this).data("btn-class"),b=$(this).data("btn-label-default"),c=$(this).data("btn-label-toggled");""!==c&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(b,c):$(this).html().replace(c,b),$(this).html(new_html)),$(this).toggleClass(a),$(this).toggleClass("btn-default")}),$(".media-loader").click(function(){var a=$(this).data("target"),b=$(a+" > iframe"),c=b.attr("src");(void 0===c||c===!1)&&b.attr("src",b.data("src"))}),$(".btn-sm").dblclick(function(){var a="btn-"+$(this).data("btn-class");$(this).hasClass("btn-default")?($(".btn-sm > input").attr("checked","checked"),$(".btn-sm > input").prop("checked",!0),$(".btn-sm").addClass(a),$(".btn-sm").addClass("active"),$(".btn-sm").removeClass("btn-default")):($(".btn-sm > input").attr("checked",""),$(".btn-sm > input").removeAttr("checked"),$(".btn-sm > input").checked=!1,$(".btn-sm").removeClass(a),$(".btn-sm").removeClass("active"),$(".btn-sm").addClass("btn-default"))})}),$(document).ready(function(){$(".searx_overpass_request").on("click",function(a){var b="https://overpass-api.de/api/interpreter?data=",c=b+"[out:json][timeout:25];(",d=");out meta;",e=$(this).data("osm-id"),f=$(this).data("osm-type"),g=$(this).data("result-table"),h="#"+$(this).data("result-table-loadicon"),i=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(e&&f&&g){g="#"+g;var j=null;switch(f){case"node":j=c+"node("+e+");"+d;break;case"way":j=c+"way("+e+");"+d;break;case"relation":j=c+"relation("+e+");"+d}if(j){$.ajax(j).done(function(a){if(a&&a.elements&&a.elements[0]){var b=a.elements[0],c=$(g).html();for(var d in b.tags)if(null===b.tags.name||-1==i.indexOf(d)){switch(c+=""+d+"",d){case"phone":case"fax":c+=''+b.tags[d]+"";break;case"email":c+=''+b.tags[d]+"";break;case"website":case"url":c+=''+b.tags[d]+"";break;case"wikidata":c+=''+b.tags[d]+"";break;case"wikipedia":if(-1!=b.tags[d].indexOf(":")){c+=''+b.tags[d]+"";break}default:c+=b.tags[d]}c+=""}$(g).html(c),$(g).removeClass("hidden"),$(h).addClass("hidden")}}).fail(function(){$(h).html($(h).html()+'

could not load data!

')})}}$(this).off(a)}),$(".searx_init_map").on("click",function(a){var b=$(this).data("leaflet-target"),c=$(this).data("map-lon"),d=$(this).data("map-lat"),e=$(this).data("map-zoom"),f=$(this).data("map-boundingbox"),g=$(this).data("map-geojson");require(["leaflet-0.7.3.min"],function(){f&&(southWest=L.latLng(f[0],f[2]),northEast=L.latLng(f[1],f[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="./static/themes/oscar/img/map";{var a=L.map(b),h="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",i='Map data © OpenStreetMap contributors',j=new L.TileLayer(h,{minZoom:1,maxZoom:19,attribution:i}),k="http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg",l='Map data © OpenStreetMap contributors | Tiles Courtesy of MapQuest ',m=new L.TileLayer(k,{minZoom:1,maxZoom:18,subdomains:"1234",attribution:l}),n="http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg",o='Map data © OpenStreetMap contributors | Tiles Courtesy of MapQuest | Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency';new L.TileLayer(n,{minZoom:1,maxZoom:11,subdomains:"1234",attribution:o})}map_bounds?setTimeout(function(){a.fitBounds(map_bounds,{maxZoom:17})},0):c&&d&&(e?a.setView(new L.LatLng(d,c),e):a.setView(new L.LatLng(d,c),8)),a.addLayer(m);var p={"OSM Mapnik":j,MapQuest:m};L.control.layers(p).addTo(a),g&&L.geoJson(g).addTo(a)}),$(this).off(a)})}); \ No newline at end of file diff --git a/searx/static/oscar/js/searx_src/00_requirejs_config.js b/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js similarity index 92% rename from searx/static/oscar/js/searx_src/00_requirejs_config.js rename to searx/static/themes/oscar/js/searx_src/00_requirejs_config.js index 99ec4b585..1aa434902 100644 --- a/searx/static/oscar/js/searx_src/00_requirejs_config.js +++ b/searx/static/themes/oscar/js/searx_src/00_requirejs_config.js @@ -16,7 +16,7 @@ */ requirejs.config({ - baseUrl: './static/oscar/js', + baseUrl: './static/themes/oscar/js', paths: { app: '../app' } diff --git a/searx/static/oscar/js/searx_src/autocompleter.js b/searx/static/themes/oscar/js/searx_src/autocompleter.js similarity index 100% rename from searx/static/oscar/js/searx_src/autocompleter.js rename to searx/static/themes/oscar/js/searx_src/autocompleter.js diff --git a/searx/static/oscar/js/searx_src/element_modifiers.js b/searx/static/themes/oscar/js/searx_src/element_modifiers.js similarity index 86% rename from searx/static/oscar/js/searx_src/element_modifiers.js rename to searx/static/themes/oscar/js/searx_src/element_modifiers.js index dd45b77e0..8e4280548 100644 --- a/searx/static/oscar/js/searx_src/element_modifiers.js +++ b/searx/static/themes/oscar/js/searx_src/element_modifiers.js @@ -63,6 +63,18 @@ $(document).ready(function(){ $(this).toggleClass(btnClass); $(this).toggleClass('btn-default'); }); + + /** + * change text during btn-toggle click if possible + */ + $('.media-loader').click(function() { + var target = $(this).data('target'); + var iframe_load = $(target + ' > iframe'); + var srctest = iframe_load.attr('src'); + if(srctest === undefined || srctest === false){ + iframe_load.attr('src', iframe_load.data('src')); + } + }); /** * Select or deselect every categories on double clic diff --git a/searx/static/oscar/js/searx_src/leaflet_map.js b/searx/static/themes/oscar/js/searx_src/leaflet_map.js similarity index 97% rename from searx/static/oscar/js/searx_src/leaflet_map.js rename to searx/static/themes/oscar/js/searx_src/leaflet_map.js index b5112ef5e..cbcbe157e 100644 --- a/searx/static/oscar/js/searx_src/leaflet_map.js +++ b/searx/static/themes/oscar/js/searx_src/leaflet_map.js @@ -116,7 +116,7 @@ $(document).ready(function(){ // TODO hack // change default imagePath - L.Icon.Default.imagePath = "./static/oscar/img/map"; + L.Icon.Default.imagePath = "./static/themes/oscar/img/map"; // init map var map = L.map(leaflet_target); diff --git a/searx/static/oscar/js/typeahead.bundle.min.js b/searx/static/themes/oscar/js/typeahead.bundle.min.js similarity index 100% rename from searx/static/oscar/js/typeahead.bundle.min.js rename to searx/static/themes/oscar/js/typeahead.bundle.min.js diff --git a/searx/static/oscar/less/bootstrap/.csscomb.json b/searx/static/themes/oscar/less/bootstrap/.csscomb.json similarity index 100% rename from searx/static/oscar/less/bootstrap/.csscomb.json rename to searx/static/themes/oscar/less/bootstrap/.csscomb.json diff --git a/searx/static/oscar/less/bootstrap/.csslintrc b/searx/static/themes/oscar/less/bootstrap/.csslintrc similarity index 100% rename from searx/static/oscar/less/bootstrap/.csslintrc rename to searx/static/themes/oscar/less/bootstrap/.csslintrc diff --git a/searx/static/oscar/less/bootstrap/alerts.less b/searx/static/themes/oscar/less/bootstrap/alerts.less similarity index 100% rename from searx/static/oscar/less/bootstrap/alerts.less rename to searx/static/themes/oscar/less/bootstrap/alerts.less diff --git a/searx/static/oscar/less/bootstrap/badges.less b/searx/static/themes/oscar/less/bootstrap/badges.less similarity index 100% rename from searx/static/oscar/less/bootstrap/badges.less rename to searx/static/themes/oscar/less/bootstrap/badges.less diff --git a/searx/static/oscar/less/bootstrap/bootstrap.less b/searx/static/themes/oscar/less/bootstrap/bootstrap.less similarity index 100% rename from searx/static/oscar/less/bootstrap/bootstrap.less rename to searx/static/themes/oscar/less/bootstrap/bootstrap.less diff --git a/searx/static/oscar/less/bootstrap/breadcrumbs.less b/searx/static/themes/oscar/less/bootstrap/breadcrumbs.less similarity index 100% rename from searx/static/oscar/less/bootstrap/breadcrumbs.less rename to searx/static/themes/oscar/less/bootstrap/breadcrumbs.less diff --git a/searx/static/oscar/less/bootstrap/button-groups.less b/searx/static/themes/oscar/less/bootstrap/button-groups.less similarity index 100% rename from searx/static/oscar/less/bootstrap/button-groups.less rename to searx/static/themes/oscar/less/bootstrap/button-groups.less diff --git a/searx/static/oscar/less/bootstrap/buttons.less b/searx/static/themes/oscar/less/bootstrap/buttons.less similarity index 100% rename from searx/static/oscar/less/bootstrap/buttons.less rename to searx/static/themes/oscar/less/bootstrap/buttons.less diff --git a/searx/static/oscar/less/bootstrap/carousel.less b/searx/static/themes/oscar/less/bootstrap/carousel.less similarity index 100% rename from searx/static/oscar/less/bootstrap/carousel.less rename to searx/static/themes/oscar/less/bootstrap/carousel.less diff --git a/searx/static/oscar/less/bootstrap/close.less b/searx/static/themes/oscar/less/bootstrap/close.less similarity index 100% rename from searx/static/oscar/less/bootstrap/close.less rename to searx/static/themes/oscar/less/bootstrap/close.less diff --git a/searx/static/oscar/less/bootstrap/code.less b/searx/static/themes/oscar/less/bootstrap/code.less similarity index 100% rename from searx/static/oscar/less/bootstrap/code.less rename to searx/static/themes/oscar/less/bootstrap/code.less diff --git a/searx/static/oscar/less/bootstrap/component-animations.less b/searx/static/themes/oscar/less/bootstrap/component-animations.less similarity index 100% rename from searx/static/oscar/less/bootstrap/component-animations.less rename to searx/static/themes/oscar/less/bootstrap/component-animations.less diff --git a/searx/static/oscar/less/bootstrap/dropdowns.less b/searx/static/themes/oscar/less/bootstrap/dropdowns.less similarity index 100% rename from searx/static/oscar/less/bootstrap/dropdowns.less rename to searx/static/themes/oscar/less/bootstrap/dropdowns.less diff --git a/searx/static/oscar/less/bootstrap/forms.less b/searx/static/themes/oscar/less/bootstrap/forms.less similarity index 100% rename from searx/static/oscar/less/bootstrap/forms.less rename to searx/static/themes/oscar/less/bootstrap/forms.less diff --git a/searx/static/oscar/less/bootstrap/glyphicons.less b/searx/static/themes/oscar/less/bootstrap/glyphicons.less similarity index 100% rename from searx/static/oscar/less/bootstrap/glyphicons.less rename to searx/static/themes/oscar/less/bootstrap/glyphicons.less diff --git a/searx/static/oscar/less/bootstrap/grid.less b/searx/static/themes/oscar/less/bootstrap/grid.less similarity index 100% rename from searx/static/oscar/less/bootstrap/grid.less rename to searx/static/themes/oscar/less/bootstrap/grid.less diff --git a/searx/static/oscar/less/bootstrap/input-groups.less b/searx/static/themes/oscar/less/bootstrap/input-groups.less similarity index 100% rename from searx/static/oscar/less/bootstrap/input-groups.less rename to searx/static/themes/oscar/less/bootstrap/input-groups.less diff --git a/searx/static/oscar/less/bootstrap/jumbotron.less b/searx/static/themes/oscar/less/bootstrap/jumbotron.less similarity index 100% rename from searx/static/oscar/less/bootstrap/jumbotron.less rename to searx/static/themes/oscar/less/bootstrap/jumbotron.less diff --git a/searx/static/oscar/less/bootstrap/labels.less b/searx/static/themes/oscar/less/bootstrap/labels.less similarity index 100% rename from searx/static/oscar/less/bootstrap/labels.less rename to searx/static/themes/oscar/less/bootstrap/labels.less diff --git a/searx/static/oscar/less/bootstrap/list-group.less b/searx/static/themes/oscar/less/bootstrap/list-group.less similarity index 100% rename from searx/static/oscar/less/bootstrap/list-group.less rename to searx/static/themes/oscar/less/bootstrap/list-group.less diff --git a/searx/static/oscar/less/bootstrap/media.less b/searx/static/themes/oscar/less/bootstrap/media.less similarity index 100% rename from searx/static/oscar/less/bootstrap/media.less rename to searx/static/themes/oscar/less/bootstrap/media.less diff --git a/searx/static/oscar/less/bootstrap/mixins.less b/searx/static/themes/oscar/less/bootstrap/mixins.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins.less rename to searx/static/themes/oscar/less/bootstrap/mixins.less diff --git a/searx/static/oscar/less/bootstrap/mixins/alerts.less b/searx/static/themes/oscar/less/bootstrap/mixins/alerts.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/alerts.less rename to searx/static/themes/oscar/less/bootstrap/mixins/alerts.less diff --git a/searx/static/oscar/less/bootstrap/mixins/background-variant.less b/searx/static/themes/oscar/less/bootstrap/mixins/background-variant.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/background-variant.less rename to searx/static/themes/oscar/less/bootstrap/mixins/background-variant.less diff --git a/searx/static/oscar/less/bootstrap/mixins/border-radius.less b/searx/static/themes/oscar/less/bootstrap/mixins/border-radius.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/border-radius.less rename to searx/static/themes/oscar/less/bootstrap/mixins/border-radius.less diff --git a/searx/static/oscar/less/bootstrap/mixins/buttons.less b/searx/static/themes/oscar/less/bootstrap/mixins/buttons.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/buttons.less rename to searx/static/themes/oscar/less/bootstrap/mixins/buttons.less diff --git a/searx/static/oscar/less/bootstrap/mixins/center-block.less b/searx/static/themes/oscar/less/bootstrap/mixins/center-block.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/center-block.less rename to searx/static/themes/oscar/less/bootstrap/mixins/center-block.less diff --git a/searx/static/oscar/less/bootstrap/mixins/clearfix.less b/searx/static/themes/oscar/less/bootstrap/mixins/clearfix.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/clearfix.less rename to searx/static/themes/oscar/less/bootstrap/mixins/clearfix.less diff --git a/searx/static/oscar/less/bootstrap/mixins/forms.less b/searx/static/themes/oscar/less/bootstrap/mixins/forms.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/forms.less rename to searx/static/themes/oscar/less/bootstrap/mixins/forms.less diff --git a/searx/static/oscar/less/bootstrap/mixins/gradients.less b/searx/static/themes/oscar/less/bootstrap/mixins/gradients.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/gradients.less rename to searx/static/themes/oscar/less/bootstrap/mixins/gradients.less diff --git a/searx/static/oscar/less/bootstrap/mixins/grid-framework.less b/searx/static/themes/oscar/less/bootstrap/mixins/grid-framework.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/grid-framework.less rename to searx/static/themes/oscar/less/bootstrap/mixins/grid-framework.less diff --git a/searx/static/oscar/less/bootstrap/mixins/grid.less b/searx/static/themes/oscar/less/bootstrap/mixins/grid.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/grid.less rename to searx/static/themes/oscar/less/bootstrap/mixins/grid.less diff --git a/searx/static/oscar/less/bootstrap/mixins/hide-text.less b/searx/static/themes/oscar/less/bootstrap/mixins/hide-text.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/hide-text.less rename to searx/static/themes/oscar/less/bootstrap/mixins/hide-text.less diff --git a/searx/static/oscar/less/bootstrap/mixins/image.less b/searx/static/themes/oscar/less/bootstrap/mixins/image.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/image.less rename to searx/static/themes/oscar/less/bootstrap/mixins/image.less diff --git a/searx/static/oscar/less/bootstrap/mixins/labels.less b/searx/static/themes/oscar/less/bootstrap/mixins/labels.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/labels.less rename to searx/static/themes/oscar/less/bootstrap/mixins/labels.less diff --git a/searx/static/oscar/less/bootstrap/mixins/list-group.less b/searx/static/themes/oscar/less/bootstrap/mixins/list-group.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/list-group.less rename to searx/static/themes/oscar/less/bootstrap/mixins/list-group.less diff --git a/searx/static/oscar/less/bootstrap/mixins/nav-divider.less b/searx/static/themes/oscar/less/bootstrap/mixins/nav-divider.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/nav-divider.less rename to searx/static/themes/oscar/less/bootstrap/mixins/nav-divider.less diff --git a/searx/static/oscar/less/bootstrap/mixins/nav-vertical-align.less b/searx/static/themes/oscar/less/bootstrap/mixins/nav-vertical-align.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/nav-vertical-align.less rename to searx/static/themes/oscar/less/bootstrap/mixins/nav-vertical-align.less diff --git a/searx/static/oscar/less/bootstrap/mixins/opacity.less b/searx/static/themes/oscar/less/bootstrap/mixins/opacity.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/opacity.less rename to searx/static/themes/oscar/less/bootstrap/mixins/opacity.less diff --git a/searx/static/oscar/less/bootstrap/mixins/pagination.less b/searx/static/themes/oscar/less/bootstrap/mixins/pagination.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/pagination.less rename to searx/static/themes/oscar/less/bootstrap/mixins/pagination.less diff --git a/searx/static/oscar/less/bootstrap/mixins/panels.less b/searx/static/themes/oscar/less/bootstrap/mixins/panels.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/panels.less rename to searx/static/themes/oscar/less/bootstrap/mixins/panels.less diff --git a/searx/static/oscar/less/bootstrap/mixins/progress-bar.less b/searx/static/themes/oscar/less/bootstrap/mixins/progress-bar.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/progress-bar.less rename to searx/static/themes/oscar/less/bootstrap/mixins/progress-bar.less diff --git a/searx/static/oscar/less/bootstrap/mixins/reset-filter.less b/searx/static/themes/oscar/less/bootstrap/mixins/reset-filter.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/reset-filter.less rename to searx/static/themes/oscar/less/bootstrap/mixins/reset-filter.less diff --git a/searx/static/oscar/less/bootstrap/mixins/resize.less b/searx/static/themes/oscar/less/bootstrap/mixins/resize.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/resize.less rename to searx/static/themes/oscar/less/bootstrap/mixins/resize.less diff --git a/searx/static/oscar/less/bootstrap/mixins/responsive-visibility.less b/searx/static/themes/oscar/less/bootstrap/mixins/responsive-visibility.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/responsive-visibility.less rename to searx/static/themes/oscar/less/bootstrap/mixins/responsive-visibility.less diff --git a/searx/static/oscar/less/bootstrap/mixins/size.less b/searx/static/themes/oscar/less/bootstrap/mixins/size.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/size.less rename to searx/static/themes/oscar/less/bootstrap/mixins/size.less diff --git a/searx/static/oscar/less/bootstrap/mixins/tab-focus.less b/searx/static/themes/oscar/less/bootstrap/mixins/tab-focus.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/tab-focus.less rename to searx/static/themes/oscar/less/bootstrap/mixins/tab-focus.less diff --git a/searx/static/oscar/less/bootstrap/mixins/table-row.less b/searx/static/themes/oscar/less/bootstrap/mixins/table-row.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/table-row.less rename to searx/static/themes/oscar/less/bootstrap/mixins/table-row.less diff --git a/searx/static/oscar/less/bootstrap/mixins/text-emphasis.less b/searx/static/themes/oscar/less/bootstrap/mixins/text-emphasis.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/text-emphasis.less rename to searx/static/themes/oscar/less/bootstrap/mixins/text-emphasis.less diff --git a/searx/static/oscar/less/bootstrap/mixins/text-overflow.less b/searx/static/themes/oscar/less/bootstrap/mixins/text-overflow.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/text-overflow.less rename to searx/static/themes/oscar/less/bootstrap/mixins/text-overflow.less diff --git a/searx/static/oscar/less/bootstrap/mixins/vendor-prefixes.less b/searx/static/themes/oscar/less/bootstrap/mixins/vendor-prefixes.less similarity index 100% rename from searx/static/oscar/less/bootstrap/mixins/vendor-prefixes.less rename to searx/static/themes/oscar/less/bootstrap/mixins/vendor-prefixes.less diff --git a/searx/static/oscar/less/bootstrap/modals.less b/searx/static/themes/oscar/less/bootstrap/modals.less similarity index 100% rename from searx/static/oscar/less/bootstrap/modals.less rename to searx/static/themes/oscar/less/bootstrap/modals.less diff --git a/searx/static/oscar/less/bootstrap/navbar.less b/searx/static/themes/oscar/less/bootstrap/navbar.less similarity index 100% rename from searx/static/oscar/less/bootstrap/navbar.less rename to searx/static/themes/oscar/less/bootstrap/navbar.less diff --git a/searx/static/oscar/less/bootstrap/navs.less b/searx/static/themes/oscar/less/bootstrap/navs.less similarity index 100% rename from searx/static/oscar/less/bootstrap/navs.less rename to searx/static/themes/oscar/less/bootstrap/navs.less diff --git a/searx/static/oscar/less/bootstrap/normalize.less b/searx/static/themes/oscar/less/bootstrap/normalize.less similarity index 100% rename from searx/static/oscar/less/bootstrap/normalize.less rename to searx/static/themes/oscar/less/bootstrap/normalize.less diff --git a/searx/static/oscar/less/bootstrap/pager.less b/searx/static/themes/oscar/less/bootstrap/pager.less similarity index 100% rename from searx/static/oscar/less/bootstrap/pager.less rename to searx/static/themes/oscar/less/bootstrap/pager.less diff --git a/searx/static/oscar/less/bootstrap/pagination.less b/searx/static/themes/oscar/less/bootstrap/pagination.less similarity index 100% rename from searx/static/oscar/less/bootstrap/pagination.less rename to searx/static/themes/oscar/less/bootstrap/pagination.less diff --git a/searx/static/oscar/less/bootstrap/panels.less b/searx/static/themes/oscar/less/bootstrap/panels.less similarity index 100% rename from searx/static/oscar/less/bootstrap/panels.less rename to searx/static/themes/oscar/less/bootstrap/panels.less diff --git a/searx/static/oscar/less/bootstrap/popovers.less b/searx/static/themes/oscar/less/bootstrap/popovers.less similarity index 100% rename from searx/static/oscar/less/bootstrap/popovers.less rename to searx/static/themes/oscar/less/bootstrap/popovers.less diff --git a/searx/static/oscar/less/bootstrap/print.less b/searx/static/themes/oscar/less/bootstrap/print.less similarity index 100% rename from searx/static/oscar/less/bootstrap/print.less rename to searx/static/themes/oscar/less/bootstrap/print.less diff --git a/searx/static/oscar/less/bootstrap/progress-bars.less b/searx/static/themes/oscar/less/bootstrap/progress-bars.less similarity index 100% rename from searx/static/oscar/less/bootstrap/progress-bars.less rename to searx/static/themes/oscar/less/bootstrap/progress-bars.less diff --git a/searx/static/oscar/less/bootstrap/responsive-embed.less b/searx/static/themes/oscar/less/bootstrap/responsive-embed.less similarity index 100% rename from searx/static/oscar/less/bootstrap/responsive-embed.less rename to searx/static/themes/oscar/less/bootstrap/responsive-embed.less diff --git a/searx/static/oscar/less/bootstrap/responsive-utilities.less b/searx/static/themes/oscar/less/bootstrap/responsive-utilities.less similarity index 100% rename from searx/static/oscar/less/bootstrap/responsive-utilities.less rename to searx/static/themes/oscar/less/bootstrap/responsive-utilities.less diff --git a/searx/static/oscar/less/bootstrap/scaffolding.less b/searx/static/themes/oscar/less/bootstrap/scaffolding.less similarity index 100% rename from searx/static/oscar/less/bootstrap/scaffolding.less rename to searx/static/themes/oscar/less/bootstrap/scaffolding.less diff --git a/searx/static/oscar/less/bootstrap/tables.less b/searx/static/themes/oscar/less/bootstrap/tables.less similarity index 100% rename from searx/static/oscar/less/bootstrap/tables.less rename to searx/static/themes/oscar/less/bootstrap/tables.less diff --git a/searx/static/oscar/less/bootstrap/theme.less b/searx/static/themes/oscar/less/bootstrap/theme.less similarity index 100% rename from searx/static/oscar/less/bootstrap/theme.less rename to searx/static/themes/oscar/less/bootstrap/theme.less diff --git a/searx/static/oscar/less/bootstrap/thumbnails.less b/searx/static/themes/oscar/less/bootstrap/thumbnails.less similarity index 100% rename from searx/static/oscar/less/bootstrap/thumbnails.less rename to searx/static/themes/oscar/less/bootstrap/thumbnails.less diff --git a/searx/static/oscar/less/bootstrap/tooltip.less b/searx/static/themes/oscar/less/bootstrap/tooltip.less similarity index 100% rename from searx/static/oscar/less/bootstrap/tooltip.less rename to searx/static/themes/oscar/less/bootstrap/tooltip.less diff --git a/searx/static/oscar/less/bootstrap/type.less b/searx/static/themes/oscar/less/bootstrap/type.less similarity index 100% rename from searx/static/oscar/less/bootstrap/type.less rename to searx/static/themes/oscar/less/bootstrap/type.less diff --git a/searx/static/oscar/less/bootstrap/typeahead.less b/searx/static/themes/oscar/less/bootstrap/typeahead.less similarity index 100% rename from searx/static/oscar/less/bootstrap/typeahead.less rename to searx/static/themes/oscar/less/bootstrap/typeahead.less diff --git a/searx/static/oscar/less/bootstrap/utilities.less b/searx/static/themes/oscar/less/bootstrap/utilities.less similarity index 100% rename from searx/static/oscar/less/bootstrap/utilities.less rename to searx/static/themes/oscar/less/bootstrap/utilities.less diff --git a/searx/static/oscar/less/bootstrap/variables.less b/searx/static/themes/oscar/less/bootstrap/variables.less similarity index 100% rename from searx/static/oscar/less/bootstrap/variables.less rename to searx/static/themes/oscar/less/bootstrap/variables.less diff --git a/searx/static/oscar/less/bootstrap/wells.less b/searx/static/themes/oscar/less/bootstrap/wells.less similarity index 100% rename from searx/static/oscar/less/bootstrap/wells.less rename to searx/static/themes/oscar/less/bootstrap/wells.less diff --git a/searx/static/oscar/less/oscar/checkbox.less b/searx/static/themes/oscar/less/oscar/checkbox.less similarity index 100% rename from searx/static/oscar/less/oscar/checkbox.less rename to searx/static/themes/oscar/less/oscar/checkbox.less diff --git a/searx/static/oscar/less/oscar/code.less b/searx/static/themes/oscar/less/oscar/code.less similarity index 100% rename from searx/static/oscar/less/oscar/code.less rename to searx/static/themes/oscar/less/oscar/code.less diff --git a/searx/static/oscar/less/oscar/cursor.less b/searx/static/themes/oscar/less/oscar/cursor.less similarity index 100% rename from searx/static/oscar/less/oscar/cursor.less rename to searx/static/themes/oscar/less/oscar/cursor.less diff --git a/searx/static/oscar/less/oscar/footer.less b/searx/static/themes/oscar/less/oscar/footer.less similarity index 100% rename from searx/static/oscar/less/oscar/footer.less rename to searx/static/themes/oscar/less/oscar/footer.less diff --git a/searx/static/oscar/less/oscar/infobox.less b/searx/static/themes/oscar/less/oscar/infobox.less similarity index 100% rename from searx/static/oscar/less/oscar/infobox.less rename to searx/static/themes/oscar/less/oscar/infobox.less diff --git a/searx/static/oscar/less/oscar/oscar.less b/searx/static/themes/oscar/less/oscar/oscar.less similarity index 100% rename from searx/static/oscar/less/oscar/oscar.less rename to searx/static/themes/oscar/less/oscar/oscar.less diff --git a/searx/static/oscar/less/oscar/results.less b/searx/static/themes/oscar/less/oscar/results.less similarity index 100% rename from searx/static/oscar/less/oscar/results.less rename to searx/static/themes/oscar/less/oscar/results.less diff --git a/searx/static/oscar/less/oscar/search.less b/searx/static/themes/oscar/less/oscar/search.less similarity index 100% rename from searx/static/oscar/less/oscar/search.less rename to searx/static/themes/oscar/less/oscar/search.less diff --git a/searx/static/oscar/package.json b/searx/static/themes/oscar/package.json similarity index 100% rename from searx/static/oscar/package.json rename to searx/static/themes/oscar/package.json diff --git a/searx/templates/courgette/result_templates/default.html b/searx/templates/courgette/result_templates/default.html index 5a8a78198..710b0a8e7 100644 --- a/searx/templates/courgette/result_templates/default.html +++ b/searx/templates/courgette/result_templates/default.html @@ -1,7 +1,7 @@
- {% if result['favicon'] %} - {{result['favicon']}} + {% if "icon_"~result.engine~".ico" in favicons %} + {{result.engine}} {% endif %}
diff --git a/searx/templates/courgette/result_templates/map.html b/searx/templates/courgette/result_templates/map.html index 5a8a78198..4919954e0 100644 --- a/searx/templates/courgette/result_templates/map.html +++ b/searx/templates/courgette/result_templates/map.html @@ -1,7 +1,7 @@
- {% if result['favicon'] %} - {{result['favicon']}} + {% if "icon_"~result.engine~".ico" in favicons %} + {{result.engine}} {% endif %}
diff --git a/searx/templates/courgette/result_templates/videos.html b/searx/templates/courgette/result_templates/videos.html index c8d1a39b6..bb711caab 100644 --- a/searx/templates/courgette/result_templates/videos.html +++ b/searx/templates/courgette/result_templates/videos.html @@ -1,6 +1,6 @@
- {% if result['favicon'] %} - {{result['favicon']}} + {% if "icon_"~result.engine~".ico" in favicons %} + {{result.engine}} {% endif %}

{{ result.title|safe }}

diff --git a/searx/templates/courgette/results.html b/searx/templates/courgette/results.html index 62bef8c90..8b5135c02 100644 --- a/searx/templates/courgette/results.html +++ b/searx/templates/courgette/results.html @@ -43,7 +43,7 @@ {% for result in results %} {% if result['template'] %} - {% include 'courgette/result_templates/'+result['template'] %} + {% include get_result_template('courgette', result['template']) %} {% else %} {% include 'courgette/result_templates/default.html' %} {% endif %} diff --git a/searx/templates/default/result_templates/default.html b/searx/templates/default/result_templates/default.html index c41c58fa1..85882e56a 100644 --- a/searx/templates/default/result_templates/default.html +++ b/searx/templates/default/result_templates/default.html @@ -1,5 +1,5 @@
-

{% if result['favicon'] %}{{result['favicon']}}{% endif %}{{ result.title|safe }}

+

{% if "icon_"~result.engine~".ico" in favicons %}{{result.engine}}{% endif %}{{ result.title|safe }}

{{ result.pretty_url }} cached

{% if result.publishedDate %}

{{ result.publishedDate }}

{% endif %}

{% if result.img_src %}{% endif %}{% if result.content %}{{ result.content|safe }}
{% endif %}

diff --git a/searx/templates/default/result_templates/map.html b/searx/templates/default/result_templates/map.html index dccec7a53..d37c2f374 100644 --- a/searx/templates/default/result_templates/map.html +++ b/searx/templates/default/result_templates/map.html @@ -1,7 +1,7 @@
- {% if result['favicon'] %} - {{result['favicon']}} + {% if "icon_"~result.engine~".ico" in favicons %} + {{result.engine}} {% endif %}
diff --git a/searx/templates/default/result_templates/torrent.html b/searx/templates/default/result_templates/torrent.html index 5925f1313..4c79a0a39 100644 --- a/searx/templates/default/result_templates/torrent.html +++ b/searx/templates/default/result_templates/torrent.html @@ -1,4 +1,7 @@
+ {% if "icon_"~result.engine~".ico" in favicons %} + {{result.engine}} + {% endif %}

{{ result.title|safe }}

{{ result.pretty_url }}

{% if result.content %}

{{ result.content|safe }}

{% endif %} diff --git a/searx/templates/default/result_templates/videos.html b/searx/templates/default/result_templates/videos.html index 0a89a67aa..75f965c80 100644 --- a/searx/templates/default/result_templates/videos.html +++ b/searx/templates/default/result_templates/videos.html @@ -1,5 +1,5 @@
-

{% if result['favicon'] %}{{result['favicon']}}{% endif %}{{ result.title|safe }}

+

{% if "icon_"~result.engine~".ico" in favicons %}{{result.engine}}{% endif %}{{ result.title|safe }}

{% if result.publishedDate %}

{{ result.publishedDate }}

{% endif %} {{ result.title|striptags }}

{{ result.url }}

diff --git a/searx/templates/default/results.html b/searx/templates/default/results.html index 199eb1d96..822960593 100644 --- a/searx/templates/default/results.html +++ b/searx/templates/default/results.html @@ -59,7 +59,7 @@ {% for result in results %} {% if result['template'] %} - {% include 'default/result_templates/'+result['template'] %} + {% include get_result_template('default', result['template']) %} {% else %} {% include 'default/result_templates/default.html' %} {% endif %} diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html index 1dc696341..df604707d 100644 --- a/searx/templates/oscar/macros.html +++ b/searx/templates/oscar/macros.html @@ -6,12 +6,12 @@ {% macro draw_favicon(favicon) -%} - {{ favicon }} + {{ favicon }} {%- endmacro %} -{% macro result_header(result) -%} -

{% if result.favicon %}{{ draw_favicon(result.favicon) }} {% endif %}{{ result.title|safe }}

+{% macro result_header(result, favicons) -%} +

{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|safe }}

{%- endmacro %} diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html index 236834d0a..e608bb04f 100644 --- a/searx/templates/oscar/result_templates/code.html +++ b/searx/templates/oscar/result_templates/code.html @@ -1,6 +1,6 @@ {% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} -{{ result_header(result) }} +{{ result_header(result, favicons) }} {{ result_sub_header(result) }} {% if result.content %}

{{ result.content|safe }}

{% endif %} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html index bc967f01e..0bba4cec3 100644 --- a/searx/templates/oscar/result_templates/default.html +++ b/searx/templates/oscar/result_templates/default.html @@ -1,8 +1,20 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} -{{ result_header(result) }} +{{ result_header(result, favicons) }} {{ result_sub_header(result) }} +{% if result.embedded %} + +{% endif %} + +{% if result.embedded %} +
+{% autoescape false %} + {{ result.embedded }} +{% endautoescape %} +
+{% endif %} + {% if result.content %}

{{ result.content|safe }}

{% endif %} {{ result_footer(result) }} diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html index 69c2e6fff..7ad4e2435 100644 --- a/searx/templates/oscar/result_templates/images.html +++ b/searx/templates/oscar/result_templates/images.html @@ -9,7 +9,7 @@