webui (js): feature: Added complete support for labels (add/set/reset/display/filter) #648

Changes:
- added list of labels on the lower-left corner
- added support to add/set/reset labels on context menu
- added support to filter torrents by label
This commit is contained in:
Felipe Barriga Richards 2015-02-14 18:19:54 -03:00 committed by ngosang
parent 76d93c23b7
commit 4ae2f6c33b
9 changed files with 272 additions and 23 deletions

View file

@ -309,6 +309,60 @@ initializeWindows = function() {
}
};
newLabelFN = function () {
var h = myTable.selectedIds();
if (h.length) {
new MochaUI.Window({
id: 'newLabelPage',
title: "QBT_TR(Torrent Label)QBT_TR",
loadMethod: 'iframe',
contentURL: 'newlabel.html?hashes=' + h.join(','),
scrollbars: false,
resizable: false,
maximizable: false,
paddingVertical: 0,
paddingHorizontal: 0,
width: 424,
height: 150
});
}
};
resetLabelFN = function () {
var h = myTable.selectedIds();
var label_json = JSON.stringify({value: ''});
if (h.length) {
h.each(function (hash, index) {
new Request({
url: 'command/setLabel',
method: 'post',
data: {
hash: hash,
label_obj: label_json
}
}).send();
});
}
};
updateLabelFN = function (label_hash) {
var label = label_list[label_hash].name;
var label_json = JSON.stringify({value: label});
var h = myTable.selectedIds();
if (h.length) {
h.each(function (hash, index) {
new Request({
url: 'command/setLabel',
method: 'post',
data: {
hash: hash,
label_obj: label_json
}
}).send();
});
}
};
['pauseAll', 'resumeAll'].each(function(item) {
addClickEvent(item, function(e) {
new Event(e).stop();