[WebUI] Fix prettier javascript issue

Prettier removed too many parentheses in asIPAdress and when minifying
the plus unary combined with the plus operator to create an incorrect
increment operator. So skip prettier formatting this secion of code.

Also fix an ECMA5 warning from closure about function scope in FilesTab.
This commit is contained in:
Calum Lind 2018-10-16 10:02:03 +01:00
parent 80178f7310
commit bb93a06fff
2 changed files with 6 additions and 5 deletions

View File

@ -19,11 +19,12 @@ Ext.namespace('Deluge.data');
* @singleton
*/
Deluge.data.SortTypes = {
// prettier-ignore
asIPAddress: function(value) {
var d = value.match(
/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/
);
return ((+d[1] * 256 + +d[2]) * 256 + +d[3]) * 256 + +d[4];
return ((+d[1] * 256 + (+d[2])) * 256 + (+d[3])) * 256 + (+d[4]);
},
asQueuePosition: function(value) {

View File

@ -179,21 +179,21 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
break;
default:
var indexes = {};
function walk(node) {
var walk = function(node) {
if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] =
node.attributes.priority;
}
};
this.getRootNode().cascade(walk);
var nodes = this.getSelectionModel().getSelectedNodes();
Ext.each(nodes, function(node) {
if (!node.isLeaf()) {
function setPriorities(node) {
var setPriorities = function(node) {
if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] =
baseItem.filePriority;
}
};
node.cascade(setPriorities);
} else if (!Ext.isEmpty(node.attributes.fileIndex)) {
indexes[node.attributes.fileIndex] =