summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/Label/deluge_label/data/label.js
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins/Label/deluge_label/data/label.js')
-rw-r--r--deluge/plugins/Label/deluge_label/data/label.js73
1 files changed, 35 insertions, 38 deletions
diff --git a/deluge/plugins/Label/deluge_label/data/label.js b/deluge/plugins/Label/deluge_label/data/label.js
index ba7a7ac1d..b84ea6b69 100644
--- a/deluge/plugins/Label/deluge_label/data/label.js
+++ b/deluge/plugins/Label/deluge_label/data/label.js
@@ -20,7 +20,7 @@ Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, {
layout: 'fit',
border: false,
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.LabelPage.superclass.initComponent.call(this);
fieldset = this.add({
xtype: 'fieldset',
@@ -56,7 +56,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
height: 100,
closeAction: 'hide',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.AddLabelWindow.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this);
@@ -76,7 +76,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
width: 220,
listeners: {
specialkey: {
- fn: function(field, e) {
+ fn: function (field, e) {
if (e.getKey() == 13) this.onOkClick();
},
scope: this,
@@ -87,14 +87,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
});
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
- onOkClick: function() {
+ onOkClick: function () {
var label = this.form.getForm().getValues().name;
deluge.client.label.add(label, {
- success: function() {
+ success: function () {
deluge.ui.update();
this.fireEvent('labeladded', label);
},
@@ -103,17 +103,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
this.hide();
},
- onHide: function(comp) {
+ onHide: function (comp) {
Deluge.ux.AddLabelWindow.superclass.onHide.call(this, comp);
this.form.getForm().reset();
},
- onShow: function(comp) {
+ onShow: function (comp) {
Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp);
- this.form
- .getForm()
- .findField('name')
- .focus(false, 150);
+ this.form.getForm().findField('name').focus(false, 150);
},
});
@@ -127,7 +124,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
height: 240,
closeAction: 'hide',
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this);
this.addButton(_('Ok'), this.onOkClick, this);
@@ -385,18 +382,18 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
});
},
- getLabelOptions: function() {
+ getLabelOptions: function () {
deluge.client.label.get_options(this.label, {
success: this.gotOptions,
scope: this,
});
},
- gotOptions: function(options) {
+ gotOptions: function (options) {
this.form.getForm().setValues(options);
},
- show: function(label) {
+ show: function (label) {
Deluge.ux.LabelOptionsWindow.superclass.show.call(this);
this.label = label;
this.setTitle(_('Label Options') + ': ' + this.label);
@@ -404,11 +401,11 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
this.getLabelOptions();
},
- onCancelClick: function() {
+ onCancelClick: function () {
this.hide();
},
- onOkClick: function() {
+ onOkClick: function () {
var values = this.form.getForm().getFieldValues();
if (values['auto_add_trackers']) {
values['auto_add_trackers'] = values['auto_add_trackers'].split(
@@ -419,9 +416,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
this.hide();
},
- onFieldChecked: function(field, checked) {
+ onFieldChecked: function (field, checked) {
var fs = field.ownerCt.nextSibling();
- fs.items.each(function(field) {
+ fs.items.each(function (field) {
field.setDisabled(!checked);
});
},
@@ -436,7 +433,7 @@ Ext.ns('Deluge.plugins');
Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
name: 'Label',
- createMenu: function() {
+ createMenu: function () {
this.labelMenu = new Ext.menu.Menu({
items: [
{
@@ -462,7 +459,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
});
},
- setFilter: function(filter) {
+ setFilter: function (filter) {
filter.show_zero = true;
filter.list.on('contextmenu', this.onLabelContextMenu, this);
@@ -470,7 +467,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.filter = filter;
},
- updateTorrentMenu: function(states) {
+ updateTorrentMenu: function (states) {
this.torrentMenu.removeAll(true);
this.torrentMenu.addMenuItem({
text: _('No Label'),
@@ -489,7 +486,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
}
},
- onDisable: function() {
+ onDisable: function () {
deluge.sidebar.un('filtercreate', this.onFilterCreate);
deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate);
delete Deluge.FilterPanel.templates.label;
@@ -499,7 +496,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
deluge.preferences.removePage(this.prefsPage);
},
- onEnable: function() {
+ onEnable: function () {
this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.LabelPage()
);
@@ -539,17 +536,17 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.registerTorrentStatus('label', _('Label'));
},
- onAfterFilterCreate: function(sidebar, filter) {
+ onAfterFilterCreate: function (sidebar, filter) {
if (filter.filter != 'label') return;
this.updateTorrentMenu(filter.getStates());
},
- onFilterCreate: function(sidebar, filter) {
+ onFilterCreate: function (sidebar, filter) {
if (filter.filter != 'label') return;
this.setFilter(filter);
},
- onLabelAddClick: function() {
+ onLabelAddClick: function () {
if (!this.addWindow) {
this.addWindow = new Deluge.ux.AddLabelWindow();
this.addWindow.on('labeladded', this.onLabelAdded, this);
@@ -557,7 +554,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.addWindow.show();
},
- onLabelAdded: function(label) {
+ onLabelAdded: function (label) {
var filter = deluge.sidebar.getFilter('label');
var states = filter.getStates();
var statesArray = [];
@@ -582,7 +579,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.updateTorrentMenu(states);
},
- onLabelContextMenu: function(dv, i, node, e) {
+ onLabelContextMenu: function (dv, i, node, e) {
e.preventDefault();
if (!this.labelMenu) this.createMenu();
var r = dv.getRecord(node).get('filter');
@@ -597,7 +594,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.labelMenu.showAt(e.getXY());
},
- onLabelHeaderContextMenu: function(e, t) {
+ onLabelHeaderContextMenu: function (e, t) {
e.preventDefault();
if (!this.labelMenu) this.createMenu();
this.labelMenu.items.get(1).setDisabled(true);
@@ -605,18 +602,18 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
this.labelMenu.showAt(e.getXY());
},
- onLabelOptionsClick: function() {
+ onLabelOptionsClick: function () {
if (!this.labelOpts)
this.labelOpts = new Deluge.ux.LabelOptionsWindow();
this.labelOpts.show(this.filter.getState());
},
- onLabelRemoveClick: function() {
+ onLabelRemoveClick: function () {
var state = this.filter.getState();
deluge.client.label.remove(state, {
- success: function() {
+ success: function () {
deluge.ui.update();
- this.torrentMenu.items.each(function(item) {
+ this.torrentMenu.items.each(function (item) {
if (item.text != state) return;
this.torrentMenu.remove(item);
var i = item;
@@ -626,12 +623,12 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
});
},
- onTorrentMenuClick: function(item, e) {
+ onTorrentMenuClick: function (item, e) {
var ids = deluge.torrents.getSelectedIds();
- Ext.each(ids, function(id, i) {
+ Ext.each(ids, function (id, i) {
if (ids.length == i + 1) {
deluge.client.label.set_torrent(id, item.label, {
- success: function() {
+ success: function () {
deluge.ui.update();
},
});