diff options
Diffstat (limited to 'deluge/ui/web/js/deluge-all')
55 files changed, 496 insertions, 531 deletions
diff --git a/deluge/ui/web/js/deluge-all/AboutWindow.js b/deluge/ui/web/js/deluge-all/AboutWindow.js index 5376d05c0..15fede9b8 100644 --- a/deluge/ui/web/js/deluge-all/AboutWindow.js +++ b/deluge/ui/web/js/deluge-all/AboutWindow.js @@ -28,16 +28,16 @@ Deluge.about.AboutWindow = Ext.extend(Ext.Window, { }, buttonAlign: 'center', - initComponent: function() { + initComponent: function () { Deluge.about.AboutWindow.superclass.initComponent.call(this); this.addEvents({ build_ready: true, }); var self = this; - var libtorrent = function() { + var libtorrent = function () { deluge.client.core.get_libtorrent_version({ - success: function(lt_version) { + success: function (lt_version) { comment += '<br/>' + _('libtorrent:') + ' ' + lt_version; Ext.getCmp('about_comment').setText(comment, false); self.fireEvent('build_ready'); @@ -57,10 +57,10 @@ Deluge.about.AboutWindow = Ext.extend(Ext.Window, { client_version + '<br/>'; deluge.client.web.connected({ - success: function(connected) { + success: function (connected) { if (connected) { deluge.client.daemon.get_version({ - success: function(server_version) { + success: function (server_version) { comment += _('Server:') + ' ' + server_version + '<br/>'; libtorrent(); @@ -70,7 +70,7 @@ Deluge.about.AboutWindow = Ext.extend(Ext.Window, { this.fireEvent('build_ready'); } }, - failure: function() { + failure: function () { this.fireEvent('build_ready'); }, scope: this, @@ -111,19 +111,19 @@ Deluge.about.AboutWindow = Ext.extend(Ext.Window, { this.addButton(_('Close'), this.onCloseClick, this); }, - show: function() { - this.on('build_ready', function() { + show: function () { + this.on('build_ready', function () { Deluge.about.AboutWindow.superclass.show.call(this); }); }, - onCloseClick: function() { + onCloseClick: function () { this.close(); }, }); Ext.namespace('Deluge'); -Deluge.About = function() { +Deluge.About = function () { new Deluge.about.AboutWindow().show(); }; diff --git a/deluge/ui/web/js/deluge-all/AddConnectionWindow.js b/deluge/ui/web/js/deluge-all/AddConnectionWindow.js index 6d2637029..4d821f247 100644 --- a/deluge/ui/web/js/deluge-all/AddConnectionWindow.js +++ b/deluge/ui/web/js/deluge-all/AddConnectionWindow.js @@ -24,7 +24,7 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { bodyStyle: 'padding: 10px 5px;', closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.AddConnectionWindow.superclass.initComponent.call(this); this.addEvents('hostadded'); @@ -80,7 +80,7 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { }); }, - onAddClick: function() { + onAddClick: function () { var values = this.form.getForm().getValues(); deluge.client.web.add_host( values.host, @@ -88,7 +88,7 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { values.username, values.password, { - success: function(result) { + success: function (result) { if (!result[0]) { Ext.MessageBox.show({ title: _('Error'), @@ -111,7 +111,7 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { ); }, - onHide: function() { + onHide: function () { this.form.getForm().reset(); }, }); diff --git a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js index c9c835d47..8fbe0b221 100644 --- a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js +++ b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js @@ -12,7 +12,7 @@ Ext.ns('Deluge'); // Custom VType validator for tracker urls var trackerUrlTest = /(((^https?)|(^udp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; Ext.apply(Ext.form.VTypes, { - trackerUrl: function(val, field) { + trackerUrl: function (val, field) { return trackerUrlTest.test(val); }, trackerUrlText: 'Not a valid tracker url', @@ -36,7 +36,7 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { closeAction: 'hide', iconCls: 'x-deluge-edit-trackers', - initComponent: function() { + initComponent: function () { Deluge.AddTrackerWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -59,17 +59,14 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { }); }, - onAddClick: function() { - var trackers = this.form - .getForm() - .findField('trackers') - .getValue(); + onAddClick: function () { + var trackers = this.form.getForm().findField('trackers').getValue(); trackers = trackers.split('\n'); var cleaned = []; Ext.each( trackers, - function(tracker) { + function (tracker) { if (Ext.form.VTypes.trackerUrl(tracker)) { cleaned.push(tracker); } @@ -78,17 +75,11 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { ); this.fireEvent('add', cleaned); this.hide(); - this.form - .getForm() - .findField('trackers') - .setValue(''); + this.form.getForm().findField('trackers').setValue(''); }, - onCancelClick: function() { - this.form - .getForm() - .findField('trackers') - .setValue(''); + onCancelClick: function () { + this.form.getForm().findField('trackers').setValue(''); this.hide(); }, }); diff --git a/deluge/ui/web/js/deluge-all/Client.js b/deluge/ui/web/js/deluge-all/Client.js index bcabbae5f..a06e863c0 100644 --- a/deluge/ui/web/js/deluge-all/Client.js +++ b/deluge/ui/web/js/deluge-all/Client.js @@ -31,7 +31,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { * Fires when the client has retrieved the list of methods from the server. * @param {Ext.ux.util.RpcClient} this */ - constructor: function(config) { + constructor: function (config) { Ext.ux.util.RpcClient.superclass.constructor.call(this, config); this._url = config.url || null; this._id = 0; @@ -44,14 +44,14 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { this.reloadMethods(); }, - reloadMethods: function() { + reloadMethods: function () { this._execute('system.listMethods', { success: this._setMethods, scope: this, }); }, - _execute: function(method, options) { + _execute: function (method, options) { options = options || {}; options.params = options.params || []; options.id = this._id; @@ -74,7 +74,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { }); }, - _onFailure: function(response, requestOptions) { + _onFailure: function (response, requestOptions) { var options = requestOptions.options; errorObj = { id: options.id, @@ -100,7 +100,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { } }, - _onSuccess: function(response, requestOptions) { + _onSuccess: function (response, requestOptions) { var responseObj = Ext.decode(response.responseText); var options = requestOptions.options; if (responseObj.error) { @@ -138,9 +138,9 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { } }, - _parseArgs: function(args) { + _parseArgs: function (args) { var params = []; - Ext.each(args, function(arg) { + Ext.each(args, function (arg) { params.push(arg); }); @@ -149,7 +149,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { var keys = Ext.keys(options), isOption = false; - Ext.each(this._optionKeys, function(key) { + Ext.each(this._optionKeys, function (key) { if (keys.indexOf(key) > -1) isOption = true; }); @@ -165,15 +165,15 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { return options; }, - _setMethods: function(methods) { + _setMethods: function (methods) { var components = {}, self = this; - Ext.each(methods, function(method) { + Ext.each(methods, function (method) { var parts = method.split('.'); var component = components[parts[0]] || {}; - var fn = function() { + var fn = function () { var options = self._parseArgs(arguments); return self._execute(method, options); }; @@ -186,7 +186,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { } Ext.each( this._components, - function(component) { + function (component) { if (!component in components) { delete this[component]; } diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index 001e46bb1..5261726fb 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -21,7 +21,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { title: _('Connection Manager'), iconCls: 'x-deluge-connect-window-icon', - initComponent: function() { + initComponent: function () { Deluge.ConnectionManager.superclass.initComponent.call(this); this.on('hide', this.onHide, this); this.on('show', this.onShow, this); @@ -133,9 +133,9 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { * Check to see if the the web interface is currently connected * to a Deluge Daemon and show the Connection Manager if not. */ - checkConnected: function() { + checkConnected: function () { deluge.client.web.connected({ - success: function(connected) { + success: function (connected) { if (connected) { deluge.events.fire('connect'); } else { @@ -146,7 +146,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }); }, - disconnect: function(show) { + disconnect: function (show) { deluge.events.fire('disconnect'); if (show) { if (this.isVisible()) return; @@ -154,15 +154,15 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { } }, - loadHosts: function() { + loadHosts: function () { deluge.client.web.get_hosts({ success: this.onGetHosts, scope: this, }); }, - update: function() { - this.list.getStore().each(function(r) { + update: function () { + this.list.getStore().each(function (r) { deluge.client.web.get_host_status(r.id, { success: this.onGetHostStatus, scope: this, @@ -175,7 +175,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { * passed in records host state. * @param {Ext.data.Record} record The hosts record to update the UI for */ - updateButtons: function(record) { + updateButtons: function (record) { var button = this.buttons[1], status = record.get('status'); @@ -209,7 +209,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onAddClick: function(button, e) { + onAddClick: function (button, e) { if (!this.addWindow) { this.addWindow = new Deluge.AddConnectionWindow(); this.addWindow.on('hostadded', this.onHostChange, this); @@ -218,7 +218,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onEditClick: function(button, e) { + onEditClick: function (button, e) { var connection = this.list.getSelectedRecords()[0]; if (!connection) return; @@ -230,24 +230,24 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onHostChange: function() { + onHostChange: function () { this.loadHosts(); }, // private - onClose: function(e) { + onClose: function (e) { this.hide(); }, // private - onConnect: function(e) { + onConnect: function (e) { var selected = this.list.getSelectedRecords()[0]; if (!selected) return; var me = this; - var disconnect = function() { + var disconnect = function () { deluge.client.web.disconnect({ - success: function(result) { + success: function (result) { this.update(this); deluge.events.fire('disconnect'); }, @@ -268,11 +268,11 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { var id = selected.id; deluge.client.web.connect(id, { - success: function(methods) { + success: function (methods) { deluge.client.reloadMethods(); deluge.client.on( 'connected', - function(e) { + function (e) { deluge.events.fire('connect'); }, this, @@ -285,11 +285,11 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onGetHosts: function(hosts) { + onGetHosts: function (hosts) { this.list.getStore().loadData(hosts); Ext.each( hosts, - function(host) { + function (host) { deluge.client.web.get_host_status(host[0], { success: this.onGetHostStatus, scope: this, @@ -300,7 +300,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onGetHostStatus: function(host) { + onGetHostStatus: function (host) { var record = this.list.getStore().getById(host[0]); record.set('status', host[1]); record.set('version', host[2]); @@ -311,19 +311,19 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onHide: function() { + onHide: function () { if (this.running) window.clearInterval(this.running); }, // private - onLogin: function() { + onLogin: function () { if (deluge.config.first_login) { Ext.MessageBox.confirm( _('Change Default Password'), _( 'We recommend changing the default password.<br><br>Would you like to change it now?' ), - function(res) { + function (res) { this.checkConnected(); if (res == 'yes') { deluge.preferences.show(); @@ -339,7 +339,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onLogout: function() { + onLogout: function () { this.disconnect(); if (!this.hidden && this.rendered) { this.hide(); @@ -347,12 +347,12 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onRemoveClick: function(button) { + onRemoveClick: function (button) { var connection = this.list.getSelectedRecords()[0]; if (!connection) return; deluge.client.web.remove_host(connection.id, { - success: function(result) { + success: function (result) { if (!result) { Ext.MessageBox.show({ title: _('Error'), @@ -371,7 +371,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onSelectionChanged: function(list, selections) { + onSelectionChanged: function (list, selections) { if (selections[0]) { this.editHostButton.enable(); this.removeHostButton.enable(); @@ -387,7 +387,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { // FIXME: Find out why this is being fired twice // private - onShow: function() { + onShow: function () { if (!this.addHostButton) { var bbar = this.panel.getBottomToolbar(); this.addHostButton = bbar.items.get('cm-add'); @@ -401,7 +401,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, // private - onStopClick: function(button, e) { + onStopClick: function (button, e) { var connection = this.list.getSelectedRecords()[0]; if (!connection) return; @@ -411,7 +411,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { } else { // This means we need to stop the daemon deluge.client.web.stop_daemon(connection.id, { - success: function(result) { + success: function (result) { if (!result[0]) { Ext.MessageBox.show({ title: _('Error'), diff --git a/deluge/ui/web/js/deluge-all/Deluge.js b/deluge/ui/web/js/deluge-all/Deluge.js index 31b9947cc..86cae6d89 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.js +++ b/deluge/ui/web/js/deluge-all/Deluge.js @@ -25,21 +25,19 @@ Ext.state.Manager.setProvider( // Add some additional functions to ext and setup some of the // configurable parameters Ext.apply(Ext, { - escapeHTML: function(text) { - text = String(text) - .replace('<', '<') - .replace('>', '>'); + escapeHTML: function (text) { + text = String(text).replace('<', '<').replace('>', '>'); return text.replace('&', '&'); }, - isObjectEmpty: function(obj) { + isObjectEmpty: function (obj) { for (var i in obj) { return false; } return true; }, - areObjectsEqual: function(obj1, obj2) { + areObjectsEqual: function (obj1, obj2) { var equal = true; if (!obj1 || !obj2) return false; for (var i in obj1) { @@ -50,7 +48,7 @@ Ext.apply(Ext, { return equal; }, - keys: function(obj) { + keys: function (obj) { var keys = []; for (var i in obj) if (obj.hasOwnProperty(i)) { @@ -59,7 +57,7 @@ Ext.apply(Ext, { return keys; }, - values: function(obj) { + values: function (obj) { var values = []; for (var i in obj) { if (obj.hasOwnProperty(i)) { @@ -69,7 +67,7 @@ Ext.apply(Ext, { return values; }, - splat: function(obj) { + splat: function (obj) { var type = Ext.type(obj); return type ? (type != 'array' ? [obj] : obj) : []; }, @@ -106,7 +104,7 @@ Ext.apply(Deluge, { * @param {String} text The text to display on the bar * @param {Number} modified Amount to subtract from the width allowing for fixes */ - progressBar: function(progress, width, text, modifier) { + progressBar: function (progress, width, text, modifier) { modifier = Ext.value(modifier, 10); var progressWidth = ((width / 100.0) * progress).toFixed(0); var barWidth = progressWidth - 1; @@ -125,7 +123,7 @@ Ext.apply(Deluge, { * Constructs a new instance of the specified plugin. * @param {String} name The plugin name to create */ - createPlugin: function(name) { + createPlugin: function (name) { return new Deluge.pluginStore[name](); }, @@ -133,7 +131,7 @@ Ext.apply(Deluge, { * Check to see if a plugin has been registered. * @param {String} name The plugin name to check */ - hasPlugin: function(name) { + hasPlugin: function (name) { return Deluge.pluginStore[name] ? true : false; }, @@ -142,7 +140,7 @@ Ext.apply(Deluge, { * @param {String} name The plugin name to register * @param {Plugin} plugin The plugin to register */ - registerPlugin: function(name, plugin) { + registerPlugin: function (name, plugin) { Deluge.pluginStore[name] = plugin; }, }); diff --git a/deluge/ui/web/js/deluge-all/EditConnectionWindow.js b/deluge/ui/web/js/deluge-all/EditConnectionWindow.js index 63bd3054d..bfeb38f9d 100644 --- a/deluge/ui/web/js/deluge-all/EditConnectionWindow.js +++ b/deluge/ui/web/js/deluge-all/EditConnectionWindow.js @@ -24,7 +24,7 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { bodyStyle: 'padding: 10px 5px;', closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.EditConnectionWindow.superclass.initComponent.call(this); this.addEvents('hostedited'); @@ -80,17 +80,11 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { }); }, - show: function(connection) { + show: function (connection) { Deluge.EditConnectionWindow.superclass.show.call(this); - this.form - .getForm() - .findField('host') - .setValue(connection.get('host')); - this.form - .getForm() - .findField('port') - .setValue(connection.get('port')); + this.form.getForm().findField('host').setValue(connection.get('host')); + this.form.getForm().findField('port').setValue(connection.get('port')); this.form .getForm() .findField('username') @@ -98,7 +92,7 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { this.host_id = connection.id; }, - onEditClick: function() { + onEditClick: function () { var values = this.form.getForm().getValues(); deluge.client.web.edit_host( this.host_id, @@ -107,7 +101,7 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { values.username, values.password, { - success: function(result) { + success: function (result) { if (!result) { console.log(result); Ext.MessageBox.show({ @@ -128,7 +122,7 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { ); }, - onHide: function() { + onHide: function () { this.form.getForm().reset(); }, }); diff --git a/deluge/ui/web/js/deluge-all/EditTrackerWindow.js b/deluge/ui/web/js/deluge-all/EditTrackerWindow.js index 82bc32c51..646b8de78 100644 --- a/deluge/ui/web/js/deluge-all/EditTrackerWindow.js +++ b/deluge/ui/web/js/deluge-all/EditTrackerWindow.js @@ -27,7 +27,7 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { closeAction: 'hide', iconCls: 'x-deluge-edit-trackers', - initComponent: function() { + initComponent: function () { Deluge.EditTrackerWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -50,32 +50,23 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { }); }, - show: function(record) { + show: function (record) { Deluge.EditTrackerWindow.superclass.show.call(this); this.record = record; - this.form - .getForm() - .findField('tracker') - .setValue(record.data['url']); + this.form.getForm().findField('tracker').setValue(record.data['url']); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - onHide: function() { - this.form - .getForm() - .findField('tracker') - .setValue(''); + onHide: function () { + this.form.getForm().findField('tracker').setValue(''); }, - onSaveClick: function() { - var url = this.form - .getForm() - .findField('tracker') - .getValue(); + onSaveClick: function () { + var url = this.form.getForm().findField('tracker').getValue(); this.record.set('url', url); this.record.commit(); this.hide(); diff --git a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js index 5d2d9e8e1..f6733aaa6 100644 --- a/deluge/ui/web/js/deluge-all/EditTrackersWindow.js +++ b/deluge/ui/web/js/deluge-all/EditTrackersWindow.js @@ -28,7 +28,7 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { closeAction: 'hide', iconCls: 'x-deluge-edit-trackers', - initComponent: function() { + initComponent: function () { Deluge.EditTrackersWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -111,18 +111,18 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { }); }, - onAddClick: function() { + onAddClick: function () { this.addWindow.show(); }, - onAddTrackers: function(trackers) { + onAddTrackers: function (trackers) { var store = this.list.getStore(); Ext.each( trackers, - function(tracker) { + function (tracker) { var duplicate = false, heightestTier = -1; - store.each(function(record) { + store.each(function (record) { if (record.get('tier') > heightestTier) { heightestTier = record.get('tier'); } @@ -143,27 +143,27 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { ); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - onEditClick: function() { + onEditClick: function () { var selected = this.list.getSelectedRecords()[0]; if (!selected) return; this.editWindow.show(selected); }, - onHide: function() { + onHide: function () { this.list.getStore().removeAll(); }, - onListNodeDblClicked: function(list, index, node, e) { + onListNodeDblClicked: function (list, index, node, e) { this.editWindow.show(this.list.getRecord(node)); }, - onOkClick: function() { + onOkClick: function () { var trackers = []; - this.list.getStore().each(function(record) { + this.list.getStore().each(function (record) { trackers.push({ tier: record.get('tier'), url: record.get('url'), @@ -178,34 +178,28 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { this.hide(); }, - onRemoveClick: function() { + onRemoveClick: function () { // Remove from the grid var selected = this.list.getSelectedRecords()[0]; if (!selected) return; this.list.getStore().remove(selected); }, - onRequestComplete: function(status) { + onRequestComplete: function (status) { this.list.getStore().loadData(status); this.list.getStore().sort('tier', 'ASC'); }, - onSaveFail: function() {}, + onSaveFail: function () {}, - onSelect: function(list) { + onSelect: function (list) { if (list.getSelectionCount()) { - this.panel - .getBottomToolbar() - .items.get(4) - .enable(); + this.panel.getBottomToolbar().items.get(4).enable(); } }, - onShow: function() { - this.panel - .getBottomToolbar() - .items.get(4) - .disable(); + onShow: function () { + this.panel.getBottomToolbar().items.get(4).disable(); var r = deluge.torrents.getSelected(); this.torrentId = r.id; deluge.client.core.get_torrent_status(r.id, ['trackers'], { @@ -214,7 +208,7 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { }); }, - onDownClick: function() { + onDownClick: function () { var r = this.list.getSelectedRecords()[0]; if (!r) return; @@ -225,7 +219,7 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { this.list.select(r.store.indexOf(r)); }, - onUpClick: function() { + onUpClick: function () { var r = this.list.getSelectedRecords()[0]; if (!r) return; diff --git a/deluge/ui/web/js/deluge-all/EventsManager.js b/deluge/ui/web/js/deluge-all/EventsManager.js index 1714339ad..89d8980fb 100644 --- a/deluge/ui/web/js/deluge-all/EventsManager.js +++ b/deluge/ui/web/js/deluge-all/EventsManager.js @@ -15,7 +15,7 @@ * Class for holding global events that occur within the UI. */ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { - constructor: function() { + constructor: function () { this.toRegister = []; this.on('login', this.onLogin, this); Deluge.EventsManager.superclass.constructor.call(this); @@ -24,7 +24,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { /** * Append an event handler to this object. */ - addListener: function(eventName, fn, scope, o) { + addListener: function (eventName, fn, scope, o) { this.addEvents(eventName); if (/[A-Z]/.test(eventName.substring(0, 1))) { if (!deluge.client) { @@ -42,7 +42,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { ); }, - getEvents: function() { + getEvents: function () { deluge.client.web.get_events({ success: this.onGetEventsSuccess, failure: this.onGetEventsFailure, @@ -53,8 +53,8 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { /** * Starts the EventsManagerManager checking for events. */ - start: function() { - Ext.each(this.toRegister, function(eventName) { + start: function () { + Ext.each(this.toRegister, function (eventName) { deluge.client.web.register_event_listener(eventName); }); this.running = true; @@ -65,21 +65,21 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { /** * Stops the EventsManagerManager checking for events. */ - stop: function() { + stop: function () { this.running = false; }, // private - onLogin: function() { + onLogin: function () { this.start(); }, - onGetEventsSuccess: function(events) { + onGetEventsSuccess: function (events) { if (!this.running) return; if (events) { Ext.each( events, - function(event) { + function (event) { var name = event[0], args = event[1]; args.splice(0, 0, name); @@ -92,7 +92,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { }, // private - onGetEventsFailure: function(result, error) { + onGetEventsFailure: function (result, error) { // the request timed out or we had a communication failure if (!this.running) return; if (!error.isTimeout && this.errorCount++ >= 3) { diff --git a/deluge/ui/web/js/deluge-all/FileBrowser.js b/deluge/ui/web/js/deluge-all/FileBrowser.js index 72962a6b7..2afe1b1e6 100644 --- a/deluge/ui/web/js/deluge-all/FileBrowser.js +++ b/deluge/ui/web/js/deluge-all/FileBrowser.js @@ -15,7 +15,7 @@ Deluge.FileBrowser = Ext.extend(Ext.Window, { width: 500, height: 400, - initComponent: function() { + initComponent: function () { Deluge.FileBrowser.superclass.initComponent.call(this); this.add({ diff --git a/deluge/ui/web/js/deluge-all/FilterPanel.js b/deluge/ui/web/js/deluge-all/FilterPanel.js index 2362dbb4c..b6e5ec5ca 100644 --- a/deluge/ui/web/js/deluge-all/FilterPanel.js +++ b/deluge/ui/web/js/deluge-all/FilterPanel.js @@ -20,7 +20,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { show_zero: null, - initComponent: function() { + initComponent: function () { Deluge.FilterPanel.superclass.initComponent.call(this); this.filterType = this.initialConfig.filter; var title = ''; @@ -36,7 +36,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { (title = this.filterType.replace('_', ' ')), (parts = title.split(' ')), (title = ''); - Ext.each(parts, function(p) { + Ext.each(parts, function (p) { fl = p.substring(0, 1).toUpperCase(); title += fl + p.substring(1) + ' '; }); @@ -75,7 +75,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { * Return the currently selected filter state * @returns {String} the current filter state */ - getState: function() { + getState: function () { if (!this.list.getSelectionCount()) return; var state = this.list.getSelectedRecords()[0]; @@ -87,7 +87,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { /** * Return the current states in the filter */ - getStates: function() { + getStates: function () { return this.states; }, @@ -95,18 +95,18 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { * Return the Store for the ListView of the FilterPanel * @returns {Ext.data.Store} the ListView store */ - getStore: function() { + getStore: function () { return this.list.getStore(); }, /** * Update the states in the FilterPanel */ - updateStates: function(states) { + updateStates: function (states) { this.states = {}; Ext.each( states, - function(state) { + function (state) { this.states[state[0]] = state[1]; }, this @@ -118,7 +118,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { : this.show_zero; if (!show_zero) { var newStates = []; - Ext.each(states, function(state) { + Ext.each(states, function (state) { if (state[1] > 0 || state[0] == 'All') { newStates.push(state); } @@ -130,7 +130,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { var filters = {}; Ext.each( states, - function(s, i) { + function (s, i) { var record = store.getById(s[0]); if (!record) { record = new store.recordType({ @@ -149,7 +149,7 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, { this ); - store.each(function(record) { + store.each(function (record) { if (filters[record.id]) return; store.remove(record); var selected = this.list.getSelectedRecords()[0]; diff --git a/deluge/ui/web/js/deluge-all/Formatters.js b/deluge/ui/web/js/deluge-all/Formatters.js index a511f34a2..443bfdf56 100644 --- a/deluge/ui/web/js/deluge-all/Formatters.js +++ b/deluge/ui/web/js/deluge-all/Formatters.js @@ -24,7 +24,7 @@ Deluge.Formatters = { * @return {String} a string in the date representation of the current locale * or "" if seconds < 0. */ - date: function(timestamp) { + date: function (timestamp) { function zeroPad(num, count) { var numZeropad = num + ''; while (numZeropad.length < count) { @@ -52,7 +52,7 @@ Deluge.Formatters = { * @param {Boolean} showZero pass in true to displays 0 values * @return {String} formatted string with KiB, MiB or GiB units. */ - size: function(bytes, showZero) { + size: function (bytes, showZero) { if (!bytes && !showZero) return ''; bytes = bytes / 1024.0; @@ -78,7 +78,7 @@ Deluge.Formatters = { * @param {Boolean} showZero pass in true to displays 0 values * @return {String} formatted string with K, M or G units. */ - sizeShort: function(bytes, showZero) { + sizeShort: function (bytes, showZero) { if (!bytes && !showZero) return ''; bytes = bytes / 1024.0; @@ -104,7 +104,7 @@ Deluge.Formatters = { * @param {Boolean} showZero pass in true to displays 0 values * @return {String} formatted string with KiB, MiB or GiB units. */ - speed: function(bytes, showZero) { + speed: function (bytes, showZero) { return !bytes && !showZero ? '' : fsize(bytes, showZero) + '/s'; }, @@ -114,7 +114,7 @@ Deluge.Formatters = { * @param {Number} time the number of seconds * @return {String} a formatted time string. will return '' if seconds == 0 */ - timeRemaining: function(time) { + timeRemaining: function (time) { if (time <= 0) { return '∞'; } @@ -164,11 +164,11 @@ Deluge.Formatters = { * @param {Mixed} value the value to be displayed * @return the untouched value. */ - plain: function(value) { + plain: function (value) { return value; }, - cssClassEscape: function(value) { + cssClassEscape: function (value) { return value.toLowerCase().replace('.', '_'); }, }; diff --git a/deluge/ui/web/js/deluge-all/Keys.js b/deluge/ui/web/js/deluge-all/Keys.js index 25cf38bc3..7b3e3affc 100644 --- a/deluge/ui/web/js/deluge-all/Keys.js +++ b/deluge/ui/web/js/deluge-all/Keys.js @@ -133,6 +133,6 @@ Deluge.Keys = { // Merge the grid and status keys together as the status keys contain all the // grid ones. -Ext.each(Deluge.Keys.Grid, function(key) { +Ext.each(Deluge.Keys.Grid, function (key) { Deluge.Keys.Status.push(key); }); diff --git a/deluge/ui/web/js/deluge-all/LoginWindow.js b/deluge/ui/web/js/deluge-all/LoginWindow.js index 964f5ffb2..a055a6921 100644 --- a/deluge/ui/web/js/deluge-all/LoginWindow.js +++ b/deluge/ui/web/js/deluge-all/LoginWindow.js @@ -23,7 +23,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { width: 300, height: 120, - initComponent: function() { + initComponent: function () { Deluge.LoginWindow.superclass.initComponent.call(this); this.on('show', this.onShow, this); @@ -56,17 +56,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { this.passwordField.on('specialkey', this.onSpecialKey, this); }, - logout: function() { + logout: function () { deluge.events.fire('logout'); deluge.client.auth.delete_session({ - success: function(result) { + success: function (result) { this.show(true); }, scope: this, }); }, - show: function(skipCheck) { + show: function (skipCheck) { if (this.firstShow) { deluge.client.on('error', this.onClientError, this); this.firstShow = false; @@ -77,28 +77,28 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { } deluge.client.auth.check_session({ - success: function(result) { + success: function (result) { if (result) { deluge.events.fire('login'); } else { this.show(true); } }, - failure: function(result) { + failure: function (result) { this.show(true); }, scope: this, }); }, - onSpecialKey: function(field, e) { + onSpecialKey: function (field, e) { if (e.getKey() == 13) this.onLogin(); }, - onLogin: function() { + onLogin: function () { var passwordField = this.passwordField; deluge.client.auth.login(passwordField.getValue(), { - success: function(result) { + success: function (result) { if (result) { deluge.events.fire('login'); this.hide(); @@ -109,7 +109,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { msg: _('You entered an incorrect password'), buttons: Ext.MessageBox.OK, modal: false, - fn: function() { + fn: function () { passwordField.focus(true, 10); }, icon: Ext.MessageBox.WARNING, @@ -121,14 +121,14 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, { }); }, - onClientError: function(errorObj, response, requestOptions) { + onClientError: function (errorObj, response, requestOptions) { if (errorObj.error.code == 1) { deluge.events.fire('logout'); this.show(true); } }, - onShow: function() { + onShow: function () { this.passwordField.focus(true, 300); }, }); diff --git a/deluge/ui/web/js/deluge-all/Menus.js b/deluge/ui/web/js/deluge-all/Menus.js index 529c6cc66..d3b52019c 100644 --- a/deluge/ui/web/js/deluge-all/Menus.js +++ b/deluge/ui/web/js/deluge-all/Menus.js @@ -9,7 +9,7 @@ */ deluge.menus = { - onTorrentActionSetOpt: function(item, e) { + onTorrentActionSetOpt: function (item, e) { var ids = deluge.torrents.getSelectedIds(); var action = item.initialConfig.torrentAction; var opts = {}; @@ -17,17 +17,17 @@ deluge.menus = { deluge.client.core.set_torrent_options(ids, opts); }, - onTorrentActionMethod: function(item, e) { + onTorrentActionMethod: function (item, e) { var ids = deluge.torrents.getSelectedIds(); var action = item.initialConfig.torrentAction; deluge.client.core[action](ids, { - success: function() { + success: function () { deluge.ui.update(); }, }); }, - onTorrentActionShow: function(item, e) { + onTorrentActionShow: function (item, e) { var ids = deluge.torrents.getSelectedIds(); var action = item.initialConfig.torrentAction; switch (action) { diff --git a/deluge/ui/web/js/deluge-all/MoveStorage.js b/deluge/ui/web/js/deluge-all/MoveStorage.js index 208031fb6..9ba638ac6 100644 --- a/deluge/ui/web/js/deluge-all/MoveStorage.js +++ b/deluge/ui/web/js/deluge-all/MoveStorage.js @@ -10,7 +10,7 @@ Ext.namespace('Deluge'); Deluge.MoveStorage = Ext.extend(Ext.Window, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { title: _('Move Download Folder'), @@ -30,7 +30,7 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, { Deluge.MoveStorage.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.MoveStorage.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancel, this); @@ -62,21 +62,21 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, { //}); }, - hide: function() { + hide: function () { Deluge.MoveStorage.superclass.hide.call(this); this.torrentIds = null; }, - show: function(torrentIds) { + show: function (torrentIds) { Deluge.MoveStorage.superclass.show.call(this); this.torrentIds = torrentIds; }, - onCancel: function() { + onCancel: function () { this.hide(); }, - onMove: function() { + onMove: function () { var dest = this.moveLocation.getValue(); deluge.client.core.move_storage(this.torrentIds, dest); this.hide(); diff --git a/deluge/ui/web/js/deluge-all/MultiOptionsManager.js b/deluge/ui/web/js/deluge-all/MultiOptionsManager.js index 1cd7d193f..82f983897 100644 --- a/deluge/ui/web/js/deluge-all/MultiOptionsManager.js +++ b/deluge/ui/web/js/deluge-all/MultiOptionsManager.js @@ -15,7 +15,7 @@ * @extends Deluge.OptionsManager */ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { - constructor: function(config) { + constructor: function (config) { this.currentId = null; this.stored = {}; Deluge.MultiOptionsManager.superclass.constructor.call(this, config); @@ -25,7 +25,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * Changes bound fields to use the specified id. * @param {String} id */ - changeId: function(id, dontUpdateBinds) { + changeId: function (id, dontUpdateBinds) { var oldId = this.currentId; this.currentId = id; if (!dontUpdateBinds) { @@ -33,7 +33,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { if (!this.binds[option]) continue; Ext.each( this.binds[option], - function(bind) { + function (bind) { bind.setValue(this.get(option)); }, this @@ -47,7 +47,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * Changes all the changed values to be the default values * @param {String} id */ - commit: function() { + commit: function () { this.stored[this.currentId] = Ext.apply( this.stored[this.currentId], this.changed[this.currentId] @@ -60,7 +60,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String/Array} option A single option or an array of options to return. * @returns {Object} the options value. */ - get: function() { + get: function () { if (arguments.length == 1) { var option = arguments[0]; return this.isDirty(option) @@ -78,7 +78,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { var options = {}; Ext.each( arguments, - function(option) { + function (option) { options[option] = this.isDirty(option) ? this.changed[this.currentId][option] : this.getDefault(option); @@ -94,7 +94,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String} option A single option. * @returns {Object} the value of the option */ - getDefault: function(option) { + getDefault: function (option) { return this.has(option) ? this.stored[this.currentId][option] : this.options[option]; @@ -104,7 +104,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * Returns the dirty (changed) values. * @returns {Object} the changed options */ - getDirty: function() { + getDirty: function () { return this.changed[this.currentId] ? this.changed[this.currentId] : {}; }, @@ -113,7 +113,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String} option * @returns {Boolean} true if the option has been changed, else false. */ - isDirty: function(option) { + isDirty: function (option) { return ( this.changed[this.currentId] && !Ext.isEmpty(this.changed[this.currentId][option]) @@ -126,7 +126,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String} option * @returns {Boolean} true if the id has an option, else false. */ - has: function(option) { + has: function (option) { return ( this.stored[this.currentId] && !Ext.isEmpty(this.stored[this.currentId][option]) @@ -136,7 +136,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { /** * Reset the options back to the default values for the specified id. */ - reset: function() { + reset: function () { if (this.changed[this.currentId]) delete this.changed[this.currentId]; if (this.stored[this.currentId]) delete this.stored[this.currentId]; }, @@ -144,7 +144,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { /** * Reset the options back to their defaults for all ids. */ - resetAll: function() { + resetAll: function () { this.changed = {}; this.stored = {}; this.changeId(null); @@ -156,7 +156,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String} option * @param {Object} value The value for the option */ - setDefault: function(option, value) { + setDefault: function (option, value) { if (option === undefined) { return; } else if (value === undefined) { @@ -187,7 +187,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { * @param {String/Object} option or options to update * @param {Object} [value]; */ - update: function(option, value) { + update: function (option, value) { if (option === undefined) { return; } else if (value === undefined) { diff --git a/deluge/ui/web/js/deluge-all/OptionsManager.js b/deluge/ui/web/js/deluge-all/OptionsManager.js index a1c4e65a4..529f7afce 100644 --- a/deluge/ui/web/js/deluge-all/OptionsManager.js +++ b/deluge/ui/web/js/deluge-all/OptionsManager.js @@ -18,7 +18,7 @@ Ext.namespace('Deluge'); * @param {Object} config Configuration options */ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { - constructor: function(config) { + constructor: function (config) { config = config || {}; this.binds = {}; this.changed = {}; @@ -56,7 +56,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * Add a set of default options and values to the options manager * @param {Object} options The default options. */ - addOptions: function(options) { + addOptions: function (options) { this.options = Ext.applyIf(this.options, options); }, @@ -65,7 +65,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String} option * @param {Ext.form.Field} field */ - bind: function(option, field) { + bind: function (option, field) { this.binds[option] = this.binds[option] || []; this.binds[option].push(field); field._doption = option; @@ -81,7 +81,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { /** * Changes all the changed values to be the default values */ - commit: function() { + commit: function () { this.options = Ext.apply(this.options, this.changed); this.reset(); }, @@ -91,7 +91,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {Mixed} oldValue The original value * @param {Mixed} value The new value to convert */ - convertValueType: function(oldValue, value) { + convertValueType: function (oldValue, value) { if (Ext.type(oldValue) != Ext.type(value)) { switch (Ext.type(oldValue)) { case 'string': @@ -121,7 +121,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String} [option] A single option or an array of options to return. * @returns {Object} the options value. */ - get: function() { + get: function () { if (arguments.length == 1) { var option = arguments[0]; return this.isDirty(option) @@ -131,7 +131,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { var options = {}; Ext.each( arguments, - function(option) { + function (option) { if (!this.has(option)) return; options[option] = this.isDirty(option) ? this.changed[option] @@ -148,7 +148,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String|Array} [option] A single option or an array of options to return. * @returns {Object} the value of the option */ - getDefault: function(option) { + getDefault: function (option) { return this.options[option]; }, @@ -156,7 +156,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * Returns the dirty (changed) values. * @returns {Object} the changed options */ - getDirty: function() { + getDirty: function () { return this.changed; }, @@ -164,7 +164,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String} [option] The option to check * @returns {Boolean} true if the option has been changed from the default. */ - isDirty: function(option) { + isDirty: function (option) { return !Ext.isEmpty(this.changed[option]); }, @@ -173,14 +173,14 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String} option * @returns {Boolean} true if the option exists, else false. */ - has: function(option) { + has: function (option) { return this.options[option]; }, /** * Reset the options back to the default values. */ - reset: function() { + reset: function () { this.changed = {}; }, @@ -189,7 +189,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String} option * @param {Object} value The value for the option */ - set: function(option, value) { + set: function (option, value) { if (option === undefined) { return; } else if (typeof option == 'object') { @@ -209,7 +209,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {String/Object} option or options to update * @param {Object} [value]; */ - update: function(option, value) { + update: function (option, value) { if (option === undefined) { return; } else if (value === undefined) { @@ -238,7 +238,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * Lets the option manager know when a field is blurred so if a value * so value changing operations can continue on that field. */ - onFieldBlur: function(field, event) { + onFieldBlur: function (field, event) { if (this.focused == field) { this.focused = null; } @@ -249,7 +249,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * @param {Ext.form.Field} field * @private */ - onFieldChange: function(field, event) { + onFieldChange: function (field, event) { if (field.field) field = field.field; // fix for spinners this.update(field._doption, field.getValue()); }, @@ -258,16 +258,16 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { * Lets the option manager know when a field is focused so if a value changing * operation is performed it will not change the value of the field. */ - onFieldFocus: function(field, event) { + onFieldFocus: function (field, event) { this.focused = field; }, - onChange: function(option, newValue, oldValue) { + onChange: function (option, newValue, oldValue) { // If we don't have a bind there's nothing to do. if (Ext.isEmpty(this.binds[option])) return; Ext.each( this.binds[option], - function(bind) { + function (bind) { // The field is currently focused so we do not want to change it. if (bind == this.focused) return; // Set the form field to the new value. diff --git a/deluge/ui/web/js/deluge-all/OtherLimitWindow.js b/deluge/ui/web/js/deluge-all/OtherLimitWindow.js index 3e5880fb0..0d53d4a4e 100644 --- a/deluge/ui/web/js/deluge-all/OtherLimitWindow.js +++ b/deluge/ui/web/js/deluge-all/OtherLimitWindow.js @@ -20,7 +20,7 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, { constrainHeader: true, closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.OtherLimitWindow.superclass.initComponent.call(this); this.form = this.add({ xtype: 'form', @@ -53,30 +53,27 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, { this.afterMethod('show', this.doFocusField, this); }, - setValue: function(value) { + setValue: function (value) { this.form.getForm().setValues({ limit: value }); }, - onCancelClick: function() { + onCancelClick: function () { this.form.getForm().reset(); this.hide(); }, - onOkClick: function() { + onOkClick: function () { var config = {}; config[this.group] = this.form.getForm().getValues().limit; deluge.client.core.set_config(config, { - success: function() { + success: function () { deluge.ui.update(); }, }); this.hide(); }, - doFocusField: function() { - this.form - .getForm() - .findField('limit') - .focus(true, 10); + doFocusField: function () { + this.form.getForm().findField('limit').focus(true, 10); }, }); diff --git a/deluge/ui/web/js/deluge-all/Plugin.js b/deluge/ui/web/js/deluge-all/Plugin.js index af2cda4e9..26971f762 100644 --- a/deluge/ui/web/js/deluge-all/Plugin.js +++ b/deluge/ui/web/js/deluge-all/Plugin.js @@ -21,7 +21,7 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { */ name: null, - constructor: function(config) { + constructor: function (config) { this.isDelugePlugin = true; this.addEvents({ /** @@ -43,7 +43,7 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { * Disables the plugin, firing the "{@link #disabled}" event and * then executing the plugins clean up method onDisabled. */ - disable: function() { + disable: function () { this.fireEvent('disabled', this); if (this.onDisable) this.onDisable(); }, @@ -52,13 +52,13 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { * Enables the plugin, firing the "{@link #enabled}" event and * then executes the plugins setup method, onEnabled. */ - enable: function() { + enable: function () { deluge.client.reloadMethods(); this.fireEvent('enable', this); if (this.onEnable) this.onEnable(); }, - registerTorrentStatus: function(key, header, options) { + registerTorrentStatus: function (key, header, options) { options = options || {}; var cc = options.colCfg || {}, sc = options.storeCfg || {}; @@ -79,23 +79,23 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, { deluge.torrents.getView().refresh(true); }, - deregisterTorrentStatus: function(key) { + deregisterTorrentStatus: function (key) { var fields = []; - Ext.each(deluge.torrents.meta.fields, function(field) { + Ext.each(deluge.torrents.meta.fields, function (field) { if (field.name != key) fields.push(field); }); deluge.torrents.meta.fields = fields; deluge.torrents.getStore().reader.onMetaChange(deluge.torrents.meta); var cols = []; - Ext.each(deluge.torrents.columns, function(col) { + Ext.each(deluge.torrents.columns, function (col) { if (col.dataIndex != key) cols.push(col); }); deluge.torrents.colModel.setConfig(cols); deluge.torrents.columns = cols; var keys = []; - Ext.each(Deluge.Keys.Grid, function(k) { + Ext.each(Deluge.Keys.Grid, function (k) { if (k == key) keys.push(k); }); Deluge.Keys.Grid = keys; diff --git a/deluge/ui/web/js/deluge-all/RemoveWindow.js b/deluge/ui/web/js/deluge-all/RemoveWindow.js index a6290089d..ccac2ef99 100644 --- a/deluge/ui/web/js/deluge-all/RemoveWindow.js +++ b/deluge/ui/web/js/deluge-all/RemoveWindow.js @@ -27,16 +27,16 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, { bodyStyle: 'padding: 5px; padding-left: 10px;', html: 'Are you sure you wish to remove the torrent (s)?', - initComponent: function() { + initComponent: function () { Deluge.RemoveWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancel, this); this.addButton(_('Remove With Data'), this.onRemoveData, this); this.addButton(_('Remove Torrent'), this.onRemove, this); }, - remove: function(removeData) { + remove: function (removeData) { deluge.client.core.remove_torrents(this.torrentIds, removeData, { - success: function(result) { + success: function (result) { if (result == true) { console.log( 'Error(s) occured when trying to delete torrent(s).' @@ -49,25 +49,25 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, { }); }, - show: function(ids) { + show: function (ids) { Deluge.RemoveWindow.superclass.show.call(this); this.torrentIds = ids; }, - onCancel: function() { + onCancel: function () { this.hide(); this.torrentIds = null; }, - onRemove: function() { + onRemove: function () { this.remove(false); }, - onRemoveData: function() { + onRemoveData: function () { this.remove(true); }, - onRemoved: function(torrentIds) { + onRemoved: function (torrentIds) { deluge.events.fire('torrentsRemoved', torrentIds); this.hide(); deluge.ui.update(); diff --git a/deluge/ui/web/js/deluge-all/Sidebar.js b/deluge/ui/web/js/deluge-all/Sidebar.js index 74c3ecbcf..eb08a898f 100644 --- a/deluge/ui/web/js/deluge-all/Sidebar.js +++ b/deluge/ui/web/js/deluge-all/Sidebar.js @@ -24,7 +24,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { // private selected: null, - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { id: 'sidebar', @@ -43,16 +43,16 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { }, // private - initComponent: function() { + initComponent: function () { Deluge.Sidebar.superclass.initComponent.call(this); deluge.events.on('disconnect', this.onDisconnect, this); }, - createFilter: function(filter, states) { + createFilter: function (filter, states) { var panel = new Deluge.FilterPanel({ filter: filter, }); - panel.on('selectionchange', function(view, nodes) { + panel.on('selectionchange', function (view, nodes) { deluge.ui.update(); }); this.add(panel); @@ -60,7 +60,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { this.doLayout(); this.panels[filter] = panel; - panel.header.on('click', function(header) { + panel.header.on('click', function (header) { if (!deluge.config.sidebar_multiple_filters) { deluge.ui.update(); } @@ -74,16 +74,16 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { this.fireEvent('afterfiltercreate', this, panel); }, - getFilter: function(filter) { + getFilter: function (filter) { return this.panels[filter]; }, - getFilterStates: function() { + getFilterStates: function () { var states = {}; if (deluge.config.sidebar_multiple_filters) { // Grab the filters from each of the filter panels - this.items.each(function(panel) { + this.items.each(function (panel) { var state = panel.getState(); if (state == null) return; states[panel.filterType] = state; @@ -100,12 +100,12 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { return states; }, - hasFilter: function(filter) { + hasFilter: function (filter) { return this.panels[filter] ? true : false; }, // private - onDisconnect: function() { + onDisconnect: function () { for (var filter in this.panels) { this.remove(this.panels[filter]); } @@ -113,11 +113,11 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { this.selected = null; }, - onFilterSelect: function(selModel, rowIndex, record) { + onFilterSelect: function (selModel, rowIndex, record) { deluge.ui.update(); }, - update: function(filters) { + update: function (filters) { for (var filter in filters) { var states = filters[filter]; if (Ext.getKeys(this.panels).indexOf(filter) > -1) { @@ -130,7 +130,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, { // Perform a cleanup of fitlers that are not enabled any more. Ext.each( Ext.keys(this.panels), - function(filter) { + function (filter) { if (Ext.keys(filters).indexOf(filter) == -1) { // We need to remove the panel this.remove(this.panels[filter]); diff --git a/deluge/ui/web/js/deluge-all/Statusbar.js b/deluge/ui/web/js/deluge-all/Statusbar.js index c2327bee9..00ad6b244 100644 --- a/deluge/ui/web/js/deluge-all/Statusbar.js +++ b/deluge/ui/web/js/deluge-all/Statusbar.js @@ -10,7 +10,7 @@ Ext.namespace('Deluge'); Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { id: 'deluge-statusbar', @@ -22,14 +22,14 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { Deluge.Statusbar.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.Statusbar.superclass.initComponent.call(this); deluge.events.on('connect', this.onConnect, this); deluge.events.on('disconnect', this.onDisconnect, this); }, - createButtons: function() { + createButtons: function () { this.buttons = this.add( { id: 'statusbar-connections', @@ -213,7 +213,7 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { cls: 'x-btn-text-icon', iconCls: 'x-deluge-traffic', tooltip: _('Protocol Traffic Download/Upload'), - handler: function() { + handler: function () { deluge.preferences.show(); deluge.preferences.selectPage('Network'); }, @@ -240,7 +240,7 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { cls: 'x-btn-text-icon', iconCls: 'x-deluge-freespace', tooltip: _('Freespace in download folder'), - handler: function() { + handler: function () { deluge.preferences.show(); deluge.preferences.selectPage('Downloads'); }, @@ -249,7 +249,7 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { this.created = true; }, - onConnect: function() { + onConnect: function () { this.setStatus({ iconCls: 'x-connected', text: '', @@ -257,7 +257,7 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { if (!this.created) { this.createButtons(); } else { - Ext.each(this.buttons, function(item) { + Ext.each(this.buttons, function (item) { item.show(); item.enable(); }); @@ -265,23 +265,23 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { this.doLayout(); }, - onDisconnect: function() { + onDisconnect: function () { this.clearStatus({ useDefaults: true }); - Ext.each(this.buttons, function(item) { + Ext.each(this.buttons, function (item) { item.hide(); item.disable(); }); this.doLayout(); }, - update: function(stats) { + update: function (stats) { if (!stats) return; function addSpeed(val) { return val + ' KiB/s'; } - var updateStat = function(name, config) { + var updateStat = function (name, config) { var item = this.items.get('statusbar-' + name); if (config.limit.value > 0) { var value = config.value.formatter diff --git a/deluge/ui/web/js/deluge-all/StatusbarMenu.js b/deluge/ui/web/js/deluge-all/StatusbarMenu.js index b9882539f..1365c9c98 100644 --- a/deluge/ui/web/js/deluge-all/StatusbarMenu.js +++ b/deluge/ui/web/js/deluge-all/StatusbarMenu.js @@ -15,13 +15,13 @@ Ext.ns('Deluge'); * @extends Ext.menu.Menu */ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { - initComponent: function() { + initComponent: function () { Deluge.StatusbarMenu.superclass.initComponent.call(this); this.otherWin = new Deluge.OtherLimitWindow( this.initialConfig.otherWin || {} ); - this.items.each(function(item) { + this.items.each(function (item) { if (item.getXType() != 'menucheckitem') return; if (item.value == 'other') { item.on('click', this.onOtherClicked, this); @@ -31,14 +31,14 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { }, this); }, - setValue: function(value) { + setValue: function (value) { var beenSet = false; // set the new value this.value = value = value == 0 ? -1 : value; var other = null; // uncheck all items - this.items.each(function(item) { + this.items.each(function (item) { if (item.setChecked) { item.suspendEvents(); if (item.value == value) { @@ -60,18 +60,18 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { other.resumeEvents(); }, - onLimitChanged: function(item, checked) { + onLimitChanged: function (item, checked) { if (!checked || item.value == 'other') return; // We do not care about unchecked or other. var config = {}; config[item.group] = item.value; deluge.client.core.set_config(config, { - success: function() { + success: function () { deluge.ui.update(); }, }); }, - onOtherClicked: function(item, e) { + onOtherClicked: function (item, e) { this.otherWin.group = item.group; this.otherWin.setValue(this.value); this.otherWin.show(); diff --git a/deluge/ui/web/js/deluge-all/Toolbar.js b/deluge/ui/web/js/deluge-all/Toolbar.js index d51818b4a..1ecdd75cf 100644 --- a/deluge/ui/web/js/deluge-all/Toolbar.js +++ b/deluge/ui/web/js/deluge-all/Toolbar.js @@ -14,7 +14,7 @@ * @extends Ext.Toolbar */ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { items: [ @@ -118,62 +118,62 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { connectedButtons: ['add', 'remove', 'pause', 'resume', 'up', 'down'], - initComponent: function() { + initComponent: function () { Deluge.Toolbar.superclass.initComponent.call(this); deluge.events.on('connect', this.onConnect, this); deluge.events.on('login', this.onLogin, this); }, - onConnect: function() { + onConnect: function () { Ext.each( this.connectedButtons, - function(buttonId) { + function (buttonId) { this.items.get(buttonId).enable(); }, this ); }, - onDisconnect: function() { + onDisconnect: function () { Ext.each( this.connectedButtons, - function(buttonId) { + function (buttonId) { this.items.get(buttonId).disable(); }, this ); }, - onLogin: function() { + onLogin: function () { this.items.get('logout').enable(); }, - onLogout: function() { + onLogout: function () { this.items.get('logout').disable(); deluge.login.logout(); }, - onConnectionManagerClick: function() { + onConnectionManagerClick: function () { deluge.connectionManager.show(); }, - onHelpClick: function() { + onHelpClick: function () { window.open('http://dev.deluge-torrent.org/wiki/UserGuide'); }, - onAboutClick: function() { + onAboutClick: function () { var about = new Deluge.about.AboutWindow(); about.show(); }, - onPreferencesClick: function() { + onPreferencesClick: function () { deluge.preferences.show(); }, - onTorrentAction: function(item) { + onTorrentAction: function (item) { var selection = deluge.torrents.getSelections(); var ids = []; - Ext.each(selection, function(record) { + Ext.each(selection, function (record) { ids.push(record.id); }); @@ -184,7 +184,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { case 'pause': case 'resume': deluge.client.core[item.id + '_torrent'](ids, { - success: function() { + success: function () { deluge.ui.update(); }, }); @@ -192,7 +192,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { case 'up': case 'down': deluge.client.core['queue_' + item.id](ids, { - success: function() { + success: function () { deluge.ui.update(); }, }); @@ -200,7 +200,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, { } }, - onTorrentAdd: function() { + onTorrentAdd: function () { deluge.add.show(); }, }); diff --git a/deluge/ui/web/js/deluge-all/TorrentGrid.js b/deluge/ui/web/js/deluge-all/TorrentGrid.js index b0e0c5ec7..f664c765c 100644 --- a/deluge/ui/web/js/deluge-all/TorrentGrid.js +++ b/deluge/ui/web/js/deluge-all/TorrentGrid.js @@ -8,7 +8,7 @@ * See LICENSE for more details. */ -(function() { +(function () { /* Renderers for the Torrent Grid */ function queueRenderer(value) { return value == -1 ? '' : value + 1; @@ -337,21 +337,21 @@ key: 'a', ctrl: true, stopEvent: true, - handler: function() { + handler: function () { deluge.torrents.getSelectionModel().selectAll(); }, }, { key: [46], stopEvent: true, - handler: function() { + handler: function () { ids = deluge.torrents.getSelectedIds(); deluge.removeWindow.show(ids); }, }, ], - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { id: 'torrentGrid', @@ -376,12 +376,12 @@ Deluge.TorrentGrid.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.TorrentGrid.superclass.initComponent.call(this); deluge.events.on('torrentsRemoved', this.onTorrentsRemoved, this); deluge.events.on('disconnect', this.onDisconnect, this); - this.on('rowcontextmenu', function(grid, rowIndex, e) { + this.on('rowcontextmenu', function (grid, rowIndex, e) { e.stopEvent(); var selection = grid.getSelectionModel(); if (!selection.isSelected(rowIndex)) { @@ -397,7 +397,7 @@ * @param index {int} The row index of the torrent you wish to retrieve. * @return {Ext.data.Record} The record representing the torrent. */ - getTorrent: function(index) { + getTorrent: function (index) { return this.getStore().getAt(index); }, @@ -405,14 +405,14 @@ * Returns the currently selected record. * @ return {Array/Ext.data.Record} The record(s) representing the rows */ - getSelected: function() { + getSelected: function () { return this.getSelectionModel().getSelected(); }, /** * Returns the currently selected records. */ - getSelections: function() { + getSelections: function () { return this.getSelectionModel().getSelections(); }, @@ -420,7 +420,7 @@ * Return the currently selected torrent id. * @return {String} The currently selected id. */ - getSelectedId: function() { + getSelectedId: function () { return this.getSelectionModel().getSelected().id; }, @@ -428,15 +428,15 @@ * Return the currently selected torrent ids. * @return {Array} The currently selected ids. */ - getSelectedIds: function() { + getSelectedIds: function () { var ids = []; - Ext.each(this.getSelectionModel().getSelections(), function(r) { + Ext.each(this.getSelectionModel().getSelections(), function (r) { ids.push(r.id); }); return ids; }, - update: function(torrents, wipe) { + update: function (torrents, wipe) { var store = this.getStore(); // Need to perform a complete reload of the torrent grid. @@ -470,7 +470,7 @@ store.add(newTorrents); // Remove any torrents that should not be in the store. - store.each(function(record) { + store.each(function (record) { if (!torrents[record.id]) { store.remove(record); delete this.torrents[record.id]; @@ -484,17 +484,17 @@ }, // private - onDisconnect: function() { + onDisconnect: function () { this.getStore().removeAll(); this.torrents = {}; }, // private - onTorrentsRemoved: function(torrentIds) { + onTorrentsRemoved: function (torrentIds) { var selModel = this.getSelectionModel(); Ext.each( torrentIds, - function(torrentId) { + function (torrentId) { var record = this.getStore().getById(torrentId); if (selModel.isSelected(record)) { selModel.deselectRow(this.getStore().indexOf(record)); diff --git a/deluge/ui/web/js/deluge-all/UI.js b/deluge/ui/web/js/deluge-all/UI.js index dec4850fc..cc877d597 100644 --- a/deluge/ui/web/js/deluge-all/UI.js +++ b/deluge/ui/web/js/deluge-all/UI.js @@ -42,7 +42,7 @@ deluge.ui = { * @description Create all the interface components, the json-rpc client * and set up various events that the UI will utilise. */ - initialize: function() { + initialize: function () { deluge.add = new Deluge.add.AddWindow(); deluge.details = new Deluge.details.DetailsPanel(); deluge.connectionManager = new Deluge.ConnectionManager(); @@ -100,7 +100,7 @@ deluge.ui = { deluge.client.on( 'connected', - function(e) { + function (e) { deluge.login.show(); }, this, @@ -113,7 +113,7 @@ deluge.ui = { this.originalTitle = document.title; }, - checkConnection: function() { + checkConnection: function () { deluge.client.web.connected({ success: this.onConnectionSuccess, failure: this.onConnectionError, @@ -121,7 +121,7 @@ deluge.ui = { }); }, - update: function() { + update: function () { var filters = deluge.sidebar.getFilterStates(); this.oldFilters = this.filters; this.filters = filters; @@ -134,9 +134,9 @@ deluge.ui = { deluge.details.update(); }, - onConnectionError: function(error) {}, + onConnectionError: function (error) {}, - onConnectionSuccess: function(result) { + onConnectionSuccess: function (result) { deluge.statusbar.setStatus({ iconCls: 'x-deluge-statusbar icon-ok', text: _('Connection restored'), @@ -147,7 +147,7 @@ deluge.ui = { } }, - onUpdateError: function(error) { + onUpdateError: function (error) { if (this.errorCount == 2) { Ext.MessageBox.show({ title: _('Lost Connection'), @@ -169,7 +169,7 @@ deluge.ui = { * @private * Updates the various components in the interface. */ - onUpdate: function(data) { + onUpdate: function (data) { if (!data['connected']) { deluge.connectionManager.disconnect(true); return; @@ -199,7 +199,7 @@ deluge.ui = { * @private * Start the Deluge UI polling the server and update the interface. */ - onConnect: function() { + onConnect: function () { if (!this.running) { this.running = setInterval(this.update, 2000); this.update(); @@ -214,14 +214,14 @@ deluge.ui = { * @static * @private */ - onDisconnect: function() { + onDisconnect: function () { this.stop(); }, - onGotPlugins: function(plugins) { + onGotPlugins: function (plugins) { Ext.each( plugins.enabled_plugins, - function(plugin) { + function (plugin) { if (deluge.plugins[plugin]) return; deluge.client.web.get_plugin_resources(plugin, { success: this.onGotPluginResources, @@ -232,7 +232,7 @@ deluge.ui = { ); }, - onPluginEnabled: function(pluginName) { + onPluginEnabled: function (pluginName) { if (deluge.plugins[pluginName]) { deluge.plugins[pluginName].enable(); } else { @@ -243,13 +243,13 @@ deluge.ui = { } }, - onGotPluginResources: function(resources) { + onGotPluginResources: function (resources) { var scripts = Deluge.debug ? resources.debug_scripts : resources.scripts; Ext.each( scripts, - function(script) { + function (script) { Ext.ux.JSLoader({ url: deluge.config.base + script, onLoad: this.onPluginLoaded, @@ -260,11 +260,11 @@ deluge.ui = { ); }, - onPluginDisabled: function(pluginName) { + onPluginDisabled: function (pluginName) { if (deluge.plugins[pluginName]) deluge.plugins[pluginName].disable(); }, - onPluginLoaded: function(options) { + onPluginLoaded: function (options) { // This could happen if the plugin has multiple scripts if (!Deluge.hasPlugin(options.pluginName)) return; @@ -278,7 +278,7 @@ deluge.ui = { * @static * Stop the Deluge UI polling the server and clear the interface. */ - stop: function() { + stop: function () { if (this.running) { clearInterval(this.running); this.running = false; @@ -287,6 +287,6 @@ deluge.ui = { }, }; -Ext.onReady(function(e) { +Ext.onReady(function (e) { deluge.ui.initialize(); }); diff --git a/deluge/ui/web/js/deluge-all/add/AddWindow.js b/deluge/ui/web/js/deluge-all/add/AddWindow.js index a9db791f1..fb89e479a 100644 --- a/deluge/ui/web/js/deluge-all/add/AddWindow.js +++ b/deluge/ui/web/js/deluge-all/add/AddWindow.js @@ -12,7 +12,7 @@ Ext.namespace('Deluge.add'); // This override allows file upload buttons to contain icons Ext.override(Ext.ux.form.FileUploadField, { - onRender: function(ct, position) { + onRender: function (ct, position) { Ext.ux.form.FileUploadField.superclass.onRender.call( this, ct, @@ -58,7 +58,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { plain: true, iconCls: 'x-deluge-add-window-icon', - initComponent: function() { + initComponent: function () { Deluge.add.AddWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -168,17 +168,17 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.on('show', this.onShow, this); }, - clear: function() { + clear: function () { this.list.getStore().removeAll(); this.optionsPanel.clear(); // Reset upload form so handler fires when a canceled file is reselected this.fileUploadForm.reset(); }, - onAddClick: function() { + onAddClick: function () { var torrents = []; if (!this.list) return; - this.list.getStore().each(function(r) { + this.list.getStore().each(function (r) { var id = r.get('info_hash'); torrents.push({ path: this.optionsPanel.getFilename(id), @@ -187,29 +187,29 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { }, this); deluge.client.web.add_torrents(torrents, { - success: function(result) {}, + success: function (result) {}, }); this.clear(); this.hide(); }, - onCancelClick: function() { + onCancelClick: function () { this.clear(); this.hide(); }, - onFile: function() { + onFile: function () { if (!this.file) this.file = new Deluge.add.FileWindow(); this.file.show(); }, - onHide: function() { + onHide: function () { this.optionsPanel.setActiveTab(0); this.optionsPanel.files.setDisabled(true); this.optionsPanel.form.setDisabled(true); }, - onRemove: function() { + onRemove: function () { if (!this.list.getSelectionCount()) return; var torrent = this.list.getSelectedRecords()[0]; if (!torrent) return; @@ -220,7 +220,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { delete this.torrents[torrent.id]; }, - onSelect: function(list, selections) { + onSelect: function (list, selections) { if (selections.length) { var record = this.list.getRecord(selections[0]); this.optionsPanel.setTorrent(record.get('info_hash')); @@ -230,7 +230,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { } }, - onShow: function() { + onShow: function () { if (!this.url) { this.url = new Deluge.add.UrlWindow(); this.url.on('beforeadd', this.onTorrentBeforeAdd, this); @@ -241,14 +241,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.optionsPanel.form.getDefaults(); }, - onFileSelected: function() { + onFileSelected: function () { if (this.fileUploadForm.isValid()) { var torrentIds = []; var files = this.fileUploadForm.findField('torrentFile').value; var randomId = this.createTorrentId(); Array.prototype.forEach.call( files, - function(file, i) { + function (file, i) { // Append index for batch of unique torrentIds. var torrentId = randomId + i.toString(); torrentIds.push(torrentId); @@ -266,14 +266,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { } }, - onUploadSuccess: function(fp, upload) { + onUploadSuccess: function (fp, upload) { if (!upload.result.success) { this.clear(); return; } upload.result.files.forEach( - function(filename, i) { + function (filename, i) { deluge.client.web.get_torrent_info(filename, { success: this.onGotInfo, scope: this, @@ -285,7 +285,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.fileUploadForm.reset(); }, - onUploadFailure: function(form, action) { + onUploadFailure: function (form, action) { this.hide(); Ext.MessageBox.show({ title: _('Error'), @@ -298,18 +298,18 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { this.fireEvent('addfailed', this.torrentId); }, - onGotInfo: function(info, obj, response, request) { + onGotInfo: function (info, obj, response, request) { info.filename = request.options.filename; torrentId = request.options.torrentId; this.onTorrentAdd(torrentId, info); }, - onTorrentBeforeAdd: function(torrentId, text) { + onTorrentBeforeAdd: function (torrentId, text) { var store = this.list.getStore(); store.loadData([[torrentId, null, text]], true); }, - onTorrentAdd: function(torrentId, info) { + onTorrentAdd: function (torrentId, info) { var r = this.list.getStore().getById(torrentId); if (!info) { Ext.MessageBox.show({ @@ -330,7 +330,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { } }, - onTorrentAddFailed: function(torrentId) { + onTorrentAddFailed: function (torrentId) { var store = this.list.getStore(); var torrentRecord = store.getById(torrentId); if (torrentRecord) { @@ -338,7 +338,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { } }, - onUrl: function(button, event) { + onUrl: function (button, event) { this.url.show(); }, }); diff --git a/deluge/ui/web/js/deluge-all/add/FilesTab.js b/deluge/ui/web/js/deluge-all/add/FilesTab.js index a433ad6a6..fed52282d 100644 --- a/deluge/ui/web/js/deluge-all/add/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/add/FilesTab.js @@ -34,7 +34,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { width: 60, dataIndex: 'size', tpl: new Ext.XTemplate('{size:this.fsize}', { - fsize: function(v) { + fsize: function (v) { return fsize(v); }, }), @@ -44,7 +44,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { width: 65, dataIndex: 'download', tpl: new Ext.XTemplate('{download:this.format}', { - format: function(v) { + format: function (v) { return ( '<div rel="chkbox" class="x-grid3-check-col' + (v ? '-on' : '') + @@ -55,21 +55,21 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }, ], - initComponent: function() { + initComponent: function () { Deluge.add.FilesTab.superclass.initComponent.call(this); this.on('click', this.onNodeClick, this); }, - clearFiles: function() { + clearFiles: function () { var root = this.getRootNode(); if (!root.hasChildNodes()) return; - root.cascade(function(node) { + root.cascade(function (node) { if (!node.parentNode || !node.getOwnerTree()) return; node.remove(); }); }, - setDownload: function(node, value, suppress) { + setDownload: function (node, value, suppress) { node.attributes.download = value; node.ui.updateColumns(); @@ -79,7 +79,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } } else { var nodes = [node]; - node.cascade(function(n) { + node.cascade(function (n) { n.attributes.download = value; n.ui.updateColumns(); nodes.push(n); @@ -90,7 +90,7 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } }, - onNodeClick: function(node, e) { + onNodeClick: function (node, e) { var el = new Ext.Element(e.target); if (el.getAttribute('rel') == 'chkbox') { this.setDownload(node, !node.attributes.download); diff --git a/deluge/ui/web/js/deluge-all/add/OptionsPanel.js b/deluge/ui/web/js/deluge-all/add/OptionsPanel.js index 3dfb6f869..6b75686a3 100644 --- a/deluge/ui/web/js/deluge-all/add/OptionsPanel.js +++ b/deluge/ui/web/js/deluge-all/add/OptionsPanel.js @@ -18,7 +18,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { activeTab: 0, height: 265, - initComponent: function() { + initComponent: function () { Deluge.add.OptionsPanel.superclass.initComponent.call(this); this.files = this.add(new Deluge.add.FilesTab()); this.form = this.add(new Deluge.add.OptionsTab()); @@ -26,12 +26,12 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { this.files.on('fileschecked', this.onFilesChecked, this); }, - addTorrent: function(torrent) { + addTorrent: function (torrent) { this.torrents[torrent['info_hash']] = torrent; var fileIndexes = {}; this.walkFileTree( torrent['files_tree'], - function(filename, type, entry, parent) { + function (filename, type, entry, parent) { if (type != 'file') return; fileIndexes[entry.index] = entry.download; }, @@ -39,7 +39,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { ); var priorities = []; - Ext.each(Ext.keys(fileIndexes), function(index) { + Ext.each(Ext.keys(fileIndexes), function (index) { priorities[index] = fileIndexes[index]; }); @@ -51,26 +51,26 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { this.form.optionsManager.changeId(oldId, true); }, - clear: function() { + clear: function () { this.files.clearFiles(); this.form.optionsManager.resetAll(); }, - getFilename: function(torrentId) { + getFilename: function (torrentId) { return this.torrents[torrentId]['filename']; }, - getOptions: function(torrentId) { + getOptions: function (torrentId) { var oldId = this.form.optionsManager.changeId(torrentId, true); var options = this.form.optionsManager.get(); this.form.optionsManager.changeId(oldId, true); - Ext.each(options['file_priorities'], function(priority, index) { + Ext.each(options['file_priorities'], function (priority, index) { options['file_priorities'][index] = priority ? 1 : 0; }); return options; }, - setTorrent: function(torrentId) { + setTorrent: function (torrentId) { if (!torrentId) return; this.torrentId = torrentId; @@ -85,7 +85,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { if (this.torrents[torrentId]['files_tree']) { this.walkFileTree( this.torrents[torrentId]['files_tree'], - function(filename, type, entry, parentNode) { + function (filename, type, entry, parentNode) { var node = new Ext.tree.TreeNode({ download: entry.index ? priorities[entry.index] : true, filename: filename, @@ -109,7 +109,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { } }, - walkFileTree: function(files, callback, scope, parentNode) { + walkFileTree: function (files, callback, scope, parentNode) { for (var filename in files.contents) { var entry = files.contents[filename]; var type = entry.type; @@ -129,10 +129,10 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { } }, - onFilesChecked: function(nodes, newValue, oldValue) { + onFilesChecked: function (nodes, newValue, oldValue) { Ext.each( nodes, - function(node) { + function (node) { if (node.attributes.fileindex < 0) return; var priorities = this.form.optionsManager.get( 'file_priorities' diff --git a/deluge/ui/web/js/deluge-all/add/OptionsTab.js b/deluge/ui/web/js/deluge-all/add/OptionsTab.js index e897b1783..73a8a5c28 100644 --- a/deluge/ui/web/js/deluge-all/add/OptionsTab.js +++ b/deluge/ui/web/js/deluge-all/add/OptionsTab.js @@ -21,7 +21,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { disabled: true, labelWidth: 1, - initComponent: function() { + initComponent: function () { Deluge.add.OptionsTab.superclass.initComponent.call(this); this.optionsManager = new Deluge.MultiOptionsManager(); @@ -174,7 +174,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { ); }, - getDefaults: function() { + getDefaults: function () { var keys = [ 'add_paused', 'pre_allocate_storage', @@ -190,7 +190,7 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { ]; deluge.client.core.get_config_values(keys, { - success: function(config) { + success: function (config) { var options = { file_priorities: [], add_paused: config.add_paused, diff --git a/deluge/ui/web/js/deluge-all/add/UrlWindow.js b/deluge/ui/web/js/deluge-all/add/UrlWindow.js index 88988bd04..caf2250e2 100644 --- a/deluge/ui/web/js/deluge-all/add/UrlWindow.js +++ b/deluge/ui/web/js/deluge-all/add/UrlWindow.js @@ -22,7 +22,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { bodyStyle: 'padding: 10px 5px;', iconCls: 'x-deluge-add-url-window-icon', - initComponent: function() { + initComponent: function () { Deluge.add.UrlWindow.superclass.initComponent.call(this); this.addButton(_('Add'), this.onAddClick, this); @@ -50,7 +50,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { this.cookieField.on('specialkey', this.onAdd, this); }, - onAddClick: function(field, e) { + onAddClick: function (field, e) { if ( (field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER @@ -83,7 +83,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { this.fireEvent('beforeadd', torrentId, url); }, - onDownload: function(filename, obj, resp, req) { + onDownload: function (filename, obj, resp, req) { deluge.client.web.get_torrent_info(filename, { success: this.onGotInfo, failure: this.onDownloadFailed, @@ -93,7 +93,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { }); }, - onDownloadFailed: function(obj, resp, req) { + onDownloadFailed: function (obj, resp, req) { Ext.MessageBox.show({ title: _('Error'), msg: _('Failed to download torrent'), @@ -105,7 +105,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { this.fireEvent('addfailed', req.options.torrentId); }, - onGotInfo: function(info, obj, response, request) { + onGotInfo: function (info, obj, response, request) { info['filename'] = request.options.filename; this.fireEvent('add', request.options.torrentId, info); }, diff --git a/deluge/ui/web/js/deluge-all/add/Window.js b/deluge/ui/web/js/deluge-all/add/Window.js index d2d576982..20851e7ea 100644 --- a/deluge/ui/web/js/deluge-all/add/Window.js +++ b/deluge/ui/web/js/deluge-all/add/Window.js @@ -15,7 +15,7 @@ Ext.ns('Deluge.add'); * Base class for an add Window */ Deluge.add.Window = Ext.extend(Ext.Window, { - initComponent: function() { + initComponent: function () { Deluge.add.Window.superclass.initComponent.call(this); this.addEvents('beforeadd', 'add', 'addfailed'); }, @@ -23,7 +23,7 @@ Deluge.add.Window = Ext.extend(Ext.Window, { /** * Create an id for the torrent before we have any info about it. */ - createTorrentId: function() { + createTorrentId: function () { return new Date().getTime().toString(); }, }); diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js b/deluge/ui/web/js/deluge-all/data/SortTypes.js index 199f89574..ac915d142 100644 --- a/deluge/ui/web/js/deluge-all/data/SortTypes.js +++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js @@ -27,11 +27,11 @@ Deluge.data.SortTypes = { return ((+d[1] * 256 + (+d[2])) * 256 + (+d[3])) * 256 + (+d[4]); }, - asQueuePosition: function(value) { + asQueuePosition: function (value) { return value > -1 ? value : Number.MAX_VALUE; }, - asName: function(value) { + asName: function (value) { return String(value).toLowerCase(); }, }; diff --git a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js index 1c51de49c..3f28b2576 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsPanel.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsPanel.js @@ -16,7 +16,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { id: 'torrentDetails', activeTab: 0, - initComponent: function() { + initComponent: function () { Deluge.details.DetailsPanel.superclass.initComponent.call(this); this.add(new Deluge.details.StatusTab()); this.add(new Deluge.details.DetailsTab()); @@ -25,8 +25,8 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { this.add(new Deluge.details.OptionsTab()); }, - clear: function() { - this.items.each(function(panel) { + clear: function () { + this.items.each(function (panel) { if (panel.clear) { panel.clear.defer(100, panel); panel.disable(); @@ -34,14 +34,14 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { }); }, - update: function(tab) { + update: function (tab) { var torrent = deluge.torrents.getSelected(); if (!torrent) { this.clear(); return; } - this.items.each(function(tab) { + this.items.each(function (tab) { if (tab.disabled) tab.enable(); }); @@ -52,7 +52,7 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { /* Event Handlers */ // We need to add the events in onRender since Deluge.Torrents has not been created yet. - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.DetailsPanel.superclass.onRender.call( this, ct, @@ -64,18 +64,18 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { deluge.torrents.getSelectionModel().on( 'selectionchange', - function(selModel) { + function (selModel) { if (!selModel.hasSelection()) this.clear(); }, this ); }, - onTabChange: function(panel, tab) { + onTabChange: function (panel, tab) { this.update(tab); }, - onTorrentsClick: function(grid, rowIndex, e) { + onTorrentsClick: function (grid, rowIndex, e) { this.update(); }, }); diff --git a/deluge/ui/web/js/deluge-all/details/DetailsTab.js b/deluge/ui/web/js/deluge-all/details/DetailsTab.js index 84929aed7..fdb4f7f0d 100644 --- a/deluge/ui/web/js/deluge-all/details/DetailsTab.js +++ b/deluge/ui/web/js/deluge-all/details/DetailsTab.js @@ -18,7 +18,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { oldData: {}, - initComponent: function() { + initComponent: function () { Deluge.details.DetailsTab.superclass.initComponent.call(this); this.addItem('torrent_name', _('Name:')); this.addItem('hash', _('Hash:')); @@ -31,7 +31,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { this.addItem('creator', _('Created By:')); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.DetailsTab.superclass.onRender.call(this, ct, position); this.body.setStyle('padding', '10px'); this.dl = Ext.DomHelper.append(this.body, { tag: 'dl' }, true); @@ -41,7 +41,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { } }, - addItem: function(id, label) { + addItem: function (id, label) { if (!this.rendered) { this.queuedItems[id] = label; } else { @@ -50,7 +50,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }, // private - doAddItem: function(id, label) { + doAddItem: function (id, label) { Ext.DomHelper.append(this.dl, { tag: 'dt', cls: id, html: label }); this.fields[id] = Ext.DomHelper.append( this.dl, @@ -59,7 +59,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { ); }, - clear: function() { + clear: function () { if (!this.fields) return; for (var k in this.fields) { this.fields[k].dom.innerHTML = ''; @@ -67,7 +67,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { this.oldData = {}; }, - update: function(torrentId) { + update: function (torrentId) { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Details, { success: this.onRequestComplete, scope: this, @@ -75,7 +75,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, { }); }, - onRequestComplete: function(torrent, request, response, options) { + onRequestComplete: function (torrent, request, response, options) { var data = { torrent_name: torrent.name, hash: options.options.torrentId, diff --git a/deluge/ui/web/js/deluge-all/details/FilesTab.js b/deluge/ui/web/js/deluge-all/details/FilesTab.js index 3a212fa1e..edc388d19 100644 --- a/deluge/ui/web/js/deluge-all/details/FilesTab.js +++ b/deluge/ui/web/js/deluge-all/details/FilesTab.js @@ -24,7 +24,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { width: 150, dataIndex: 'size', tpl: new Ext.XTemplate('{size:this.fsize}', { - fsize: function(v) { + fsize: function (v) { return fsize(v); }, }), @@ -34,7 +34,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { header: _('Progress'), width: 150, dataIndex: 'progress', - renderer: function(v) { + renderer: function (v) { var progress = v * 100; return Deluge.progressBar( progress, @@ -54,11 +54,11 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { '{priority:this.getName}' + '</div></tpl>', { - getClass: function(v) { + getClass: function (v) { return FILE_PRIORITY_CSS[v]; }, - getName: function(v) { + getName: function (v) { return _(FILE_PRIORITY[v]); }, } @@ -68,15 +68,15 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { selModel: new Ext.tree.MultiSelectionModel(), - initComponent: function() { + initComponent: function () { Deluge.details.FilesTab.superclass.initComponent.call(this); this.setRootNode(new Ext.tree.TreeNode({ text: _('Files') })); }, - clear: function() { + clear: function () { var root = this.getRootNode(); if (!root.hasChildNodes()) return; - root.cascade(function(node) { + root.cascade(function (node) { var parentNode = node.parentNode; if (!parentNode) return; if (!parentNode.ownerTree) return; @@ -84,7 +84,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - createFileTree: function(files) { + createFileTree: function (files) { function walk(files, parentNode) { for (var file in files.contents) { var item = files.contents[file]; @@ -123,7 +123,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { root.firstChild.expand(); }, - update: function(torrentId) { + update: function (torrentId) { if (this.torrentId != torrentId) { this.clear(); this.torrentId = torrentId; @@ -136,7 +136,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - updateFileTree: function(files) { + updateFileTree: function (files) { function walk(files, parentNode) { for (var file in files.contents) { var item = files.contents[file]; @@ -153,7 +153,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { walk(files, this.getRootNode()); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.FilesTab.superclass.onRender.call(this, ct, position); deluge.menus.filePriorities.on('itemclick', this.onItemClick, this); this.on('contextmenu', this.onContextMenu, this); @@ -162,7 +162,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { }); }, - onContextMenu: function(node, e) { + onContextMenu: function (node, e) { e.stopEvent(); var selModel = this.getSelectionModel(); if (selModel.getSelectedNodes().length < 2) { @@ -172,14 +172,14 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { deluge.menus.filePriorities.showAt(e.getPoint()); }, - onItemClick: function(baseItem, e) { + onItemClick: function (baseItem, e) { switch (baseItem.id) { case 'expandAll': this.expandAll(); break; default: var indexes = {}; - var walk = function(node) { + var walk = function (node) { if (Ext.isEmpty(node.attributes.fileIndex)) return; indexes[node.attributes.fileIndex] = node.attributes.priority; @@ -187,9 +187,9 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { this.getRootNode().cascade(walk); var nodes = this.getSelectionModel().getSelectedNodes(); - Ext.each(nodes, function(node) { + Ext.each(nodes, function (node) { if (!node.isLeaf()) { - var setPriorities = function(node) { + var setPriorities = function (node) { if (Ext.isEmpty(node.attributes.fileIndex)) return; indexes[node.attributes.fileIndex] = baseItem.filePriority; @@ -211,8 +211,8 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { [this.torrentId], { file_priorities: priorities }, { - success: function() { - Ext.each(nodes, function(node) { + success: function () { + Ext.each(nodes, function (node) { node.setColumnValue(3, baseItem.filePriority); }); }, @@ -223,7 +223,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { } }, - onRequestComplete: function(files, options) { + onRequestComplete: function (files, options) { if (!this.getRootNode().hasChildNodes()) { this.createFileTree(files); } else { diff --git a/deluge/ui/web/js/deluge-all/details/OptionsTab.js b/deluge/ui/web/js/deluge-all/details/OptionsTab.js index b11486bfd..7e59cba4e 100644 --- a/deluge/ui/web/js/deluge-all/details/OptionsTab.js +++ b/deluge/ui/web/js/deluge-all/details/OptionsTab.js @@ -9,7 +9,7 @@ */ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { autoScroll: true, @@ -30,7 +30,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { Deluge.details.OptionsTab.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.details.OptionsTab.superclass.initComponent.call(this); (this.fieldsets = {}), (this.fields = {}); @@ -339,7 +339,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.OptionsTab.superclass.onRender.call(this, ct, position); // This is another hack I think, so keep an eye out here when upgrading. @@ -348,17 +348,17 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { this.doLayout(); }, - clear: function() { + clear: function () { if (this.torrentId == null) return; this.torrentId = null; this.optionsManager.changeId(null); }, - reset: function() { + reset: function () { if (this.torrentId) this.optionsManager.reset(); }, - update: function(torrentId) { + update: function (torrentId) { if (this.torrentId && !torrentId) this.clear(); // we want to clear the pane if we get a null torrent torrentIds if (!torrentId) return; // We do not care about null torrentIds. @@ -373,33 +373,33 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { }); }, - onApply: function() { + onApply: function () { var changed = this.optionsManager.getDirty(); deluge.client.core.set_torrent_options([this.torrentId], changed, { - success: function() { + success: function () { this.optionsManager.commit(); }, scope: this, }); }, - onEditTrackers: function() { + onEditTrackers: function () { deluge.editTrackers.show(); }, - onMoveCompletedChecked: function(checkbox, checked) { + onMoveCompletedChecked: function (checkbox, checked) { this.fields.move_completed_path.setDisabled(!checked); if (!checked) return; this.fields.move_completed_path.focus(); }, - onStopRatioChecked: function(checkbox, checked) { + onStopRatioChecked: function (checkbox, checked) { this.fields.remove_at_ratio.setDisabled(!checked); this.fields.stop_ratio.setDisabled(!checked); }, - onRequestComplete: function(torrent, options) { + onRequestComplete: function (torrent, options) { this.fields['private'].setValue(torrent['private']); this.fields['private'].setDisabled(true); delete torrent['private']; diff --git a/deluge/ui/web/js/deluge-all/details/PeersTab.js b/deluge/ui/web/js/deluge-all/details/PeersTab.js index 515e53322..b86d3a345 100644 --- a/deluge/ui/web/js/deluge-all/details/PeersTab.js +++ b/deluge/ui/web/js/deluge-all/details/PeersTab.js @@ -8,7 +8,7 @@ * See LICENSE for more details. */ -(function() { +(function () { function flagRenderer(value) { if (!value.replace(' ', '').replace(' ', '')) { return ''; @@ -40,7 +40,7 @@ // fast way to figure out if we have a peer already. peers: {}, - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { title: _('Peers'), @@ -107,19 +107,19 @@ Deluge.details.PeersTab.superclass.constructor.call(this, config); }, - clear: function() { + clear: function () { this.getStore().removeAll(); this.peers = {}; }, - update: function(torrentId) { + update: function (torrentId) { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Peers, { success: this.onRequestComplete, scope: this, }); }, - onRequestComplete: function(torrent, options) { + onRequestComplete: function (torrent, options) { if (!torrent) return; var store = this.getStore(); @@ -129,7 +129,7 @@ // Go through the peers updating and creating peer records Ext.each( torrent.peers, - function(peer) { + function (peer) { if (this.peers[peer.ip]) { var record = store.getById(peer.ip); record.beginEdit(); @@ -150,7 +150,7 @@ store.add(newPeers); // Remove any peers that should not be left in the store. - store.each(function(record) { + store.each(function (record) { if (!addresses[record.id]) { store.remove(record); delete this.peers[record.id]; diff --git a/deluge/ui/web/js/deluge-all/details/StatusTab.js b/deluge/ui/web/js/deluge-all/details/StatusTab.js index a8753bb87..60551618d 100644 --- a/deluge/ui/web/js/deluge-all/details/StatusTab.js +++ b/deluge/ui/web/js/deluge-all/details/StatusTab.js @@ -17,7 +17,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { title: _('Status'), autoScroll: true, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.details.StatusTab.superclass.onRender.call(this, ct, position); this.progressBar = this.add({ @@ -33,7 +33,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { width: 1000, listeners: { render: { - fn: function(panel) { + fn: function (panel) { panel.load({ url: deluge.config.base + 'render/tab_status.html', text: _('Loading') + '...', @@ -48,14 +48,14 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { }); }, - clear: function() { + clear: function () { this.progressBar.updateProgress(0, ' '); for (var k in this.fields) { this.fields[k].innerHTML = ''; } }, - update: function(torrentId) { + update: function (torrentId) { if (!this.fields) this.getFields(); deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, { success: this.onRequestComplete, @@ -63,18 +63,18 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, { }); }, - onPanelUpdate: function(el, response) { + onPanelUpdate: function (el, response) { this.fields = {}; Ext.each( Ext.query('dd', this.status.body.dom), - function(field) { + function (field) { this.fields[field.className] = field; }, this ); }, - onRequestComplete: function(status) { + onRequestComplete: function (status) { seeds = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' diff --git a/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js index 031104cef..4c3720198 100644 --- a/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/BandwidthPage.js @@ -14,7 +14,7 @@ Ext.namespace('Deluge.preferences'); * @extends Ext.form.FormPanel */ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { border: false, @@ -28,7 +28,7 @@ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Bandwidth.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.preferences.Bandwidth.superclass.initComponent.call(this); var om = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/CachePage.js b/deluge/ui/web/js/deluge-all/preferences/CachePage.js index 2c84c7b8f..bd5acd8ed 100644 --- a/deluge/ui/web/js/deluge-all/preferences/CachePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/CachePage.js @@ -19,7 +19,7 @@ Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { header: false, layout: 'form', - initComponent: function() { + initComponent: function () { Deluge.preferences.Cache.superclass.initComponent.call(this); var om = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js index 38f575040..1787826b7 100644 --- a/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/DaemonPage.js @@ -19,7 +19,7 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { header: false, layout: 'form', - initComponent: function() { + initComponent: function () { Deluge.preferences.Daemon.superclass.initComponent.call(this); var om = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js index bba5e47fb..04ffd151d 100644 --- a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js @@ -14,7 +14,7 @@ Ext.namespace('Deluge.preferences'); * @extends Ext.form.FormPanel */ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { border: false, @@ -29,7 +29,7 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { Deluge.preferences.Downloads.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.preferences.Downloads.superclass.initComponent.call(this); var optMan = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js b/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js index af5ad5116..1bcf95e15 100644 --- a/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/EncryptionPage.js @@ -18,7 +18,7 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, { title: _('Encryption'), header: false, - initComponent: function() { + initComponent: function () { Deluge.preferences.Encryption.superclass.initComponent.call(this); var optMan = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js b/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js index c3946641d..9aefce3e7 100644 --- a/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js +++ b/deluge/ui/web/js/deluge-all/preferences/InstallPluginWindow.js @@ -26,7 +26,7 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, { modal: true, plain: true, - initComponent: function() { + initComponent: function () { Deluge.preferences.InstallPluginWindow.superclass.initComponent.call( this ); @@ -53,7 +53,7 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, { }); }, - onInstall: function(field, e) { + onInstall: function (field, e) { this.form.getForm().submit({ url: deluge.config.base + 'upload', waitMsg: _('Uploading your plugin...'), @@ -62,11 +62,11 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, { }); }, - onUploadPlugin: function(info, obj, response, request) { + onUploadPlugin: function (info, obj, response, request) { this.fireEvent('pluginadded'); }, - onUploadSuccess: function(fp, upload) { + onUploadSuccess: function (fp, upload) { this.hide(); if (upload.result.success) { var filename = this.form.getForm().getFieldValues().file; diff --git a/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js index f5b0290e9..b6b76ebde 100644 --- a/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/InterfacePage.js @@ -19,7 +19,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { header: false, layout: 'form', - initComponent: function() { + initComponent: function () { Deluge.preferences.Interface.superclass.initComponent.call(this); var om = (this.optionsManager = new Deluge.OptionsManager()); @@ -189,7 +189,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { ); }, - onApply: function() { + onApply: function () { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { deluge.client.web.set_config(changed, { @@ -211,7 +211,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { no: _('Close'), }, multiline: false, - fn: function(btnText) { + fn: function (btnText) { if (btnText === 'yes') location.reload(); }, icon: Ext.MessageBox.QUESTION, @@ -223,21 +223,21 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { } }, - onOk: function() { + onOk: function () { this.onApply(); }, - onGotConfig: function(config) { + onGotConfig: function (config) { this.optionsManager.set(config); }, - onGotLanguages: function(info, obj, response, request) { + onGotLanguages: function (info, obj, response, request) { info.unshift(['', _('System Default')]); this.language.store.loadData(info); this.language.setValue(this.optionsManager.get('language')); }, - onPasswordChange: function() { + onPasswordChange: function () { var newPassword = this.newPassword.getValue(); if (newPassword != this.confirmPassword.getValue()) { Ext.MessageBox.show({ @@ -253,7 +253,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { var oldPassword = this.oldPassword.getValue(); deluge.client.auth.change_password(oldPassword, newPassword, { - success: function(result) { + success: function (result) { if (!result) { Ext.MessageBox.show({ title: _('Password'), @@ -282,11 +282,11 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { }); }, - onSetConfig: function() { + onSetConfig: function () { this.optionsManager.commit(); }, - onPageShow: function() { + onPageShow: function () { deluge.client.web.get_config({ success: this.onGotConfig, scope: this, @@ -297,7 +297,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { }); }, - onSSLCheck: function(e, checked) { + onSSLCheck: function (e, checked) { this.pkeyField.setDisabled(!checked); this.certField.setDisabled(!checked); }, diff --git a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js index 651ba4f0b..5ba98e7e2 100644 --- a/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/NetworkPage.js @@ -11,7 +11,7 @@ Ext.namespace('Deluge.preferences'); // custom Vtype for vtype:'IPAddress' Ext.apply(Ext.form.VTypes, { - IPAddress: function(v) { + IPAddress: function (v) { return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v); }, IPAddressText: 'Must be a numeric IP address', @@ -28,7 +28,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { title: _('Network'), header: false, - initComponent: function() { + initComponent: function () { Deluge.preferences.Network.superclass.initComponent.call(this); var optMan = deluge.preferences.getOptionsManager(); @@ -71,7 +71,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { height: 22, listeners: { check: { - fn: function(e, checked) { + fn: function (e, checked) { this.listenPort.setDisabled(checked); }, scope: this, @@ -133,7 +133,7 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { height: 22, listeners: { check: { - fn: function(e, checked) { + fn: function (e, checked) { this.outgoingPorts.setDisabled(checked); }, scope: this, diff --git a/deluge/ui/web/js/deluge-all/preferences/OtherPage.js b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js index 153820357..607da226d 100644 --- a/deluge/ui/web/js/deluge-all/preferences/OtherPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/OtherPage.js @@ -14,7 +14,7 @@ Ext.namespace('Deluge.preferences'); * @extends Ext.form.FormPanel */ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { border: false, @@ -27,7 +27,7 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Other.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.preferences.Other.superclass.initComponent.call(this); var optMan = deluge.preferences.getOptionsManager(); diff --git a/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js index e22fc7fd9..f771d96a0 100644 --- a/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/PluginsPage.js @@ -40,7 +40,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { '</dl>' ), - initComponent: function() { + initComponent: function () { Deluge.preferences.Plugins.superclass.initComponent.call(this); this.defaultValues = { version: '', @@ -50,7 +50,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }; this.pluginTemplate.compile(); - var checkboxRenderer = function(v, p, record) { + var checkboxRenderer = function (v, p, record) { p.css += ' x-grid3-check-col-td'; return ( '<div class="x-grid3-check-col' + (v ? '-on' : '') + '"> </div>' @@ -72,7 +72,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { width: 0.2, sortable: true, tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', { - getCheckbox: function(v) { + getCheckbox: function (v) { return ( '<div class="x-grid3-check-col' + (v ? '-on' : '') + @@ -141,23 +141,23 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this); }, - disablePlugin: function(plugin) { + disablePlugin: function (plugin) { deluge.client.core.disable_plugin(plugin); }, - enablePlugin: function(plugin) { + enablePlugin: function (plugin) { deluge.client.core.enable_plugin(plugin); }, - setInfo: function(plugin) { + setInfo: function (plugin) { if (!this.pluginInfo.rendered) return; var values = plugin || this.defaultValues; this.pluginInfo.body.dom.innerHTML = this.pluginTemplate.apply(values); }, - updatePlugins: function() { - var onGotAvailablePlugins = function(plugins) { - this.availablePlugins = plugins.sort(function(a, b) { + updatePlugins: function () { + var onGotAvailablePlugins = function (plugins) { + this.availablePlugins = plugins.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); @@ -167,7 +167,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }); }; - var onGotEnabledPlugins = function(plugins) { + var onGotEnabledPlugins = function (plugins) { this.enabledPlugins = plugins; this.onGotPlugins(); }; @@ -178,11 +178,11 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }); }, - updatePluginsGrid: function() { + updatePluginsGrid: function () { var plugins = []; Ext.each( this.availablePlugins, - function(plugin) { + function (plugin) { if (this.enabledPlugins.indexOf(plugin) > -1) { plugins.push([true, plugin]); } else { @@ -194,7 +194,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { this.list.getStore().loadData(plugins); }, - onNodeClick: function(dv, index, node, e) { + onNodeClick: function (dv, index, node, e) { var el = new Ext.Element(e.target); if (el.getAttribute('rel') != 'chkbox') return; @@ -209,16 +209,16 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { } }, - onFindMorePlugins: function() { + onFindMorePlugins: function () { window.open('http://dev.deluge-torrent.org/wiki/Plugins'); }, - onGotPlugins: function() { + onGotPlugins: function () { this.setInfo(); this.updatePluginsGrid(); }, - onGotPluginInfo: function(info) { + onGotPluginInfo: function (info) { var values = { author: info['Author'], version: info['Version'], @@ -230,7 +230,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { delete info; }, - onInstallPluginWindow: function() { + onInstallPluginWindow: function () { if (!this.installWindow) { this.installWindow = new Deluge.preferences.InstallPluginWindow(); this.installWindow.on('pluginadded', this.onPluginInstall, this); @@ -238,7 +238,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { this.installWindow.show(); }, - onPluginEnabled: function(pluginName) { + onPluginEnabled: function (pluginName) { var index = this.list.getStore().find('plugin', pluginName); if (index == -1) return; var plugin = this.list.getStore().getAt(index); @@ -246,7 +246,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { plugin.commit(); }, - onPluginDisabled: function(pluginName) { + onPluginDisabled: function (pluginName) { var index = this.list.getStore().find('plugin', pluginName); if (index == -1) return; var plugin = this.list.getStore().getAt(index); @@ -254,11 +254,11 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { plugin.commit(); }, - onPluginInstall: function() { + onPluginInstall: function () { this.updatePlugins(); }, - onPluginSelect: function(dv, selections) { + onPluginSelect: function (dv, selections) { if (selections.length == 0) return; var r = dv.getRecords(selections)[0]; deluge.client.web.get_plugin_info(r.get('plugin'), { @@ -267,11 +267,11 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { }); }, - onPreferencesShow: function() { + onPreferencesShow: function () { this.updatePlugins(); }, - onPluginInfoRender: function(ct, position) { + onPluginInfoRender: function (ct, position) { this.setInfo(); }, }); diff --git a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js index 1bc98a8f1..ed2abdcdc 100644 --- a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js +++ b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js @@ -36,7 +36,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { pages: {}, - initComponent: function() { + initComponent: function () { Deluge.preferences.PreferencesWindow.superclass.initComponent.call( this ); @@ -94,7 +94,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { this.initPages(); }, - initPages: function() { + initPages: function () { deluge.preferences = this; this.addPage(new Deluge.preferences.Downloads()); this.addPage(new Deluge.preferences.Network()); @@ -109,7 +109,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { this.addPage(new Deluge.preferences.Plugins()); }, - onApply: function(e) { + onApply: function (e) { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { // Workaround for only displaying single listen port but still pass array to core. @@ -134,7 +134,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { * Return the options manager for the preferences window. * @returns {Deluge.OptionsManager} the options manager */ - getOptionsManager: function() { + getOptionsManager: function () { return this.optionsManager; }, @@ -142,7 +142,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { * Adds a page to the preferences window. * @param {Mixed} page */ - addPage: function(page) { + addPage: function (page) { var store = this.list.getStore(); var name = page.title; store.add([new PreferencesRecord({ name: name })]); @@ -157,7 +157,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { * Removes a preferences page from the window. * @param {mixed} name */ - removePage: function(page) { + removePage: function (page) { var name = page.title; var store = this.list.getStore(); store.removeAt(store.find('name', name)); @@ -169,7 +169,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { * Select which preferences page is displayed. * @param {String} page The page name to change to */ - selectPage: function(page) { + selectPage: function (page) { if (this.pages[page].index < 0) { this.pages[page].index = this.configPanel.items.indexOf( this.pages[page] @@ -179,7 +179,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { }, // private - doSelectPage: function(page) { + doSelectPage: function (page) { if (this.pages[page].index < 0) { this.pages[page].index = this.configPanel.items.indexOf( this.pages[page] @@ -190,23 +190,23 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { }, // private - onGotConfig: function(config) { + onGotConfig: function (config) { this.getOptionsManager().set(config); }, // private - onPageSelect: function(list, selections) { + onPageSelect: function (list, selections) { var r = list.getRecord(selections[0]); this.doSelectPage(r.get('name')); }, // private - onSetConfig: function() { + onSetConfig: function () { this.getOptionsManager().commit(); }, // private - onAfterRender: function() { + onAfterRender: function () { if (!this.list.getSelectionCount()) { this.list.select(0); } @@ -214,7 +214,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { }, // private - onShow: function() { + onShow: function () { if (!deluge.client.core) return; deluge.client.core.get_config({ success: this.onGotConfig, @@ -223,12 +223,12 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { }, // private - onClose: function() { + onClose: function () { this.hide(); }, // private - onOk: function() { + onOk: function () { var changed = this.optionsManager.getDirty(); if (!Ext.isObjectEmpty(changed)) { deluge.client.core.set_config(changed, { diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyField.js b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js index 6d500baaa..d3bb0bf03 100644 --- a/deluge/ui/web/js/deluge-all/preferences/ProxyField.js +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js @@ -18,7 +18,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { autoHeight: true, labelWidth: 70, - initComponent: function() { + initComponent: function () { Deluge.preferences.ProxyField.superclass.initComponent.call(this); this.proxyType = this.add({ xtype: 'combo', @@ -145,11 +145,11 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.setting = false; }, - getName: function() { + getName: function () { return this.initialConfig.name; }, - getValue: function() { + getValue: function () { return { type: this.proxyType.getValue(), hostname: this.hostname.getValue(), @@ -165,7 +165,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { }, // Set the values of the proxies - setValue: function(value) { + setValue: function (value) { this.setting = true; this.proxyType.setValue(value['type']); var index = this.proxyType.getStore().find('id', value['type']); @@ -185,7 +185,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.setting = false; }, - onFieldChange: function(field, newValue, oldValue) { + onFieldChange: function (field, newValue, oldValue) { if (this.setting) return; var newValues = this.getValue(); var oldValues = Ext.apply({}, newValues); @@ -194,7 +194,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.fireEvent('change', this, newValues, oldValues); }, - onTypeSelect: function(combo, record, index) { + onTypeSelect: function (combo, record, index) { var typeId = record.get('id'); if (typeId > 0) { this.hostname.show(); diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js index 4d3c40297..2dc4cae7e 100644 --- a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js @@ -14,7 +14,7 @@ Ext.namespace('Deluge.preferences'); * @extends Ext.form.FormPanel */ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { border: false, @@ -28,7 +28,7 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Proxy.superclass.constructor.call(this, config); }, - initComponent: function() { + initComponent: function () { Deluge.preferences.Proxy.superclass.initComponent.call(this); this.proxy = this.add( new Deluge.preferences.ProxyField({ @@ -40,19 +40,19 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { deluge.preferences.getOptionsManager().bind('proxy', this.proxy); }, - getValue: function() { + getValue: function () { return { proxy: this.proxy.getValue(), }; }, - setValue: function(value) { + setValue: function (value) { for (var proxy in value) { this[proxy].setValue(value[proxy]); } }, - onProxyChange: function(field, newValue, oldValue) { + onProxyChange: function (field, newValue, oldValue) { var newValues = this.getValue(); var oldValues = Ext.apply({}, newValues); oldValues[field.getName()] = oldValue; diff --git a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js index db2da7c1b..c7b47c57c 100644 --- a/deluge/ui/web/js/deluge-all/preferences/QueuePage.js +++ b/deluge/ui/web/js/deluge-all/preferences/QueuePage.js @@ -19,7 +19,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { header: false, layout: 'form', - initComponent: function() { + initComponent: function () { Deluge.preferences.Queue.superclass.initComponent.call(this); var om = deluge.preferences.getOptionsManager(); @@ -227,7 +227,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { om.bind('remove_seed_at_ratio', this.removeAtRatio); }, - onStopRatioCheck: function(e, checked) { + onStopRatioCheck: function (e, checked) { this.stopRatio.setDisabled(!checked); this.removeAtRatio.setDisabled(!checked); }, |