diff options
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/cbi.js | 20 | ||||
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index ff198027e3..d962a1d1af 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -94,8 +94,24 @@ function sfh(s) { return (0x100000000 + hash).toString(16).substr(1); } -function _(s) { - return (window.TR && TR[sfh(String(s).trim().replace(/[ \t\n]+/g, ' '))]) || s; +var plural_function = null; + +function trimws(s) { + return String(s).trim().replace(/[ \t\n]+/g, ' '); +} + +function _(s, c) { + return (window.TR && TR[sfh(trimws(s))]) || s; +} + +function N_(n, s, p, c) { + if (plural_function == null && window.TR) + plural_function = new Function('n', (TR['00000000'] || 'plural=(n != 1);') + 'return +plural'); + + var i = plural_function ? plural_function(n) : (n != 1), + k = (c != null ? trimws(c) + '\u0001' : '') + trimws(s) + '\u0002' + i.toString(); + + return (window.TR && TR[sfh(k)]) || (i ? p : s); } diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 08edaa1475..7cf4f4102f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1919,6 +1919,8 @@ var UIFileUpload = UIElement.extend({ button.style.display = ''; this.node.dispatchEvent(new CustomEvent('cbi-fileupload-cancel', {})); + + ev.preventDefault(); }, handleReset: function(ev) { @@ -1962,9 +1964,9 @@ var UIFileUpload = UIElement.extend({ handleFileBrowser: function(ev) { var button = ev.target, browser = button.nextElementSibling, - path = this.stat ? this.stat.path.replace(/\/[^\/]+$/, '') : this.options.root_directory; + path = this.stat ? this.stat.path.replace(/\/[^\/]+$/, '') : (this.options.initial_directory || this.options.root_directory); - if (this.options.root_directory.indexOf(path) != 0) + if (path.indexOf(this.options.root_directory) != 0) path = this.options.root_directory; ev.preventDefault(); |