Move JavaScript code into explicit namespaces

This cleans up the global namespace by explicitly exporting shared values. All html and JavaScript files have been converted to use explicit exports except for client.js and mocha-init.js
This commit is contained in:
Thomas Piccirello
2019-08-11 23:53:20 -07:00
parent b144d3b797
commit 1439bcc864
32 changed files with 6204 additions and 5838 deletions

View File

@@ -30,18 +30,18 @@
}).activate();
window.addEvent('domready', function() {
const uriAction = safeTrim(new URI().getData('action'));
const uriHashes = safeTrim(new URI().getData('hashes'));
const uriCategoryName = safeTrim(new URI().getData('categoryName'));
const uriSavePath = safeTrim(new URI().getData('savePath'));
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData('action'));
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData('hashes'));
const uriCategoryName = window.qBittorrent.Misc.safeTrim(new URI().getData('categoryName'));
const uriSavePath = window.qBittorrent.Misc.safeTrim(new URI().getData('savePath'));
if (uriAction === "edit") {
if (!uriCategoryName)
return false;
$('categoryName').set('disabled', true);
$('categoryName').set('value', escapeHtml(uriCategoryName));
$('savePath').set('value', escapeHtml(uriSavePath));
$('categoryName').set('value', window.qBittorrent.Misc.escapeHtml(uriCategoryName));
$('savePath').set('value', window.qBittorrent.Misc.escapeHtml(uriSavePath));
$('savePath').focus();
}
else {
@@ -90,7 +90,7 @@
}).send();
},
onError: function() {
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=HttpServer] " + escapeHtml(categoryName));
alert("QBT_TR(Unable to create category)QBT_TR[CONTEXT=HttpServer] " + window.qBittorrent.Misc.escapeHtml(categoryName));
}
}).send();
break;