mirror of
https://github.com/searxng/searxng.git
synced 2025-08-04 10:56:44 +02:00
[mod] replace /translations.js by embedded JSON
In webapp.py, there is a new function "get_translations" lists available translations Close #2064
This commit is contained in:
parent
cb3b379161
commit
6553c79029
17 changed files with 30 additions and 27 deletions
|
@ -25,7 +25,8 @@ window.searx = (function(d) {
|
|||
|
||||
return {
|
||||
autocompleter: script.getAttribute('data-autocompleter') === 'true',
|
||||
method: script.getAttribute('data-method')
|
||||
method: script.getAttribute('data-method'),
|
||||
translations: JSON.parse(script.getAttribute('data-translations'))
|
||||
};
|
||||
})(document);
|
||||
;/**
|
||||
|
@ -302,7 +303,7 @@ $(document).ready(function(){
|
|||
}
|
||||
})
|
||||
.fail(function() {
|
||||
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+could_not_load+"</p>");
|
||||
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+searx.translations.could_not_load+"</p>");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
2
searx/static/themes/oscar/js/searx.min.js
vendored
2
searx/static/themes/oscar/js/searx.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,6 +25,7 @@ window.searx = (function(d) {
|
|||
|
||||
return {
|
||||
autocompleter: script.getAttribute('data-autocompleter') === 'true',
|
||||
method: script.getAttribute('data-method')
|
||||
method: script.getAttribute('data-method'),
|
||||
translations: JSON.parse(script.getAttribute('data-translations'))
|
||||
};
|
||||
})(document);
|
||||
|
|
|
@ -90,7 +90,7 @@ $(document).ready(function(){
|
|||
}
|
||||
})
|
||||
.fail(function() {
|
||||
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+could_not_load+"</p>");
|
||||
$(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+searx.translations.could_not_load+"</p>");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true',
|
||||
infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true',
|
||||
static_path: script.getAttribute('data-static-path'),
|
||||
no_item_found: script.getAttribute('data-no-item-found')
|
||||
translations: JSON.parse(script.getAttribute('data-translations')),
|
||||
}
|
||||
|
||||
// update the css
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*! simple/searx.min.js | 16-03-2021 | */
|
||||
|
||||
(function(t,e){"use strict";var a=e.currentScript||function(){var t=e.getElementsByTagName("script");return t[t.length-1]}();t.searx={touch:"ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch||false,method:a.getAttribute("data-method"),autocompleter:a.getAttribute("data-autocompleter")==="true",search_on_category_select:a.getAttribute("data-search-on-category-select")==="true",infinite_scroll:a.getAttribute("data-infinite-scroll")==="true",static_path:a.getAttribute("data-static-path"),no_item_found:a.getAttribute("data-no-item-found")};e.getElementsByTagName("html")[0].className=t.searx.touch?"js touch":"js"})(window,document);
|
||||
(function(t,e){"use strict";var a=e.currentScript||function(){var t=e.getElementsByTagName("script");return t[t.length-1]}();t.searx={touch:"ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch||false,method:a.getAttribute("data-method"),autocompleter:a.getAttribute("data-autocompleter")==="true",search_on_category_select:a.getAttribute("data-search-on-category-select")==="true",infinite_scroll:a.getAttribute("data-infinite-scroll")==="true",static_path:a.getAttribute("data-static-path"),translations:JSON.parse(a.getAttribute("data-translations"))};e.getElementsByTagName("html")[0].className=t.searx.touch?"js touch":"js"})(window,document);
|
||||
//# sourceMappingURL=searx.head.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","no_item_found","className","window"],"mappings":";;CAiBA,SAAUA,EAAGC,GACT,aAGA,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,cAAef,EAAOU,aAAa,uBAIvCX,EAAEI,qBAAqB,QAAQ,GAAGa,UAAalB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGY,OAAQT","file":"searx.head.min.js"}
|
||||
{"version":3,"sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":";;CAiBA,SAAUA,EAAGC,GACT,aAGA,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX","file":"searx.head.min.js"}
|
|
@ -1529,7 +1529,7 @@ module.exports = AutoComplete;
|
|||
if (searx.autocompleter) {
|
||||
searx.autocomplete = AutoComplete.call(w, {
|
||||
Url: "./autocompleter",
|
||||
EmptyMessage: searx.no_item_found,
|
||||
EmptyMessage: searx.translations.no_item_found,
|
||||
HttpMethod: searx.method,
|
||||
HttpHeaders: {
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
|
|
2
searx/static/themes/simple/js/searx.min.js
vendored
2
searx/static/themes/simple/js/searx.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@
|
|||
search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true',
|
||||
infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true',
|
||||
static_path: script.getAttribute('data-static-path'),
|
||||
no_item_found: script.getAttribute('data-no-item-found')
|
||||
translations: JSON.parse(script.getAttribute('data-translations')),
|
||||
}
|
||||
|
||||
// update the css
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
if (searx.autocompleter) {
|
||||
searx.autocomplete = AutoComplete.call(w, {
|
||||
Url: "./autocompleter",
|
||||
EmptyMessage: searx.no_item_found,
|
||||
EmptyMessage: searx.translations.no_item_found,
|
||||
HttpMethod: searx.method,
|
||||
HttpHeaders: {
|
||||
"Content-type": "application/x-www-form-urlencoded",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue