diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index d4c3b5f81d144a0280d095223c9c39309afe93df..75ec390b5906bcfa3623b841da2763d6e80de4e4 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -36,19 +36,20 @@ def response(resp): conversion_rate = float(json.loads(json_resp)['conversion']['converted-amount']) except: return results - answer = '{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'.format( - resp.search_params['amount'], - resp.search_params['from'], - resp.search_params['amount'] * conversion_rate, - resp.search_params['to'], - conversion_rate, - resp.search_params['from_name'], - resp.search_params['to_name'], - ) url = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}'.format( resp.search_params['from'].upper(), resp.search_params['to']) - results.append({'answer': answer, 'url': url}) + source_url = 'https://www.xe.com/currencyconverter/convert/?Amount=1&From={0}&To={1}'.format( + resp.search_params['from'], resp.search_params['to'] + ) + results.append({'template': 'currency.html', + 'amount': resp.search_params['amount'], + 'from': resp.search_params['from'], + 'to': resp.search_params['to'], + 'value': round(resp.search_params['amount'] * conversion_rate, 2), + 'conversion_rate': round(conversion_rate, 2), + 'source_url': source_url, + 'url': url}) return results diff --git a/searx/settings.yml b/searx/settings.yml index b13544b020f149e39b2da3eebe2becda0119feab..6d1c2b5cc29732c2ebea28f8931ae7d78c4eb520 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -341,7 +341,7 @@ engines: engine : currency_convert categories : general shortcut : cc - disabled: True + disabled: False - name : deezer engine : deezer diff --git a/searx/static/themes/etheme/css/etheme.css b/searx/static/themes/etheme/css/etheme.css index 378f41ab18a6d85c195bd78467279b5d1f6b5948..beffd0098121d1a48d79bb96cdc2981a184ecbbc 100644 --- a/searx/static/themes/etheme/css/etheme.css +++ b/searx/static/themes/etheme/css/etheme.css @@ -731,7 +731,7 @@ input:checked + .slider:before { justify-content: space-between; font-size: 14px; padding-bottom: 16px; - padding-top: 16px; + padding-top: 24px; padding-left: 24px; padding-right: 24px; } @@ -996,6 +996,27 @@ input:checked + .slider:before { .result.result-torrent { margin-bottom: 32px; } +.result .currency-value { + font-family: 'Noto Sans'; + color: var(--color-currency-value); + font-style: normal; + font-weight: 700; + font-size: 30px; + padding-bottom: 15px; +} +.result .currency-info { + font-family: 'Noto Sans'; + color: var(--color-currency-value); + font-style: normal; + font-weight: 400; + font-size: 18px; +} +.conversion { + margin-right: 15%; +} +.source { + display: inline-block; +} .result.result-images { display: inline; } diff --git a/searx/static/themes/etheme/css/etheme.min.css b/searx/static/themes/etheme/css/etheme.min.css index be2a65193fea6f9b43266721ee91ba9d50e053e7..82def583a288090ae8f74ec40fa4aa9bacd855e1 100644 Binary files a/searx/static/themes/etheme/css/etheme.min.css and b/searx/static/themes/etheme/css/etheme.min.css differ diff --git a/searx/static/themes/etheme/less/etheme/defs.less b/searx/static/themes/etheme/less/etheme/defs.less index 2ecc3e188accc6b6ff958f84831bdecbd9895680..41faa5a37fe7eb14a20c0c416f4f200e826bfe94 100644 --- a/searx/static/themes/etheme/less/etheme/defs.less +++ b/searx/static/themes/etheme/less/etheme/defs.less @@ -70,6 +70,7 @@ @fontsize_large: 18px; @fontsize_x-large: 22px; @fontsize_xx-large: 22px; +@fontsize_xxx-large: 30px; @spacing_xx-small: 2px; @spacing_x-small: 4px; diff --git a/searx/static/themes/etheme/less/etheme/results.less b/searx/static/themes/etheme/less/etheme/results.less index a35046a1d8230ceb4bc53b922af642ed99768251..6b275167b504246f649468aad669fbb064f1e668 100644 --- a/searx/static/themes/etheme/less/etheme/results.less +++ b/searx/static/themes/etheme/less/etheme/results.less @@ -136,6 +136,30 @@ .result.result-default, .result.result-torrent { margin-bottom: @spacing_xx-large; } + +.result .currency-value { + font-family: 'Noto Sans'; + color: var(--color-currency-value); + font-style: normal; + font-weight: 700; + font-size: @fontsize_xxx-large; + padding-bottom: 15px; +} + +.result .currency-info { + font-family: 'Noto Sans'; + color: var(--color-currency-value); + font-style: normal; + font-weight: 400; + font-size: @fontsize_large; +} +.conversion { + margin-right: 15%; +} +.source { + display: inline-block; +} + .result.result-images { display: inline; diff --git a/searx/templates/etheme/result_templates/currency.html b/searx/templates/etheme/result_templates/currency.html new file mode 100644 index 0000000000000000000000000000000000000000..5897eec01a14edd050a21778a4e0ba991483373f --- /dev/null +++ b/searx/templates/etheme/result_templates/currency.html @@ -0,0 +1,16 @@ +
+ + {% if result.value %}{{ result.value|safe }} {{ result.to|safe}} {% endif %} + +
+ +
+ {% if result.value %} + + 1 {{ result.from|safe }} = {{ result.conversion_rate|safe }} {{ result.to|safe}} + + + {{ _('Source') }}: XE Currency + + {% endif %} +