summaryrefslogtreecommitdiffstats
path: root/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js')
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js79
1 files changed, 33 insertions, 46 deletions
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
index 40086b3..e68fce3 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js
@@ -25,7 +25,7 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
border: false,
watchdirs: {},
- initComponent: function() {
+ initComponent: function () {
Deluge.ux.preferences.AutoAddPage.superclass.initComponent.call(this);
var autoAdd = this;
@@ -41,23 +41,22 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
sortable: true,
dataIndex: 'enabled',
tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', {
- getCheckbox: function(checked, selected) {
- Deluge.ux.AutoAdd.onClickFunctions[
- selected.id
- ] = function() {
- if (selected.enabled) {
- deluge.client.autoadd.disable_watchdir(
- selected.id
- );
- checked = false;
- } else {
- deluge.client.autoadd.enable_watchdir(
- selected.id
- );
- checked = true;
- }
- autoAdd.updateWatchDirs();
- };
+ getCheckbox: function (checked, selected) {
+ Deluge.ux.AutoAdd.onClickFunctions[selected.id] =
+ function () {
+ if (selected.enabled) {
+ deluge.client.autoadd.disable_watchdir(
+ selected.id
+ );
+ checked = false;
+ } else {
+ deluge.client.autoadd.enable_watchdir(
+ selected.id
+ );
+ checked = true;
+ }
+ autoAdd.updateWatchDirs();
+ };
return (
'<input id="enabled-' +
selected.id +
@@ -122,9 +121,9 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.on('show', this.onPreferencesShow, this);
},
- updateWatchDirs: function() {
+ updateWatchDirs: function () {
deluge.client.autoadd.get_watchdirs({
- success: function(watchdirs) {
+ success: function (watchdirs) {
this.watchdirs = watchdirs;
var watchdirsArray = [];
for (var id in watchdirs) {
@@ -145,12 +144,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
});
},
- onAddClick: function() {
+ onAddClick: function () {
if (!this.addWin) {
this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow();
this.addWin.on(
'watchdiradd',
- function() {
+ function () {
this.updateWatchDirs();
},
this
@@ -159,12 +158,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.addWin.show();
},
- onEditClick: function() {
+ onEditClick: function () {
if (!this.editWin) {
this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow();
this.editWin.on(
'watchdiredit',
- function() {
+ function () {
this.updateWatchDirs();
},
this
@@ -174,39 +173,27 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.editWin.show(id, this.watchdirs[id]);
},
- onPreferencesShow: function() {
+ onPreferencesShow: function () {
this.updateWatchDirs();
},
- onRemoveClick: function() {
+ onRemoveClick: function () {
var record = this.list.getSelectedRecords()[0];
deluge.client.autoadd.remove(record.id, {
- success: function() {
+ success: function () {
this.updateWatchDirs();
},
scope: this,
});
},
- onSelectionChange: function(dv, selections) {
+ onSelectionChange: function (dv, selections) {
if (selections.length) {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .enable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .enable();
+ this.panel.getBottomToolbar().items.get(1).enable();
+ this.panel.getBottomToolbar().items.get(3).enable();
} else {
- this.panel
- .getBottomToolbar()
- .items.get(1)
- .disable();
- this.panel
- .getBottomToolbar()
- .items.get(3)
- .disable();
+ this.panel.getBottomToolbar().items.get(1).disable();
+ this.panel.getBottomToolbar().items.get(3).disable();
}
},
});
@@ -218,12 +205,12 @@ Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, {
prefsPage: null,
},
- onDisable: function() {
+ onDisable: function () {
deluge.preferences.removePage(Deluge.plugins.AutoAddPlugin.prefsPage);
Deluge.plugins.AutoAddPlugin.prefsPage = null;
},
- onEnable: function() {
+ onEnable: function () {
/*
* Called for each of the JavaScript files.
* This will prevent adding unnecessary tabs to the preferences window.