Browse Source

Use switch statement

adaptive-webui-19844
Thomas Piccirello 7 years ago
parent
commit
6d0cceca83
  1. 50
      src/webui/www/public/scripts/dynamicTable.js

50
src/webui/www/public/scripts/dynamicTable.js

@ -777,23 +777,39 @@ var TorrentsTable = new Class({ @@ -777,23 +777,39 @@ var TorrentsTable = new Class({
this.columns['state_icon'].updateTd = function (td, row) {
var state = this.getRowValue(row);
if ((state === "forcedDL") || (state === "metaDL"))
state = "downloading";
else if (state === "allocating")
state = "stalledDL";
else if (state === "forcedUP")
state = "uploading";
else if (state === "pausedDL")
state = "paused";
else if (state === "pausedUP")
state = "completed";
else if ((state === "queuedDL") || (state === "queuedUP"))
state = "queued";
else if ((state === "checkingDL") || (state === "checkingUP") ||
(state === "queuedForChecking") || (state === "checkingResumeData"))
state = "checking";
else if ((state === "unknown") || (state === "error") || (state === "missingFiles"))
state = "error";
switch (state) {
case "forcedDL":
case "metaDL":
state = "downloading";
break;
case "allocating":
state = "stalledDL";
break;
case "forcedUP":
state = "uploading";
break;
case "pausedDL":
state = "paused";
break;
case "pausedUP":
state = "completed";
break;
case "queuedDL":
case "queuedUP":
state = "queued";
break;
case "checkingDL":
case "checkingUP":
case "queuedForChecking":
case "checkingResumeData":
state = "checking";
break;
case "unknown":
case "error":
case "missingFiles":
state = "error";
break;
}
var img_path = 'images/skin/' + state + '.png';

Loading…
Cancel
Save