diff options
114 files changed, 954 insertions, 1033 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c80703764..133d536dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,28 +6,29 @@ exclude: > )$ repos: - repo: https://github.com/ambv/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black name: Fmt Black - language_version: python3.6 - - repo: https://github.com/prettier/prettier - rev: 1.19.1 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.2.1 hooks: - id: prettier name: Fmt Prettier # Workaround to list modified files only. args: [--list-different] - repo: https://gitlab.com/pycqa/flake8 + # v3.7.9 due to E402 issue: https://gitlab.com/pycqa/flake8/-/issues/638 rev: 3.7.9 hooks: - id: flake8 name: Chk Flake8 additional_dependencies: - - flake8-isort==2.7 - - pep8-naming==0.8.2 + - flake8-isort==4.0.0 + - pep8-naming==0.11.1 + args: [--isort-show-traceback] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v3.4.0 hooks: - id: double-quote-string-fixer name: Fix Double-quotes diff --git a/.travis.yml b/.travis.yml index b10ec78a9..ac4c79b1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,8 @@ dist: xenial language: python python: # Travis Xenial Python to support system_site_packages - - 3.5 + - 3.5_with_system_site_packages cache: pip -virtualenv: - system_site_packages: true env: global: @@ -21,19 +19,20 @@ jobs: include: - name: Unit tests env: TOX_ENV=py3 - - name: Unit tests - libtorrent 1.2 - env: TOX_ENV=py3 - addons: - apt: - sources: [sourceline: "ppa:libtorrent.org/1.2-daily"] - packages: [python3-libtorrent, python3-venv] + #~ - name: Unit tests - libtorrent 1.2 + #~ env: TOX_ENV=py3 + #~ addons: + #~ apt: + #~ sources: [sourceline: "ppa:libtorrent.org/1.2-daily"] + #~ packages: [python3-libtorrent, python3-venv] - name: Unit tests - Python 2 env: TOX_ENV=py27 - python: 2.7 + python: 2.7_with_system_site_packages - if: commit_message =~ SECURITY_TEST env: TOX_ENV=security - name: Code linting env: TOX_ENV=lint + python: 3.6 - name: Docs build env: TOX_ENV=docs - name: GTK unit tests @@ -73,7 +72,9 @@ install: before_script: - export PYTHONPATH=$PYTHONPATH:$PWD # Verify libtorrent installed and version - - python -c "import libtorrent as lt; print(lt.__version__)" + - "if [ $TOX_ENV != 'lint' ]; then + python -c 'import libtorrent as lt; print(lt.__version__)'; + fi" # Start xvfb for the GTKUI tests - "if [ $TOX_ENV == 'gtkui' ]; then /sbin/start-stop-daemon --start --quiet --background \ diff --git a/deluge/common.py b/deluge/common.py index d50fe5ac2..e90d166c0 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -43,8 +43,8 @@ try: from urllib.request import pathname2url except ImportError: # PY2 fallback - from urlparse import urljoin # pylint: disable=ungrouped-imports from urllib import pathname2url, unquote_plus # pylint: disable=ungrouped-imports + from urlparse import urljoin # pylint: disable=ungrouped-imports # Windows workaround for HTTPS requests requiring certificate authority bundle. # see: https://twistedmatrix.com/trac/ticket/9209 @@ -1013,9 +1013,9 @@ def decode_bytes(byte_str, encoding='utf8'): if encoding.lower() not in ['utf8', 'utf-8']: encodings.insert(0, lambda: (encoding, 'strict')) - for l in encodings: + for enc in encodings: try: - return byte_str.decode(*l()) + return byte_str.decode(*enc()) except UnicodeDecodeError: pass return '' @@ -1144,6 +1144,7 @@ AUTH_LEVEL_DEFAULT = AUTH_LEVEL_NORMAL def create_auth_file(): import stat + import deluge.configmanager auth_file = deluge.configmanager.get_config_dir('auth') @@ -1159,6 +1160,7 @@ def create_auth_file(): def create_localclient_account(append=False): import random from hashlib import sha1 as sha + import deluge.configmanager auth_file = deluge.configmanager.get_config_dir('auth') @@ -1244,8 +1246,7 @@ def set_env_variable(name, value): os.environ[name] = value.encode('utf8') if windows_check(): - from ctypes import windll - from ctypes import cdll + from ctypes import cdll, windll # Update the copy maintained by Windows (so SysInternals Process Explorer sees it) result = windll.kernel32.SetEnvironmentVariableW(name, value) @@ -1274,7 +1275,7 @@ def unicode_argv(): # Versions 2.x of Python don't support Unicode in sys.argv on # Windows, with the underlying Windows API instead replacing multi-byte # characters with '?'. - from ctypes import POINTER, byref, cdll, c_int, windll + from ctypes import POINTER, byref, c_int, cdll, windll from ctypes.wintypes import LPCWSTR, LPWSTR get_cmd_linew = cdll.kernel32.GetCommandLineW diff --git a/deluge/config.py b/deluge/config.py index 90944a38f..80b30faf5 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -204,9 +204,9 @@ class Config(object): global callLater if callLater is None: # Must import here and not at the top or it will throw ReactorAlreadyInstalledError - from twisted.internet.reactor import ( + from twisted.internet.reactor import ( # pylint: disable=redefined-outer-name callLater, - ) # pylint: disable=redefined-outer-name + ) # Run the set_function for this key if any try: for func in self.__set_functions[key]: @@ -304,9 +304,9 @@ class Config(object): global callLater if callLater is None: # Must import here and not at the top or it will throw ReactorAlreadyInstalledError - from twisted.internet.reactor import ( + from twisted.internet.reactor import ( # pylint: disable=redefined-outer-name callLater, - ) # pylint: disable=redefined-outer-name + ) # We set the save_timer for 5 seconds if not already set if not self._save_timer or not self._save_timer.active(): diff --git a/deluge/core/core.py b/deluge/core/core.py index 8498ff9a8..2160f769a 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -57,10 +57,10 @@ from deluge.event import ( from deluge.httpdownloader import download_file try: - from urllib.request import urlopen, URLError + from urllib.request import URLError, urlopen except ImportError: # PY2 fallback - from urllib2 import urlopen, URLError + from urllib2 import URLError, urlopen log = logging.getLogger(__name__) diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py index d7ab813ba..3c2ac643b 100644 --- a/deluge/core/daemon.py +++ b/deluge/core/daemon.py @@ -200,6 +200,7 @@ class Daemon(object): if rpc not in self.get_method_list(): return False - return self.rpcserver.get_session_auth_level() >= self.rpcserver.get_rpc_auth_level( - rpc + return ( + self.rpcserver.get_session_auth_level() + >= self.rpcserver.get_rpc_auth_level(rpc) ) diff --git a/deluge/core/filtermanager.py b/deluge/core/filtermanager.py index 9d8964689..90589ef1f 100644 --- a/deluge/core/filtermanager.py +++ b/deluge/core/filtermanager.py @@ -100,9 +100,7 @@ def tracker_error_filter(torrent_ids, values): class FilterManager(component.Component): - """FilterManager - - """ + """FilterManager""" def __init__(self, core): component.Component.__init__(self, 'FilterManager') diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index b69909cbb..be91b9da5 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -1340,8 +1340,8 @@ class Torrent(object): def scrape_tracker(self): """Scrape the tracker - A scrape request queries the tracker for statistics such as total - number of incomplete peers, complete peers, number of downloads etc. + A scrape request queries the tracker for statistics such as total + number of incomplete peers, complete peers, number of downloads etc. """ try: self.handle.scrape_tracker() diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js index 40086b3fa..ebed40180 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd.js @@ -25,7 +25,7 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { border: false, watchdirs: {}, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.AutoAddPage.superclass.initComponent.call(this); var autoAdd = this; @@ -41,10 +41,10 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { sortable: true, dataIndex: 'enabled', tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', { - getCheckbox: function(checked, selected) { + getCheckbox: function (checked, selected) { Deluge.ux.AutoAdd.onClickFunctions[ selected.id - ] = function() { + ] = function () { if (selected.enabled) { deluge.client.autoadd.disable_watchdir( selected.id @@ -122,9 +122,9 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.on('show', this.onPreferencesShow, this); }, - updateWatchDirs: function() { + updateWatchDirs: function () { deluge.client.autoadd.get_watchdirs({ - success: function(watchdirs) { + success: function (watchdirs) { this.watchdirs = watchdirs; var watchdirsArray = []; for (var id in watchdirs) { @@ -145,12 +145,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { }); }, - onAddClick: function() { + onAddClick: function () { if (!this.addWin) { this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow(); this.addWin.on( 'watchdiradd', - function() { + function () { this.updateWatchDirs(); }, this @@ -159,12 +159,12 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.addWin.show(); }, - onEditClick: function() { + onEditClick: function () { if (!this.editWin) { this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow(); this.editWin.on( 'watchdiredit', - function() { + function () { this.updateWatchDirs(); }, this @@ -174,39 +174,27 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { this.editWin.show(id, this.watchdirs[id]); }, - onPreferencesShow: function() { + onPreferencesShow: function () { this.updateWatchDirs(); }, - onRemoveClick: function() { + onRemoveClick: function () { var record = this.list.getSelectedRecords()[0]; deluge.client.autoadd.remove(record.id, { - success: function() { + success: function () { this.updateWatchDirs(); }, scope: this, }); }, - onSelectionChange: function(dv, selections) { + onSelectionChange: function (dv, selections) { if (selections.length) { - this.panel - .getBottomToolbar() - .items.get(1) - .enable(); - this.panel - .getBottomToolbar() - .items.get(3) - .enable(); + this.panel.getBottomToolbar().items.get(1).enable(); + this.panel.getBottomToolbar().items.get(3).enable(); } else { - this.panel - .getBottomToolbar() - .items.get(1) - .disable(); - this.panel - .getBottomToolbar() - .items.get(3) - .disable(); + this.panel.getBottomToolbar().items.get(1).disable(); + this.panel.getBottomToolbar().items.get(3).disable(); } }, }); @@ -218,12 +206,12 @@ Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, { prefsPage: null, }, - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(Deluge.plugins.AutoAddPlugin.prefsPage); Deluge.plugins.AutoAddPlugin.prefsPage = null; }, - onEnable: function() { + onEnable: function () { /* * Called for each of the JavaScript files. * This will prevent adding unnecessary tabs to the preferences window. diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js index 49f752fbf..797d76585 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options.js @@ -60,7 +60,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { ], }), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddWindowBase.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -81,11 +81,11 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { }); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - getOptions: function() { + getOptions: function () { var options = {}; options['enabled'] = Ext.getCmp('enabled').getValue(); @@ -102,22 +102,22 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { options['append_extension'] = Ext.getCmp('append_extension').getValue(); options['owner'] = Ext.getCmp('owner').getValue(); - this.toggle_ids.forEach(function(toggle_id) { + this.toggle_ids.forEach(function (toggle_id) { options[toggle_id] = Ext.getCmp(toggle_id).getValue(); }); - this.spin_ids.forEach(function(spin_id) { + this.spin_ids.forEach(function (spin_id) { options[spin_id] = Ext.getCmp(spin_id).getValue(); options[spin_id + '_toggle'] = Ext.getCmp( spin_id + '_toggle' ).getValue(); }); - this.spin_int_ids.forEach(function(spin_int_id) { + this.spin_int_ids.forEach(function (spin_int_id) { options[spin_int_id] = Ext.getCmp(spin_int_id).getValue(); options[spin_int_id + '_toggle'] = Ext.getCmp( spin_int_id + '_toggle' ).getValue(); }); - this.chk_ids.forEach(function(chk_id) { + this.chk_ids.forEach(function (chk_id) { options[chk_id] = Ext.getCmp(chk_id).getValue(); options[chk_id + '_toggle'] = Ext.getCmp( chk_id + '_toggle' @@ -137,7 +137,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { return options; }, - loadOptions: function(options) { + loadOptions: function (options) { /* * Populate all available options data to the UI */ @@ -193,7 +193,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { : false ); - this.spin_ids.forEach(function(spin_id) { + this.spin_ids.forEach(function (spin_id) { Ext.getCmp(spin_id).setValue( options[spin_id] !== undefined ? options[spin_id] : 0 ); @@ -203,7 +203,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { : false ); }); - this.chk_ids.forEach(function(chk_id) { + this.chk_ids.forEach(function (chk_id) { Ext.getCmp(chk_id).setValue( options[chk_id] !== undefined ? options[chk_id] : true ); @@ -237,14 +237,14 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { 'path', 'download_location', 'copy_torrent', - ].forEach(function(field) { + ].forEach(function (field) { value = options[field] !== undefined ? options[field] : ''; Ext.getCmp(field).setValue(value); }); if (Object.keys(options).length === 0) { deluge.client.core.get_config({ - success: function(config) { + success: function (config) { var value; Ext.getCmp('download_location').setValue( options['download_location'] !== undefined @@ -291,11 +291,11 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { } deluge.client.core.get_enabled_plugins({ - success: function(plugins) { + success: function (plugins) { if (plugins !== undefined && plugins.indexOf('Label') > -1) { this.MainTab.LabelFset.setVisible(true); deluge.client.label.get_labels({ - success: function(labels) { + success: function (labels) { for ( var index = 0; index < labels.length; @@ -305,7 +305,7 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { } this.labels.loadData(labels, false); }, - failure: function(failure) { + failure: function (failure) { console.error(failure); }, scope: this, @@ -324,30 +324,26 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { accounts[index] = [accounts[index]['username']]; } me.accounts.loadData(accounts, false); - Ext.getCmp('owner') - .setValue(owner) - .enable(); + Ext.getCmp('owner').setValue(owner).enable(); } function on_accounts_failure(failure) { deluge.client.autoadd.get_auth_user({ - success: function(user) { + success: function (user) { me.accounts.loadData([[user]], false); - Ext.getCmp('owner') - .setValue(user) - .disable(true); + Ext.getCmp('owner').setValue(user).disable(true); }, scope: this, }); } deluge.client.autoadd.is_admin_level({ - success: function(is_admin) { + success: function (is_admin) { if (is_admin) { deluge.client.core.get_known_accounts({ - success: function(accounts) { + success: function (accounts) { deluge.client.autoadd.get_auth_user({ - success: function(user) { + success: function (user) { on_accounts( accounts, options['owner'] !== undefined @@ -379,7 +375,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( { title: _('Edit Watch Folder'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.initComponent.call( this ); @@ -389,7 +385,7 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( }); }, - show: function(watchdir_id, options) { + show: function (watchdir_id, options) { Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.show.call( this ); @@ -397,11 +393,11 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend( this.loadOptions(options); }, - onSaveClick: function() { + onSaveClick: function () { try { var options = this.getOptions(); deluge.client.autoadd.set_options(this.watchdir_id, options, { - success: function() { + success: function () { this.fireEvent('watchdiredit', this, options); }, scope: this, @@ -429,7 +425,7 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend( { title: _('Add Watch Folder'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.initComponent.call( this ); @@ -439,21 +435,21 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend( }); }, - show: function() { + show: function () { Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.show.call( this ); this.loadOptions(); }, - onAddClick: function() { + onAddClick: function () { var options = this.getOptions(); deluge.client.autoadd.add(options, { - success: function() { + success: function () { this.fireEvent('watchdiradd', this, options); this.hide(); }, - failure: function(err) { + failure: function (err) { const regex = /: (.*\n)\n?\]/m; var error; if ((error = regex.exec(err.error.message)) !== null) { diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js index 79d2600de..f685ff29f 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/main_tab.js @@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { id: 'main_tab_panel', title: _('Main'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddMainPanel.superclass.initComponent.call(this); this.watchFolderFset = new Ext.form.FieldSet({ xtype: 'fieldset', @@ -69,7 +69,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { checked: true, hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -98,7 +98,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { ), hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -141,7 +141,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { ), hideLabel: true, listeners: { - check: function(cb, newValue) { + check: function (cb, newValue) { if (newValue) { Ext.getCmp( 'append_extension' @@ -201,7 +201,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Set download folder'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('download_location').setDisabled( !checked ); @@ -233,7 +233,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Set move completed folder'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('move_completed_path').setDisabled( !checked ); @@ -271,7 +271,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Label:'), listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('label').setDisabled(!checked); }, }, diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js index a69490c25..4ce030efe 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js +++ b/deluge/plugins/AutoAdd/deluge_autoadd/data/autoadd_options/options_tab.js @@ -19,7 +19,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { id: 'options_tab_panel', title: _('Options'), - initComponent: function() { + initComponent: function () { Deluge.ux.AutoAdd.AutoAddOptionsPanel.superclass.initComponent.call( this ); @@ -149,7 +149,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { hideLabel: true, width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp('stop_ratio').setDisabled( !checked ); @@ -223,7 +223,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { this.add([this.ownerFset, this.bandwidthFset, this.queueFset]); }, - _getBandwidthContainer: function(values) { + _getBandwidthContainer: function (values) { return new Ext.Container({ xtype: 'container', layout: 'hbox', @@ -236,7 +236,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { boxLabel: _(values.labelCheckbox), width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp(values.idSpinner).setDisabled(!checked); }, }, @@ -257,7 +257,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { }); }, - _getQueueContainer: function(values) { + _getQueueContainer: function (values) { return new Ext.Container({ xtype: 'container', layout: 'hbox', @@ -270,7 +270,7 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, { boxLabel: _(values.labelCheckbox), width: 175, listeners: { - check: function(cb, checked) { + check: function (cb, checked) { Ext.getCmp(values.nameRadio).setDisabled(!checked); Ext.getCmp('not_' + values.nameRadio).setDisabled( !checked diff --git a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js index 8e4769c5f..8f1b93c21 100644 --- a/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js +++ b/deluge/plugins/Blocklist/deluge_blocklist/data/blocklist.js @@ -22,7 +22,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { border: false, autoScroll: true, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.BlocklistPage.superclass.initComponent.call(this); this.URLFset = this.add({ @@ -210,11 +210,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { fields: [{ name: 'ip' }], }), listeners: { - afteredit: function(e) { + afteredit: function (e) { e.record.commit(); }, }, - setEmptyText: function(text) { + setEmptyText: function (text) { if (this.viewReady) { this.getView().emptyText = text; this.getView().refresh(); @@ -222,7 +222,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { Ext.apply(this.viewConfig, { emptyText: text }); } }, - loadData: function(data) { + loadData: function (data) { this.getStore().loadData(data); if (this.viewReady) { this.getView().updateHeaders(); @@ -264,7 +264,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { this.forceDownload.setHandler(this.forceDown, this); }, - onApply: function() { + onApply: function () { var config = {}; config['url'] = this.URL.getValue(); @@ -285,13 +285,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { deluge.client.blocklist.set_config(config); }, - onOk: function() { + onOk: function () { this.onApply(); }, - onUpdate: function() { + onUpdate: function () { deluge.client.blocklist.get_status({ - success: function(status) { + success: function (status) { if (status['state'] == 'Downloading') { this.InfoFset.hide(); this.checkDownload.getComponent(0).setDisabled(true); @@ -339,19 +339,19 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { }); }, - checkDown: function() { + checkDown: function () { this.onApply(); deluge.client.blocklist.check_import(); }, - forceDown: function() { + forceDown: function () { this.onApply(); deluge.client.blocklist.check_import((force = true)); }, - updateConfig: function() { + updateConfig: function () { deluge.client.blocklist.get_config({ - success: function(config) { + success: function (config) { this.URL.setValue(config['url']); this.checkListDays.setValue(config['check_after_days']); this.chkImportOnStart.setValue(config['load_on_start']); @@ -369,7 +369,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { }); deluge.client.blocklist.get_status({ - success: function(status) { + success: function (status) { this.lblFileSize.setText(fsize(status['file_size'])); this.lblDate.setText(fdate(status['file_date'])); this.lblType.setText(status['file_type']); @@ -381,7 +381,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { }); }, - addIP: function() { + addIP: function () { var store = this.WhitelistFset.getComponent(0).getStore(); var IP = store.recordType; var i = new IP({ @@ -392,7 +392,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { this.WhitelistFset.getComponent(0).startEditing(0, 0); }, - deleteIP: function() { + deleteIP: function () { var selections = this.WhitelistFset.getComponent(0) .getSelectionModel() .getSelections(); @@ -403,7 +403,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { store.commitChanges(); }, - onDestroy: function() { + onDestroy: function () { Ext.TaskMgr.stop(this.updateTask); deluge.preferences.un('show', this.updateConfig, this); @@ -415,11 +415,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { Deluge.plugins.BlocklistPlugin = Ext.extend(Deluge.Plugin, { name: 'Blocklist', - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.BlocklistPage() ); diff --git a/deluge/plugins/Execute/deluge_execute/data/execute.js b/deluge/plugins/Execute/deluge_execute/data/execute.js index bd6ac9860..dc0b11126 100644 --- a/deluge/plugins/Execute/deluge_execute/data/execute.js +++ b/deluge/plugins/Execute/deluge_execute/data/execute.js @@ -18,7 +18,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, { height: 130, closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.ux.ExecuteWindowBase.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); @@ -56,7 +56,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, { }); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, }); @@ -64,7 +64,7 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, { Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { title: _('Edit Command'), - initComponent: function() { + initComponent: function () { Deluge.ux.EditExecuteCommandWindow.superclass.initComponent.call(this); this.addButton(_('Save'), this.onSaveClick, this); this.addEvents({ @@ -72,7 +72,7 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { }); }, - show: function(command) { + show: function (command) { Deluge.ux.EditExecuteCommandWindow.superclass.show.call(this); this.command = command; this.form.getForm().setValues({ @@ -81,14 +81,14 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { }); }, - onSaveClick: function() { + onSaveClick: function () { var values = this.form.getForm().getFieldValues(); deluge.client.execute.save_command( this.command.id, values.event, values.command, { - success: function() { + success: function () { this.fireEvent( 'commandedit', this, @@ -106,7 +106,7 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { title: _('Add Command'), - initComponent: function() { + initComponent: function () { Deluge.ux.AddExecuteCommandWindow.superclass.initComponent.call(this); this.addButton(_('Add'), this.onAddClick, this); this.addEvents({ @@ -114,10 +114,10 @@ Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { }); }, - onAddClick: function() { + onAddClick: function () { var values = this.form.getForm().getFieldValues(); deluge.client.execute.add_command(values.event, values.command, { - success: function() { + success: function () { this.fireEvent( 'commandadd', this, @@ -143,7 +143,7 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { layout: 'fit', border: false, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.ExecutePage.superclass.initComponent.call(this); var event_map = (this.event_map = { complete: _('Torrent Complete'), @@ -166,7 +166,7 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { sortable: true, dataIndex: 'event', tpl: new Ext.XTemplate('{[this.getEvent(values.event)]}', { - getEvent: function(e) { + getEvent: function (e) { return event_map[e] ? event_map[e] : e; }, }), @@ -215,21 +215,21 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { this.on('show', this.onPreferencesShow, this); }, - updateCommands: function() { + updateCommands: function () { deluge.client.execute.get_commands({ - success: function(commands) { + success: function (commands) { this.list.getStore().loadData(commands); }, scope: this, }); }, - onAddClick: function() { + onAddClick: function () { if (!this.addWin) { this.addWin = new Deluge.ux.AddExecuteCommandWindow(); this.addWin.on( 'commandadd', - function() { + function () { this.updateCommands(); }, this @@ -238,19 +238,19 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { this.addWin.show(); }, - onCommandAdded: function(win, evt, cmd) { + onCommandAdded: function (win, evt, cmd) { var record = new this.list.getStore().recordType({ event: evt, command: cmd, }); }, - onEditClick: function() { + onEditClick: function () { if (!this.editWin) { this.editWin = new Deluge.ux.EditExecuteCommandWindow(); this.editWin.on( 'commandedit', - function() { + function () { this.updateCommands(); }, this @@ -259,39 +259,27 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { this.editWin.show(this.list.getSelectedRecords()[0]); }, - onPreferencesShow: function() { + onPreferencesShow: function () { this.updateCommands(); }, - onRemoveClick: function() { + onRemoveClick: function () { var record = this.list.getSelectedRecords()[0]; deluge.client.execute.remove_command(record.id, { - success: function() { + success: function () { this.updateCommands(); }, scope: this, }); }, - onSelectionChange: function(dv, selections) { + onSelectionChange: function (dv, selections) { if (selections.length) { - this.panel - .getBottomToolbar() - .items.get(1) - .enable(); - this.panel - .getBottomToolbar() - .items.get(3) - .enable(); + this.panel.getBottomToolbar().items.get(1).enable(); + this.panel.getBottomToolbar().items.get(3).enable(); } else { - this.panel - .getBottomToolbar() - .items.get(1) - .disable(); - this.panel - .getBottomToolbar() - .items.get(3) - .disable(); + this.panel.getBottomToolbar().items.get(1).disable(); + this.panel.getBottomToolbar().items.get(3).disable(); } }, }); @@ -299,11 +287,11 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { Deluge.plugins.ExecutePlugin = Ext.extend(Deluge.Plugin, { name: 'Execute', - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.ExecutePage() ); diff --git a/deluge/plugins/Extractor/deluge_extractor/data/extractor.js b/deluge/plugins/Extractor/deluge_extractor/data/extractor.js index b11cb30f6..952b6450b 100644 --- a/deluge/plugins/Extractor/deluge_extractor/data/extractor.js +++ b/deluge/plugins/Extractor/deluge_extractor/data/extractor.js @@ -21,7 +21,7 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { layout: 'fit', border: false, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.ExtractorPage.superclass.initComponent.call(this); this.form = this.add({ @@ -59,7 +59,7 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { this.on('show', this.updateConfig, this); }, - onApply: function() { + onApply: function () { // build settings object var config = {}; @@ -69,13 +69,13 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { deluge.client.extractor.set_config(config); }, - onOk: function() { + onOk: function () { this.onApply(); }, - updateConfig: function() { + updateConfig: function () { deluge.client.extractor.get_config({ - success: function(config) { + success: function (config) { this.extract_path.setValue(config['extract_path']); this.use_name_folder.setValue(config['use_name_folder']); }, @@ -87,11 +87,11 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, { name: 'Extractor', - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.ExtractorPage() ); diff --git a/deluge/plugins/Label/deluge_label/data/label.js b/deluge/plugins/Label/deluge_label/data/label.js index ba7a7ac1d..b84ea6b69 100644 --- a/deluge/plugins/Label/deluge_label/data/label.js +++ b/deluge/plugins/Label/deluge_label/data/label.js @@ -20,7 +20,7 @@ Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, { layout: 'fit', border: false, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.LabelPage.superclass.initComponent.call(this); fieldset = this.add({ xtype: 'fieldset', @@ -56,7 +56,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { height: 100, closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.ux.AddLabelWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Ok'), this.onOkClick, this); @@ -76,7 +76,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { width: 220, listeners: { specialkey: { - fn: function(field, e) { + fn: function (field, e) { if (e.getKey() == 13) this.onOkClick(); }, scope: this, @@ -87,14 +87,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { }); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - onOkClick: function() { + onOkClick: function () { var label = this.form.getForm().getValues().name; deluge.client.label.add(label, { - success: function() { + success: function () { deluge.ui.update(); this.fireEvent('labeladded', label); }, @@ -103,17 +103,14 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { this.hide(); }, - onHide: function(comp) { + onHide: function (comp) { Deluge.ux.AddLabelWindow.superclass.onHide.call(this, comp); this.form.getForm().reset(); }, - onShow: function(comp) { + onShow: function (comp) { Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp); - this.form - .getForm() - .findField('name') - .focus(false, 150); + this.form.getForm().findField('name').focus(false, 150); }, }); @@ -127,7 +124,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { height: 240, closeAction: 'hide', - initComponent: function() { + initComponent: function () { Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this); this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Ok'), this.onOkClick, this); @@ -385,18 +382,18 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { }); }, - getLabelOptions: function() { + getLabelOptions: function () { deluge.client.label.get_options(this.label, { success: this.gotOptions, scope: this, }); }, - gotOptions: function(options) { + gotOptions: function (options) { this.form.getForm().setValues(options); }, - show: function(label) { + show: function (label) { Deluge.ux.LabelOptionsWindow.superclass.show.call(this); this.label = label; this.setTitle(_('Label Options') + ': ' + this.label); @@ -404,11 +401,11 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { this.getLabelOptions(); }, - onCancelClick: function() { + onCancelClick: function () { this.hide(); }, - onOkClick: function() { + onOkClick: function () { var values = this.form.getForm().getFieldValues(); if (values['auto_add_trackers']) { values['auto_add_trackers'] = values['auto_add_trackers'].split( @@ -419,9 +416,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { this.hide(); }, - onFieldChecked: function(field, checked) { + onFieldChecked: function (field, checked) { var fs = field.ownerCt.nextSibling(); - fs.items.each(function(field) { + fs.items.each(function (field) { field.setDisabled(!checked); }); }, @@ -436,7 +433,7 @@ Ext.ns('Deluge.plugins'); Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { name: 'Label', - createMenu: function() { + createMenu: function () { this.labelMenu = new Ext.menu.Menu({ items: [ { @@ -462,7 +459,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { }); }, - setFilter: function(filter) { + setFilter: function (filter) { filter.show_zero = true; filter.list.on('contextmenu', this.onLabelContextMenu, this); @@ -470,7 +467,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.filter = filter; }, - updateTorrentMenu: function(states) { + updateTorrentMenu: function (states) { this.torrentMenu.removeAll(true); this.torrentMenu.addMenuItem({ text: _('No Label'), @@ -489,7 +486,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { } }, - onDisable: function() { + onDisable: function () { deluge.sidebar.un('filtercreate', this.onFilterCreate); deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate); delete Deluge.FilterPanel.templates.label; @@ -499,7 +496,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.LabelPage() ); @@ -539,17 +536,17 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.registerTorrentStatus('label', _('Label')); }, - onAfterFilterCreate: function(sidebar, filter) { + onAfterFilterCreate: function (sidebar, filter) { if (filter.filter != 'label') return; this.updateTorrentMenu(filter.getStates()); }, - onFilterCreate: function(sidebar, filter) { + onFilterCreate: function (sidebar, filter) { if (filter.filter != 'label') return; this.setFilter(filter); }, - onLabelAddClick: function() { + onLabelAddClick: function () { if (!this.addWindow) { this.addWindow = new Deluge.ux.AddLabelWindow(); this.addWindow.on('labeladded', this.onLabelAdded, this); @@ -557,7 +554,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.addWindow.show(); }, - onLabelAdded: function(label) { + onLabelAdded: function (label) { var filter = deluge.sidebar.getFilter('label'); var states = filter.getStates(); var statesArray = []; @@ -582,7 +579,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.updateTorrentMenu(states); }, - onLabelContextMenu: function(dv, i, node, e) { + onLabelContextMenu: function (dv, i, node, e) { e.preventDefault(); if (!this.labelMenu) this.createMenu(); var r = dv.getRecord(node).get('filter'); @@ -597,7 +594,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.labelMenu.showAt(e.getXY()); }, - onLabelHeaderContextMenu: function(e, t) { + onLabelHeaderContextMenu: function (e, t) { e.preventDefault(); if (!this.labelMenu) this.createMenu(); this.labelMenu.items.get(1).setDisabled(true); @@ -605,18 +602,18 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { this.labelMenu.showAt(e.getXY()); }, - onLabelOptionsClick: function() { + onLabelOptionsClick: function () { if (!this.labelOpts) this.labelOpts = new Deluge.ux.LabelOptionsWindow(); this.labelOpts.show(this.filter.getState()); }, - onLabelRemoveClick: function() { + onLabelRemoveClick: function () { var state = this.filter.getState(); deluge.client.label.remove(state, { - success: function() { + success: function () { deluge.ui.update(); - this.torrentMenu.items.each(function(item) { + this.torrentMenu.items.each(function (item) { if (item.text != state) return; this.torrentMenu.remove(item); var i = item; @@ -626,12 +623,12 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { }); }, - onTorrentMenuClick: function(item, e) { + onTorrentMenuClick: function (item, e) { var ids = deluge.torrents.getSelectedIds(); - Ext.each(ids, function(id, i) { + Ext.each(ids, function (id, i) { if (ids.length == i + 1) { deluge.client.label.set_torrent(id, item.label, { - success: function() { + success: function () { deluge.ui.update(); }, }); diff --git a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js index c9fb71fba..4b87e559f 100644 --- a/deluge/plugins/Notifications/deluge_notifications/data/notifications.js +++ b/deluge/plugins/Notifications/deluge_notifications/data/notifications.js @@ -21,7 +21,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { layout: 'fit', border: false, - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.NotificationsPage.superclass.initComponent.call( this ); @@ -44,7 +44,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { xtype: 'checkbox', boxLabel: _('Enabled'), listeners: { - check: function(object, checked) { + check: function (object, checked) { this.setSmtpDisabled(!checked); }, scope: this, @@ -227,11 +227,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { fields: [{ name: 'recipient' }], }), listeners: { - afteredit: function(e) { + afteredit: function (e) { e.record.commit(); }, }, - setEmptyText: function(text) { + setEmptyText: function (text) { if (this.viewReady) { this.getView().emptyText = text; this.getView().refresh(); @@ -239,7 +239,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { Ext.apply(this.viewConfig, { emptyText: text }); } }, - loadData: function(data) { + loadData: function (data) { this.getStore().loadData(data); if (this.viewReady) { this.getView().updateHeaders(); @@ -259,7 +259,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { }, colModel: new Ext.grid.ColumnModel({ defaults: { - renderer: function( + renderer: function ( value, meta, record, @@ -310,7 +310,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { ], }), listeners: { - cellclick: function(grid, rowIndex, colIndex, e) { + cellclick: function (grid, rowIndex, colIndex, e) { var record = grid.getStore().getAt(rowIndex); var field = grid.getColumnModel().getDataIndex(colIndex); var value = record.get(field); @@ -322,18 +322,18 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { } } }, - beforeedit: function(e) { + beforeedit: function (e) { if (Ext.isBoolean(e.value)) { return false; } return e.record.get('enabled'); }, - afteredit: function(e) { + afteredit: function (e) { e.record.commit(); }, }, - setEmptyText: function(text) { + setEmptyText: function (text) { if (this.viewReady) { this.getView().emptyText = text; this.getView().refresh(); @@ -341,13 +341,13 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { Ext.apply(this.viewConfig, { emptyText: text }); } }, - setSub: function(eventName) { + setSub: function (eventName) { var store = this.getStore(); var index = store.find('event', eventName); store.getAt(index).set('email', true); store.getAt(index).commit(); }, - loadData: function(data) { + loadData: function (data) { this.getStore().loadData(data); if (this.viewReady) { this.getView().updateHeaders(); @@ -374,9 +374,9 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { this.on('show', this.updateConfig, this); }, - updateConfig: function() { + updateConfig: function () { deluge.client.notifications.get_handled_events({ - success: function(events) { + success: function (events) { var data = []; var keys = Ext.keys(events); for (var i = 0; i < keys.length; i++) { @@ -388,7 +388,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { scope: this, }); deluge.client.notifications.get_config({ - success: function(config) { + success: function (config) { this.chkEnableEmail.setValue(config['smtp_enabled']); this.setSmtpDisabled(!config['smtp_enabled']); @@ -420,7 +420,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { }); }, - onApply: function() { + onApply: function () { var config = {}; config['smtp_enabled'] = this.chkEnableEmail.getValue(); @@ -461,11 +461,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { deluge.client.notifications.set_config(config); }, - onOk: function() { + onOk: function () { this.onApply(); }, - onAddClick: function() { + onAddClick: function () { var store = this.recipientsFset.getComponent(0).getStore(); var Recipient = store.recordType; var i = new Recipient({ @@ -476,7 +476,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { this.recipientsFset.getComponent(0).startEditing(0, 0); }, - onRemoveClick: function() { + onRemoveClick: function () { var selections = this.recipientsFset .getComponent(0) .getSelectionModel() @@ -488,7 +488,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { store.commitChanges(); }, - setSmtpDisabled: function(disable) { + setSmtpDisabled: function (disable) { this.hBoxHost.setDisabled(disable); this.hBoxPort.setDisabled(disable); this.hBoxUser.setDisabled(disable); @@ -498,7 +498,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { this.recipientsFset.getComponent(0).setDisabled(disable); }, - onDestroy: function() { + onDestroy: function () { deluge.preferences.un('show', this.updateConfig, this); Deluge.ux.preferences.NotificationsPage.superclass.onDestroy.call(this); @@ -508,11 +508,11 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, { name: 'Notifications', - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.NotificationsPage() ); diff --git a/deluge/plugins/Notifications/deluge_notifications/gtkui.py b/deluge/plugins/Notifications/deluge_notifications/gtkui.py index 486ee677a..cb26901a7 100644 --- a/deluge/plugins/Notifications/deluge_notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge_notifications/gtkui.py @@ -42,7 +42,7 @@ except ImportError: try: require_version('Notify', '0.7') - from gi.repository import Notify, GLib + from gi.repository import GLib, Notify except (ValueError, ImportError): POPUP_AVAILABLE = False else: diff --git a/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js b/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js index 13bec4605..f59068c5a 100644 --- a/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js +++ b/deluge/plugins/Scheduler/deluge_scheduler/data/scheduler.js @@ -40,7 +40,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { ], daysOfWeek: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - initComponent: function() { + initComponent: function () { Deluge.ux.ScheduleSelector.superclass.initComponent.call(this); // ExtJS' radiogroup implementation is very broken for styling. @@ -57,7 +57,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { });*/ }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.ux.ScheduleSelector.superclass.onRender.call(this, ct, position); var dom = this.body.dom; @@ -126,7 +126,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { Ext.each( this.daysOfWeek, - function(day) { + function (day) { var cells = []; var row = createEl(table, 'tr'); var label = createEl(row, 'th'); @@ -175,7 +175,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { ); }, - updateCell: function(cell) { + updateCell: function (cell) { // sanity check if (cell.currentValue == undefined) return; @@ -188,29 +188,29 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - getCurrentBrushValue: function() { + getCurrentBrushValue: function () { var v = null; var brushes = Ext.get(this.body.dom).findParent('form').elements[ this.stateBrushName ]; - Ext.each(brushes, function(b) { + Ext.each(brushes, function (b) { if (b.checked) v = b.value; }); return v; }, - onCellClick: function(event, cell) { + onCellClick: function (event, cell) { cell.oldValue = cell.currentValue; this.dragAnchor = null; }, - onCellMouseDown: function(event, cell) { + onCellMouseDown: function (event, cell) { this.dragAnchor = cell; }, - onCellMouseUp: function(event, cell) { + onCellMouseUp: function (event, cell) { // if we're dragging... if (this.dragAnchor) { // set all those between here and the anchor to the new values @@ -226,7 +226,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - onCellMouseOver: function(event, cell) { + onCellMouseOver: function (event, cell) { // LEFT TOOL TIP // if it isn't showing and we're dragging, show it. // otherwise if dragging, leave it alone unless we're dragging to the left. @@ -295,7 +295,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { // dragged into another day. Abort! Abort! Ext.each( this.daysOfWeek, - function(day) { + function (day) { this.revertCells(day, 0, 23); }, this @@ -323,7 +323,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - onCellMouseOut: function(event, cell) { + onCellMouseOut: function (event, cell) { if (!this.dragAnchor) this.hideCellLeftTooltip(); // revert state. If new state has been set, old and new will be equal. @@ -333,7 +333,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - previewCells: function(day, fromHour, toHour) { + previewCells: function (day, fromHour, toHour) { var cells = this.scheduleCells[day]; var curBrushValue = this.getCurrentBrushValue(); @@ -348,7 +348,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - revertCells: function(day, fromHour, toHour) { + revertCells: function (day, fromHour, toHour) { var cells = this.scheduleCells[day]; if (toHour > cells.length) toHour = cells.length; @@ -359,7 +359,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - confirmCells: function(day, fromHour, toHour) { + confirmCells: function (day, fromHour, toHour) { var cells = this.scheduleCells[day]; if (toHour > cells.length) toHour = cells.length; @@ -371,7 +371,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { } }, - showCellLeftTooltip: function(text, cell) { + showCellLeftTooltip: function (text, cell) { var tooltip = this.cellLeftTooltip; if (!tooltip) { @@ -400,19 +400,19 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { tooltip.style.visibility = 'visible'; }, - hideCellLeftTooltip: function() { + hideCellLeftTooltip: function () { if (this.cellLeftTooltip) { this.cellLeftTooltip.style.visibility = 'hidden'; } }, - isCellLeftTooltipHidden: function() { + isCellLeftTooltipHidden: function () { if (this.cellLeftTooltip) return this.cellLeftTooltip.style.visibility == 'hidden'; else return true; }, - showCellRightTooltip: function(text, cell) { + showCellRightTooltip: function (text, cell) { var tooltip = this.cellRightTooltip; if (!tooltip) { @@ -441,19 +441,19 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { tooltip.style.visibility = 'visible'; }, - hideCellRightTooltip: function() { + hideCellRightTooltip: function () { if (this.cellRightTooltip) { this.cellRightTooltip.style.visibility = 'hidden'; } }, - isCellRightTooltipHidden: function() { + isCellRightTooltipHidden: function () { if (this.cellRightTooltip) return this.cellRightTooltip.style.visibility == 'hidden'; else return true; }, - getConfig: function() { + getConfig: function () { var config = []; for (var i = 0; i < 24; i++) { @@ -471,7 +471,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { return config; }, - setConfig: function(config) { + setConfig: function (config) { for (var i = 0; i < 24; i++) { var hourConfig = config[i]; @@ -496,7 +496,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { header: false, layout: 'fit', - initComponent: function() { + initComponent: function () { Deluge.ux.preferences.SchedulerPage.superclass.initComponent.call(this); this.form = this.add({ @@ -561,7 +561,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { this.on('show', this.updateConfig, this); }, - onRender: function(ct, position) { + onRender: function (ct, position) { Deluge.ux.preferences.SchedulerPage.superclass.onRender.call( this, ct, @@ -572,7 +572,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { this.form.doLayout(); }, - onApply: function() { + onApply: function () { // build settings object var config = {}; @@ -586,13 +586,13 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { deluge.client.scheduler.set_config(config); }, - onOk: function() { + onOk: function () { this.onApply(); }, - updateConfig: function() { + updateConfig: function () { deluge.client.scheduler.get_config({ - success: function(config) { + success: function (config) { this.schedule.setConfig(config['button_state']); this.downloadLimit.setValue(config['low_down']); this.uploadLimit.setValue(config['low_up']); @@ -608,11 +608,11 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { Deluge.plugins.SchedulerPlugin = Ext.extend(Deluge.Plugin, { name: 'Scheduler', - onDisable: function() { + onDisable: function () { deluge.preferences.removePage(this.prefsPage); }, - onEnable: function() { + onEnable: function () { this.prefsPage = deluge.preferences.addPage( new Deluge.ux.preferences.SchedulerPage() ); diff --git a/deluge/plugins/Stats/deluge_stats/data/stats.js b/deluge/plugins/Stats/deluge_stats/data/stats.js index 8f9e3f841..7ba3d272f 100644 --- a/deluge/plugins/Stats/deluge_stats/data/stats.js +++ b/deluge/plugins/Stats/deluge_stats/data/stats.js @@ -10,7 +10,7 @@ */ StatsPlugin = Ext.extend(Deluge.Plugin, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { name: 'Stats', @@ -20,8 +20,8 @@ StatsPlugin = Ext.extend(Deluge.Plugin, { StatsPlugin.superclass.constructor.call(this, config); }, - onDisable: function() {}, + onDisable: function () {}, - onEnable: function() {}, + onEnable: function () {}, }); new StatsPlugin(); diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py index 3b581be3e..07741cbf3 100644 --- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py +++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py @@ -72,14 +72,15 @@ class StatsTestCase(BaseTestCase): Not strictly a unit test, but tests if calls do not fail... """ + from deluge_stats import graph, gtkui + + from deluge.configmanager import ConfigManager from deluge.ui.gtkui.gtkui import DEFAULT_PREFS - from deluge.ui.gtkui.preferences import Preferences from deluge.ui.gtkui.mainwindow import MainWindow - from deluge.configmanager import ConfigManager from deluge.ui.gtkui.pluginmanager import PluginManager + from deluge.ui.gtkui.preferences import Preferences from deluge.ui.gtkui.torrentdetails import TorrentDetails from deluge.ui.gtkui.torrentview import TorrentView - from deluge_stats import graph, gtkui ConfigManager('gtkui.conf', defaults=DEFAULT_PREFS) diff --git a/deluge/plugins/Toggle/deluge_toggle/data/toggle.js b/deluge/plugins/Toggle/deluge_toggle/data/toggle.js index 8e9a045ad..20fa4f445 100644 --- a/deluge/plugins/Toggle/deluge_toggle/data/toggle.js +++ b/deluge/plugins/Toggle/deluge_toggle/data/toggle.js @@ -10,7 +10,7 @@ */ TogglePlugin = Ext.extend(Deluge.Plugin, { - constructor: function(config) { + constructor: function (config) { config = Ext.apply( { name: 'Toggle', @@ -20,8 +20,8 @@ TogglePlugin = Ext.extend(Deluge.Plugin, { TogglePlugin.superclass.constructor.call(this, config); }, - onDisable: function() {}, + onDisable: function () {}, - onEnable: function() {}, + onEnable: function () {}, }); new TogglePlugin(); diff --git a/deluge/ui/console/cmdline/commands/add.py b/deluge/ui/console/cmdline/commands/add.py index e063d488f..da42695b5 100644 --- a/deluge/ui/console/cmdline/commands/add.py +++ b/deluge/ui/console/cmdline/commands/add.py @@ -26,8 +26,8 @@ try: from urllib.request import url2pathname except ImportError: # PY2 fallback - from urlparse import urlparse # pylint: disable=ungrouped-imports from urllib import url2pathname # pylint: disable=ungrouped-imports + from urlparse import urlparse # pylint: disable=ungrouped-imports class Command(BaseCommand): diff --git a/deluge/ui/console/cmdline/commands/plugin.py b/deluge/ui/console/cmdline/commands/plugin.py index fafc77afd..72cecb40f 100644 --- a/deluge/ui/console/cmdline/commands/plugin.py +++ b/deluge/ui/console/cmdline/commands/plugin.py @@ -106,8 +106,8 @@ class Command(BaseCommand): elif options.install: import os.path - from base64 import b64encode import shutil + from base64 import b64encode filepath = options.install diff --git a/deluge/ui/console/console.py b/deluge/ui/console/console.py index 58d31d514..f683c749d 100644 --- a/deluge/ui/console/console.py +++ b/deluge/ui/console/console.py @@ -112,9 +112,9 @@ class Console(UI): ) # To properly print help message for the console commands ( e.g. deluge-console info -h), # we add a subparser for each command which will trigger the help/usage when given - from deluge.ui.console.parser import ( + from deluge.ui.console.parser import ( # import here because (see top) ConsoleCommandParser, - ) # import here because (see top) + ) self.console_parser = ConsoleCommandParser( parents=[self.parser], diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py index dd3681f5b..5520b0b46 100644 --- a/deluge/ui/console/modes/basemode.py +++ b/deluge/ui/console/modes/basemode.py @@ -26,9 +26,9 @@ except ImportError: try: import signal - from fcntl import ioctl - import termios import struct + import termios + from fcntl import ioctl except ImportError: pass diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index d02a0d396..fbb4fa55f 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -220,7 +220,7 @@ class TorrentDetail(BaseMode, PopupsHandler): self.refresh() def build_file_list(self, torrent_files, progress, priority): - """ Split file list from torrent state into a directory tree. + """Split file list from torrent state into a directory tree. Returns: diff --git a/deluge/ui/console/parser.py b/deluge/ui/console/parser.py index 27f248564..1c0bd7009 100644 --- a/deluge/ui/console/parser.py +++ b/deluge/ui/console/parser.py @@ -60,14 +60,14 @@ class ConsoleCommandParser(ConsoleBaseParser): def parse_args(self, args=None): """Parse known UI args and handle common and process group options. - Notes: - If started by deluge entry script this has already been done. + Notes: + If started by deluge entry script this has already been done. - Args: - args (list, optional): The arguments to parse. + Args: + args (list, optional): The arguments to parse. - Returns: - argparse.Namespace: The parsed arguments. + Returns: + argparse.Namespace: The parsed arguments. """ from deluge.ui.ui_entry import AMBIGUOUS_CMD_ARGS @@ -118,9 +118,9 @@ class OptionParser(ConsoleBaseParser): def error(self, msg): """error(msg : string) - Print a usage message incorporating 'msg' to stderr and exit. - If you override this in a subclass, it should not return -- it - should either exit or raise an exception. + Print a usage message incorporating 'msg' to stderr and exit. + If you override this in a subclass, it should not return -- it + should either exit or raise an exception. """ raise OptionParserError(msg) diff --git a/deluge/ui/console/widgets/fields.py b/deluge/ui/console/widgets/fields.py index 1966c6685..021cab738 100644 --- a/deluge/ui/console/widgets/fields.py +++ b/deluge/ui/console/widgets/fields.py @@ -1061,9 +1061,9 @@ class ComboInput(InputField): # No match, so start at beginning select_in_range(0, selected) - from deluge.ui.console.widgets.popup import ( + from deluge.ui.console.widgets.popup import ( # Must import here SelectablePopup, - ) # Must import here + ) select_popup = SelectablePopup( self.parent, diff --git a/deluge/ui/gtk3/__init__.py b/deluge/ui/gtk3/__init__.py index 3b9d2b123..1d9b5b89d 100644 --- a/deluge/ui/gtk3/__init__.py +++ b/deluge/ui/gtk3/__init__.py @@ -40,9 +40,10 @@ class Gtk(UI): def start(self): super(Gtk, self).start() - from .gtkui import GtkUI import deluge.common + from .gtkui import GtkUI + def run(options): try: gtkui = GtkUI(options) diff --git a/deluge/ui/gtk3/dialogs.py b/deluge/ui/gtk3/dialogs.py index deea10515..4a2a60a7e 100644 --- a/deluge/ui/gtk3/dialogs.py +++ b/deluge/ui/gtk3/dialogs.py @@ -159,8 +159,8 @@ class ErrorDialog(BaseDialog): ) if traceback: - import traceback import sys + import traceback tb = sys.exc_info() tb = traceback.format_exc(tb[2]) diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py index 47e889c6e..d8d335866 100644 --- a/deluge/ui/gtk3/gtkui.py +++ b/deluge/ui/gtk3/gtkui.py @@ -75,7 +75,7 @@ set_prgname('deluge') log = logging.getLogger(__name__) try: - from setproctitle import setproctitle, getproctitle + from setproctitle import getproctitle, setproctitle except ImportError: def setproctitle(title): diff --git a/deluge/ui/gtk3/ipcinterface.py b/deluge/ui/gtk3/ipcinterface.py index dc51a8716..78858c443 100644 --- a/deluge/ui/gtk3/ipcinterface.py +++ b/deluge/ui/gtk3/ipcinterface.py @@ -31,8 +31,8 @@ try: from urllib.request import url2pathname except ImportError: # PY2 fallback - from urlparse import urlparse # pylint: disable=ungrouped-imports from urllib import url2pathname # pylint: disable=ungrouped-imports + from urlparse import urlparse # pylint: disable=ungrouped-imports log = logging.getLogger(__name__) @@ -84,8 +84,8 @@ class IPCInterface(component.Component): if windows_check(): # If we're on windows we need to check the global mutex to see if deluge is # already running. - import win32event import win32api + import win32event import winerror self.mutex = win32event.CreateMutex(None, False, 'deluge') diff --git a/deluge/ui/gtk3/listview.py b/deluge/ui/gtk3/listview.py index 666bb6731..7b1cba810 100644 --- a/deluge/ui/gtk3/listview.py +++ b/deluge/ui/gtk3/listview.py @@ -68,10 +68,10 @@ class ListView(object): class TreeviewColumn(Gtk.TreeViewColumn, object): """ - TreeViewColumn does not signal right-click events, and we need them - This subclass is equivalent to TreeViewColumn, but it signals these events + TreeViewColumn does not signal right-click events, and we need them + This subclass is equivalent to TreeViewColumn, but it signals these events - Most of the code of this class comes from Quod Libet (http://www.sacredchao.net/quodlibet) + Most of the code of this class comes from Quod Libet (http://www.sacredchao.net/quodlibet) """ __gsignals__ = { @@ -281,7 +281,7 @@ class ListView(object): def save_state(self, filename): """Saves the listview state (column positions and visibility) to - filename.""" + filename.""" # A list of ListViewColumnStates state = [] @@ -627,8 +627,7 @@ class ListView(object): unique=False, default_sort=False, ): - """Add a text column to the listview. Only the header name is required. - """ + """Add a text column to the listview. Only the header name is required.""" render = Gtk.CellRendererText() self.add_column( header, diff --git a/deluge/ui/gtk3/peers_tab.py b/deluge/ui/gtk3/peers_tab.py index fa79d84a1..e0282becf 100644 --- a/deluge/ui/gtk3/peers_tab.py +++ b/deluge/ui/gtk3/peers_tab.py @@ -305,8 +305,8 @@ class PeersTab(Tab): peer_ip = peer['ip'] else: # This is an IPv6 address - import socket import binascii + import socket # Split out the :port ip = ':'.join(peer['ip'].split(':')[:-1]) diff --git a/deluge/ui/gtk3/preferences.py b/deluge/ui/gtk3/preferences.py index b4d3f521c..a4d63aaa8 100644 --- a/deluge/ui/gtk3/preferences.py +++ b/deluge/ui/gtk3/preferences.py @@ -1180,8 +1180,8 @@ class Preferences(component.Component): chooser.destroy() return - from base64 import b64encode import shutil + from base64 import b64encode filename = os.path.split(filepath)[1] shutil.copyfile(filepath, os.path.join(get_config_dir(), 'plugins', filename)) diff --git a/deluge/ui/gtk3/torrentdetails.py b/deluge/ui/gtk3/torrentdetails.py index 29e019326..b2124b309 100644 --- a/deluge/ui/gtk3/torrentdetails.py +++ b/deluge/ui/gtk3/torrentdetails.py @@ -112,11 +112,11 @@ class TorrentDetails(component.Component): self.tabs = {} # Add the default tabs - from .status_tab import StatusTab from .details_tab import DetailsTab from .files_tab import FilesTab - from .peers_tab import PeersTab from .options_tab import OptionsTab + from .peers_tab import PeersTab + from .status_tab import StatusTab from .trackers_tab import TrackersTab default_tabs = { 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); }, diff --git a/deluge/ui/web/js/extjs/ext-extensions/JSLoader.js b/deluge/ui/web/js/extjs/ext-extensions/JSLoader.js index 9631fd859..e4691b027 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/JSLoader.js +++ b/deluge/ui/web/js/extjs/ext-extensions/JSLoader.js @@ -1,4 +1,4 @@ -Ext.ux.JSLoader = function(options) { +Ext.ux.JSLoader = function (options) { Ext.ux.JSLoader.scripts[++Ext.ux.JSLoader.index] = { url: options.url, success: true, @@ -12,7 +12,7 @@ Ext.ux.JSLoader = function(options) { Ext.Ajax.request({ url: options.url, scriptIndex: Ext.ux.JSLoader.index, - success: function(response, options) { + success: function (response, options) { var script = Ext.ux.JSLoader.scripts[options.scriptIndex]; try { eval(response.responseText); @@ -24,7 +24,7 @@ Ext.ux.JSLoader = function(options) { script.onLoad.call(script.scope, script.options); } }, - failure: function(response, options) { + failure: function (response, options) { var script = Ext.ux.JSLoader.scripts[options.scriptIndex]; script.success = false; script.onError(script.options, response.status); @@ -33,7 +33,7 @@ Ext.ux.JSLoader = function(options) { }; Ext.ux.JSLoader.index = 0; Ext.ux.JSLoader.scripts = []; -Ext.ux.JSLoader.stdError = function(options, e) { +Ext.ux.JSLoader.stdError = function (options, e) { window.alert( 'Error loading script:\n\n' + options.url + '\n\nstatus: ' + e ); diff --git a/deluge/ui/web/js/extjs/ext-extensions/Spinner.js b/deluge/ui/web/js/extjs/ext-extensions/Spinner.js index ff272d220..ccef8953d 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/Spinner.js +++ b/deluge/ui/web/js/extjs/ext-extensions/Spinner.js @@ -18,13 +18,13 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { defaultValue: 0, accelerate: false, - constructor: function(config) { + constructor: function (config) { Ext.ux.Spinner.superclass.constructor.call(this, config); Ext.apply(this, config); this.mimicing = false; }, - init: function(field) { + init: function (field) { this.field = field; field.afterMethod('onRender', this.doRender, this); @@ -36,7 +36,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { field.beforeMethod('onDestroy', this.doDestroy, this); }, - doRender: function(ct, position) { + doRender: function (ct, position) { var el = (this.el = this.field.getEl()); var f = this.field; @@ -81,7 +81,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { this.initSpinner(); }, - doAfterRender: function() { + doAfterRender: function () { var y; if (Ext.isIE && this.el.getY() != (y = this.trigger.getY())) { this.el.position(); @@ -89,14 +89,14 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { } }, - doEnable: function() { + doEnable: function () { if (this.wrap) { this.disabled = false; this.wrap.removeClass(this.field.disabledClass); } }, - doDisable: function() { + doDisable: function () { if (this.wrap) { this.disabled = true; this.wrap.addClass(this.field.disabledClass); @@ -104,14 +104,14 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { } }, - doResize: function(w, h) { + doResize: function (w, h) { if (typeof w == 'number') { this.el.setWidth(w - this.trigger.getWidth()); } this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth()); }, - doFocus: function() { + doFocus: function () { if (!this.mimicing) { this.wrap.addClass('x-trigger-wrap-focus'); this.mimicing = true; @@ -128,21 +128,21 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, // private - checkTab: function(e) { + checkTab: function (e) { if (e.getKey() == e.TAB) { this.triggerBlur(); } }, // private - mimicBlur: function(e) { + mimicBlur: function (e) { if (!this.wrap.contains(e.target) && this.field.validateBlur(e)) { this.triggerBlur(); } }, // private - triggerBlur: function() { + triggerBlur: function () { this.mimicing = false; Ext.get(Ext.isIE ? document.body : document).un( 'mousedown', @@ -155,12 +155,12 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { this.field.onBlur.call(this.field); }, - initTrigger: function() { + initTrigger: function () { this.trigger.addClassOnOver('x-form-trigger-over'); this.trigger.addClassOnClick('x-form-trigger-click'); }, - initSpinner: function() { + initSpinner: function () { this.field.addEvents({ spin: true, spinup: true, @@ -168,22 +168,22 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }); this.keyNav = new Ext.KeyNav(this.el, { - up: function(e) { + up: function (e) { e.preventDefault(); this.onSpinUp(); }, - down: function(e) { + down: function (e) { e.preventDefault(); this.onSpinDown(); }, - pageUp: function(e) { + pageUp: function (e) { e.preventDefault(); this.onSpinUpAlternate(); }, - pageDown: function(e) { + pageDown: function (e) { e.preventDefault(); this.onSpinDownAlternate(); }, @@ -217,7 +217,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { this.dd.onDrag = this.onDrag.createDelegate(this); }, - onMouseOver: function() { + onMouseOver: function () { if (this.disabled) { return; } @@ -230,12 +230,12 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onMouseOut: function() { + onMouseOut: function () { this.trigger.removeClass(this.tmpHoverClass); }, //private - onMouseMove: function() { + onMouseMove: function () { if (this.disabled) { return; } @@ -250,7 +250,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onMouseDown: function() { + onMouseDown: function () { if (this.disabled) { return; } @@ -263,12 +263,12 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onMouseUp: function() { + onMouseUp: function () { this.trigger.removeClass(this.tmpClickClass); }, //private - onTriggerClick: function() { + onTriggerClick: function () { if (this.disabled || this.el.dom.readOnly) { return; } @@ -278,7 +278,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - getMiddle: function() { + getMiddle: function () { var t = this.trigger.getTop(); var h = this.trigger.getHeight(); var middle = t + h / 2; @@ -287,7 +287,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { //private //checks if control is allowed to spin - isSpinnable: function() { + isSpinnable: function () { if (this.disabled || this.el.dom.readOnly) { Ext.EventObject.preventDefault(); //prevent scrolling when disabled/readonly return false; @@ -295,7 +295,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { return true; }, - handleMouseWheel: function(e) { + handleMouseWheel: function (e) { //disable scrolling when not focused if (this.wrap.hasClass('x-trigger-wrap-focus') == false) { return; @@ -312,18 +312,18 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - startDrag: function() { + startDrag: function () { this.proxy.show(); this._previousY = Ext.fly(this.dd.getDragEl()).getTop(); }, //private - endDrag: function() { + endDrag: function () { this.proxy.hide(); }, //private - onDrag: function() { + onDrag: function () { if (this.disabled) { return; } @@ -344,7 +344,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onSpinUp: function() { + onSpinUp: function () { if (this.isSpinnable() == false) { return; } @@ -359,7 +359,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onSpinDown: function() { + onSpinDown: function () { if (this.isSpinnable() == false) { return; } @@ -374,7 +374,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onSpinUpAlternate: function() { + onSpinUpAlternate: function () { if (this.isSpinnable() == false) { return; } @@ -384,7 +384,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, //private - onSpinDownAlternate: function() { + onSpinDownAlternate: function () { if (this.isSpinnable() == false) { return; } @@ -393,7 +393,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { this.field.fireEvent('spindown', this); }, - spin: function(down, alternate) { + spin: function (down, alternate) { var v = parseFloat(this.field.getValue()); var incr = alternate == true @@ -406,7 +406,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { this.field.setRawValue(v); }, - fixBoundries: function(value) { + fixBoundries: function (value) { var v = value; if (this.field.minValue != undefined && v < this.field.minValue) { @@ -420,7 +420,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { }, // private - fixPrecision: function(value) { + fixPrecision: function (value) { var nan = isNaN(value); if ( !this.field.allowDecimals || @@ -435,7 +435,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, { ); }, - doDestroy: function() { + doDestroy: function () { if (this.trigger) { this.trigger.remove(); } diff --git a/deluge/ui/web/js/extjs/ext-extensions/StatusBar.js b/deluge/ui/web/js/extjs/ext-extensions/StatusBar.js index a12b8f9c7..1f6a5f067 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/StatusBar.js +++ b/deluge/ui/web/js/extjs/ext-extensions/StatusBar.js @@ -183,7 +183,7 @@ sb.setStatus({ activeThreadId: 0, // private - initComponent: function() { + initComponent: function () { if (this.statusAlign == 'right') { this.cls += ' x-status-right'; } @@ -191,7 +191,7 @@ sb.setStatus({ }, // private - afterRender: function() { + afterRender: function () { Ext.ux.StatusBar.superclass.afterRender.call(this); var right = this.statusAlign == 'right'; @@ -260,7 +260,7 @@ statusBar.setStatus({ </code></pre> * @return {Ext.ux.StatusBar} this */ - setStatus: function(o) { + setStatus: function (o) { o = o || {}; if (typeof o == 'string') { @@ -307,7 +307,7 @@ statusBar.setStatus({ * </ul> * @return {Ext.ux.StatusBar} this */ - clearStatus: function(o) { + clearStatus: function (o) { o = o || {}; if (o.threadId && o.threadId !== this.activeThreadId) { @@ -330,7 +330,7 @@ statusBar.setStatus({ remove: false, useDisplay: true, scope: this, - callback: function() { + callback: function () { this.setStatus({ text: text, iconCls: iconCls, @@ -356,7 +356,7 @@ statusBar.setStatus({ * @param {String} text (optional) The text to set (defaults to '') * @return {Ext.ux.StatusBar} this */ - setText: function(text) { + setText: function (text) { this.activeThreadId++; this.text = text || ''; if (this.rendered) { @@ -369,7 +369,7 @@ statusBar.setStatus({ * Returns the current status text. * @return {String} The status text */ - getText: function() { + getText: function () { return this.text; }, @@ -379,7 +379,7 @@ statusBar.setStatus({ * @param {String} iconCls (optional) The icon class to set (defaults to '', and any current icon class is removed) * @return {Ext.ux.StatusBar} this */ - setIcon: function(cls) { + setIcon: function (cls) { this.activeThreadId++; cls = cls || ''; @@ -408,7 +408,7 @@ statusBar.setStatus({ * {@link #busyIconCls} will be used in conjunction with all of the default options for {@link #setStatus}. * @return {Ext.ux.StatusBar} this */ - showBusy: function(o) { + showBusy: function (o) { if (typeof o == 'string') { o = { text: o }; } diff --git a/deluge/ui/web/js/extjs/ext-extensions/form/FileUploadField.js b/deluge/ui/web/js/extjs/ext-extensions/form/FileUploadField.js index ca150737a..3ab234776 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/form/FileUploadField.js +++ b/deluge/ui/web/js/extjs/ext-extensions/form/FileUploadField.js @@ -50,7 +50,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { autoSize: Ext.emptyFn, // private - initComponent: function() { + initComponent: function () { Ext.ux.form.FileUploadField.superclass.initComponent.call(this); this.addEvents( @@ -66,7 +66,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { }, // private - onRender: function(ct, position) { + onRender: function (ct, position) { Ext.ux.form.FileUploadField.superclass.onRender.call( this, ct, @@ -97,30 +97,30 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { this.resizeEl = this.positionEl = this.wrap; }, - bindListeners: function() { + bindListeners: function () { this.fileInput.on({ scope: this, - mouseenter: function() { + mouseenter: function () { this.button.addClass(['x-btn-over', 'x-btn-focus']); }, - mouseleave: function() { + mouseleave: function () { this.button.removeClass([ 'x-btn-over', 'x-btn-focus', 'x-btn-click', ]); }, - mousedown: function() { + mousedown: function () { this.button.addClass('x-btn-click'); }, - mouseup: function() { + mouseup: function () { this.button.removeClass([ 'x-btn-over', 'x-btn-focus', 'x-btn-click', ]); }, - change: function() { + change: function () { var value = this.fileInput.dom.files; // Fallback to value. if (!value) value = this.fileInput.dom.value; @@ -130,7 +130,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { }); }, - createFileInput: function() { + createFileInput: function () { this.fileInput = this.wrap.createChild({ id: this.getFileInputId(), name: this.name || this.getId(), @@ -142,7 +142,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { this.fileInput.dom.multiple = this.multiple; }, - reset: function() { + reset: function () { if (this.rendered) { this.fileInput.remove(); this.createFileInput(); @@ -152,12 +152,12 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { }, // private - getFileInputId: function() { + getFileInputId: function () { return this.id + '-file'; }, // private - onResize: function(w, h) { + onResize: function (w, h) { Ext.ux.form.FileUploadField.superclass.onResize.call(this, w, h); this.wrap.setWidth(w); @@ -172,23 +172,23 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { }, // private - onDestroy: function() { + onDestroy: function () { Ext.ux.form.FileUploadField.superclass.onDestroy.call(this); Ext.destroy(this.fileInput, this.button, this.wrap); }, - onDisable: function() { + onDisable: function () { Ext.ux.form.FileUploadField.superclass.onDisable.call(this); this.doDisable(true); }, - onEnable: function() { + onEnable: function () { Ext.ux.form.FileUploadField.superclass.onEnable.call(this); this.doDisable(false); }, // private - doDisable: function(disabled) { + doDisable: function (disabled) { this.fileInput.dom.disabled = disabled; this.button.setDisabled(disabled); }, @@ -197,7 +197,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { preFocus: Ext.emptyFn, // private - alignErrorIcon: function() { + alignErrorIcon: function () { this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); }, }); diff --git a/deluge/ui/web/js/extjs/ext-extensions/form/RadioGroupFix.js b/deluge/ui/web/js/extjs/ext-extensions/form/RadioGroupFix.js index 134e7a170..416c09808 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/form/RadioGroupFix.js +++ b/deluge/ui/web/js/extjs/ext-extensions/form/RadioGroupFix.js @@ -10,8 +10,8 @@ // Allow radiogroups to be treated as a single form element. Ext.override(Ext.form.RadioGroup, { - afterRender: function() { - this.items.each(function(i) { + afterRender: function () { + this.items.each(function (i) { this.relayEvents(i, ['check']); }, this); if (this.lazyValue) { @@ -22,21 +22,21 @@ Ext.override(Ext.form.RadioGroup, { Ext.form.RadioGroup.superclass.afterRender.call(this); }, - getName: function() { + getName: function () { return this.items.first().getName(); }, - getValue: function() { + getValue: function () { return this.items.first().getGroupValue(); }, - setValue: function(v) { + setValue: function (v) { if (!this.items.each) { this.value = v; this.lazyValue = true; return; } - this.items.each(function(item) { + this.items.each(function (item) { if (item.rendered) { var checked = item.el.getValue() == String(v); item.el.dom.checked = checked; diff --git a/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerField.js b/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerField.js index d14f32043..890fb5bc7 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerField.js +++ b/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerField.js @@ -19,7 +19,7 @@ Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, { onBlur: Ext.emptyFn, adjustSize: Ext.BoxComponent.prototype.adjustSize, - constructor: function(config) { + constructor: function (config) { var spinnerConfig = Ext.copyTo( {}, config, @@ -41,23 +41,23 @@ Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, { }, // private - getResizeEl: function() { + getResizeEl: function () { return this.wrap; }, // private - getPositionEl: function() { + getPositionEl: function () { return this.wrap; }, // private - alignErrorIcon: function() { + alignErrorIcon: function () { if (this.wrap) { this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); } }, - validateBlur: function() { + validateBlur: function () { return true; }, }); diff --git a/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerGroup.js b/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerGroup.js index eafc4e151..31eca735c 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerGroup.js +++ b/deluge/ui/web/js/extjs/ext-extensions/form/SpinnerGroup.js @@ -23,7 +23,7 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { colCfg: {}, // private - onRender: function(ct, position) { + onRender: function (ct, position) { if (!this.el) { var panelCfg = { cls: this.groupCls, @@ -131,14 +131,14 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { } } - var fields = this.panel.findBy(function(c) { + var fields = this.panel.findBy(function (c) { return c.isFormField; }, this); this.items = new Ext.util.MixedCollection(); this.items.addAll(fields); - this.items.each(function(field) { + this.items.each(function (field) { field.on('spin', this.onFieldChange, this); field.on('change', this.onFieldChange, this); }, this); @@ -159,45 +159,45 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { Ext.ux.form.SpinnerGroup.superclass.onRender.call(this, ct, position); }, - onFieldChange: function(spinner) { + onFieldChange: function (spinner) { this.fireEvent('change', this, this.getValue()); }, initValue: Ext.emptyFn, - getValue: function() { + getValue: function () { var value = [this.items.getCount()]; - this.items.each(function(item, i) { + this.items.each(function (item, i) { value[i] = Number(item.getValue()); }); return value; }, - getRawValue: function() { + getRawValue: function () { var value = [this.items.getCount()]; - this.items.each(function(item, i) { + this.items.each(function (item, i) { value[i] = Number(item.getRawValue()); }); return value; }, - setValue: function(value) { + setValue: function (value) { if (!this.rendered) { this.value = value; this.lazyValueSet = true; } else { - this.items.each(function(item, i) { + this.items.each(function (item, i) { item.setValue(value[i]); }); } }, - setRawValue: function(value) { + setRawValue: function (value) { if (!this.rendered) { this.rawValue = value; this.lazyRawValueSet = true; } else { - this.items.each(function(item, i) { + this.items.each(function (item, i) { item.setRawValue(value[i]); }); } diff --git a/deluge/ui/web/js/extjs/ext-extensions/form/ToggleField.js b/deluge/ui/web/js/extjs/ext-extensions/form/ToggleField.js index 27eebf385..eb60c3be1 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/form/ToggleField.js +++ b/deluge/ui/web/js/extjs/ext-extensions/form/ToggleField.js @@ -21,7 +21,7 @@ Ext.namespace('Ext.ux.form'); Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { cls: 'x-toggle-field', - initComponent: function() { + initComponent: function () { Ext.ux.form.ToggleField.superclass.initComponent.call(this); this.toggle = new Ext.form.Checkbox(); @@ -32,7 +32,7 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { }); }, - onRender: function(ct, position) { + onRender: function (ct, position) { if (!this.el) { this.panel = new Ext.Panel({ cls: this.groupCls, @@ -50,16 +50,13 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { this.panel.add(this.input); this.panel.doLayout(); - this.toggle - .getEl() - .parent() - .setStyle('padding-right', '10px'); + this.toggle.getEl().parent().setStyle('padding-right', '10px'); } Ext.ux.form.ToggleField.superclass.onRender.call(this, ct, position); }, // private - onResize: function(w, h) { + onResize: function (w, h) { this.panel.setSize(w, h); this.panel.doLayout(); @@ -68,7 +65,7 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { this.input.setSize(inputWidth, h); }, - onToggleCheck: function(toggle, checked) { + onToggleCheck: function (toggle, checked) { this.input.setDisabled(!checked); }, }); diff --git a/deluge/ui/web/js/extjs/ext-extensions/grid/BufferView.js b/deluge/ui/web/js/extjs/ext-extensions/grid/BufferView.js index e9f0e0c23..0fce3b407 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/grid/BufferView.js +++ b/deluge/ui/web/js/extjs/ext-extensions/grid/BufferView.js @@ -46,7 +46,7 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { */ cleanDelay: 500, - initTemplates: function() { + initTemplates: function () { Ext.ux.grid.BufferView.superclass.initTemplates.call(this); var ts = this.templates; // empty div to act as a place holder for a row @@ -68,23 +68,23 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { ts.rowBody.compile(); }, - getStyleRowHeight: function() { + getStyleRowHeight: function () { return Ext.isBorderBox ? this.rowHeight + this.borderHeight : this.rowHeight; }, - getCalculatedRowHeight: function() { + getCalculatedRowHeight: function () { return this.rowHeight + this.borderHeight; }, - getVisibleRowCount: function() { + getVisibleRowCount: function () { var rh = this.getCalculatedRowHeight(), visibleHeight = this.scroller.dom.clientHeight; return visibleHeight < 1 ? 0 : Math.ceil(visibleHeight / rh); }, - getVisibleRows: function() { + getVisibleRows: function () { var count = this.getVisibleRowCount(), sc = this.scroller.dom.scrollTop, start = @@ -97,7 +97,7 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { }; }, - doRender: function(cs, rs, ds, startRow, colCount, stripe, onlyBody) { + doRender: function (cs, rs, ds, startRow, colCount, stripe, onlyBody) { var ts = this.templates, ct = ts.cell, rt = ts.row, @@ -162,18 +162,18 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { return buf.join(''); }, - isRowRendered: function(index) { + isRowRendered: function (index) { var row = this.getRow(index); return row && row.childNodes.length > 0; }, - syncScroll: function() { + syncScroll: function () { Ext.ux.grid.BufferView.superclass.syncScroll.apply(this, arguments); this.update(); }, // a (optionally) buffered method to update contents of gridview - update: function() { + update: function () { if (this.scrollDelay) { if (!this.renderTask) { this.renderTask = new Ext.util.DelayedTask(this.doUpdate, this); @@ -184,14 +184,14 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { } }, - onRemove: function(ds, record, index, isUpdate) { + onRemove: function (ds, record, index, isUpdate) { Ext.ux.grid.BufferView.superclass.onRemove.apply(this, arguments); if (isUpdate !== true) { this.update(); } }, - doUpdate: function() { + doUpdate: function () { if (this.getVisibleRowCount() > 0) { var g = this.grid, cm = g.colModel, @@ -219,14 +219,14 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { }, // a buffered method to clean rows - clean: function() { + clean: function () { if (!this.cleanTask) { this.cleanTask = new Ext.util.DelayedTask(this.doClean, this); } this.cleanTask.delay(this.cleanDelay); }, - doClean: function() { + doClean: function () { if (this.getVisibleRowCount() > 0) { var vr = this.getVisibleRows(); vr.first -= this.cacheSize; @@ -249,7 +249,7 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { } }, - removeTask: function(name) { + removeTask: function (name) { var task = this[name]; if (task && task.cancel) { task.cancel(); @@ -257,13 +257,13 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, { } }, - destroy: function() { + destroy: function () { this.removeTask('cleanTask'); this.removeTask('renderTask'); Ext.ux.grid.BufferView.superclass.destroy.call(this); }, - layout: function() { + layout: function () { Ext.ux.grid.BufferView.superclass.layout.call(this); this.update(); }, diff --git a/deluge/ui/web/js/extjs/ext-extensions/layout/FormLayoutFix.js b/deluge/ui/web/js/extjs/ext-extensions/layout/FormLayoutFix.js index 14ac55ab8..3ccce2ba3 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/layout/FormLayoutFix.js +++ b/deluge/ui/web/js/extjs/ext-extensions/layout/FormLayoutFix.js @@ -12,7 +12,7 @@ // remove spaces for hidden elements and make show(), hide(), enable() and disable() act on // the label. don't use hideLabel with this. Ext.override(Ext.layout.FormLayout, { - renderItem: function(c, position, target) { + renderItem: function (c, position, target) { if ( c && !c.rendered && diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/MultiSelectionModelFix.js b/deluge/ui/web/js/extjs/ext-extensions/tree/MultiSelectionModelFix.js index 979bd2cac..ba26a7240 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/MultiSelectionModelFix.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/MultiSelectionModelFix.js @@ -13,7 +13,7 @@ * @author Damien Churchill <damoxc@gmail.com> */ Ext.override(Ext.tree.MultiSelectionModel, { - onNodeClick: function(node, e) { + onNodeClick: function (node, e) { if (e.ctrlKey && this.isSelected(node)) { this.unselect(node); } else if (e.shiftKey && !this.isSelected(node)) { @@ -34,7 +34,7 @@ Ext.override(Ext.tree.MultiSelectionModel, { } // Select all the nodes - parentNode.eachChild(function(n) { + parentNode.eachChild(function (n) { var i = parentNode.indexOf(n); if (fi < i && i < li) { this.select(n, e, true, true); @@ -48,7 +48,7 @@ Ext.override(Ext.tree.MultiSelectionModel, { } }, - select: function(node, e, keepExisting, suppressEvent) { + select: function (node, e, keepExisting, suppressEvent) { if (keepExisting !== true) { this.clearSelections(true); } diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGrid.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGrid.js index d3d5fc351..7a74360b6 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGrid.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGrid.js @@ -26,7 +26,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { columnsText: 'Columns', - initComponent: function() { + initComponent: function () { if (!this.root) { this.root = new Ext.tree.AsyncTreeNode({ text: 'Root' }); } @@ -98,7 +98,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { } }, - initColumns: function() { + initColumns: function () { var cs = this.columns, len = cs.length, columns = [], @@ -127,7 +127,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { this.columns = columns; }, - onRender: function() { + onRender: function () { Ext.tree.TreePanel.superclass.onRender.apply(this, arguments); this.el.addClass('x-treegrid'); @@ -176,7 +176,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { } }, - setRootNode: function(node) { + setRootNode: function (node) { node.attributes.uiProvider = Ext.ux.tree.TreeGridRootNodeUI; node = Ext.ux.tree.TreeGrid.superclass.setRootNode.call(this, node); if (this.innerCt) { @@ -187,7 +187,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { return node; }, - clearInnerCt: function() { + clearInnerCt: function () { if (Ext.isIE) { var dom = this.innerCt.dom; while (dom.firstChild) { @@ -198,7 +198,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { } }, - initEvents: function() { + initEvents: function () { Ext.ux.tree.TreeGrid.superclass.initEvents.apply(this, arguments); this.mon(this.innerBody, 'scroll', this.syncScroll, this); @@ -210,7 +210,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { }); }, - onResize: function(w, h) { + onResize: function (w, h) { Ext.ux.tree.TreeGrid.superclass.onResize.apply(this, arguments); var bd = this.innerBody.dom; @@ -234,7 +234,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { this.setScrollOffset(sw); } else { var me = this; - setTimeout(function() { + setTimeout(function () { me.setScrollOffset( bd.offsetWidth - bd.clientWidth > 10 ? sw : 0 ); @@ -243,7 +243,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { } }, - updateColumnWidths: function() { + updateColumnWidths: function () { var cols = this.columns, colCount = cols.length, groups = this.outerCt.query('colgroup'), @@ -282,7 +282,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { this.syncHeaderScroll(); }, - getVisibleColumns: function() { + getVisibleColumns: function () { var columns = [], cs = this.columns, len = cs.length, @@ -296,7 +296,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { return columns; }, - getTotalColumnWidth: function() { + getTotalColumnWidth: function () { var total = 0; for ( var i = 0, cs = this.getVisibleColumns(), len = cs.length; @@ -308,13 +308,13 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { return total; }, - setScrollOffset: function(scrollOffset) { + setScrollOffset: function (scrollOffset) { this.scrollOffset = scrollOffset; this.updateColumnWidths(); }, // private - handleHdDown: function(e, t) { + handleHdDown: function (e, t) { var hd = e.getTarget('.x-treegrid-hd'); if (hd && Ext.fly(t).hasClass('x-grid3-hd-btn')) { @@ -332,7 +332,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { this.hmenu.on( 'hide', - function() { + function () { Ext.fly(hd).removeClass('x-grid3-hd-menu-open'); }, this, @@ -347,7 +347,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { }, // private - handleHdOver: function(e, t) { + handleHdOver: function (e, t) { var hd = e.getTarget('.x-treegrid-hd'); if (hd && !this.headersDisabled) { index = this.findHeaderIndex(hd); @@ -365,7 +365,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { }, // private - handleHdOut: function(e, t) { + handleHdOut: function (e, t) { var hd = e.getTarget('.x-treegrid-hd'); if (hd && (!Ext.isIE || !e.within(hd, true))) { this.activeHdRef = null; @@ -374,7 +374,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { } }, - findHeaderIndex: function(hd) { + findHeaderIndex: function (hd) { hd = hd.dom || hd; var cs = hd.parentNode.childNodes; for (var i = 0, c; (c = cs[i]); i++) { @@ -386,7 +386,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { }, // private - beforeColMenuShow: function() { + beforeColMenuShow: function () { var cols = this.columns, colCount = cols.length, i, @@ -409,7 +409,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { }, // private - handleHdMenuClick: function(item) { + handleHdMenuClick: function (item) { var index = this.hdCtxIndex, id = item.getItemId(); @@ -430,7 +430,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { return true; }, - setColumnVisible: function(index, visible) { + setColumnVisible: function (index, visible) { this.columns[index].hidden = !visible; this.updateColumnWidths(); }, @@ -438,26 +438,26 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, { /** * Scrolls the grid to the top */ - scrollToTop: function() { + scrollToTop: function () { this.innerBody.dom.scrollTop = 0; this.innerBody.dom.scrollLeft = 0; }, // private - syncScroll: function() { + syncScroll: function () { this.syncHeaderScroll(); var mb = this.innerBody.dom; this.fireEvent('bodyscroll', mb.scrollLeft, mb.scrollTop); }, // private - syncHeaderScroll: function() { + syncHeaderScroll: function () { var mb = this.innerBody.dom; this.innerHd.dom.scrollLeft = mb.scrollLeft; this.innerHd.dom.scrollLeft = mb.scrollLeft; // second time for IE (1/2 time first fails, other browsers ignore) }, - registerNode: function(n) { + registerNode: function (n) { Ext.ux.tree.TreeGrid.superclass.registerNode.call(this, n); if (!n.uiProvider && !n.isRoot && !n.ui.isTreeGridNodeUI) { n.ui = new Ext.ux.tree.TreeGridNodeUI(n); diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumnResizer.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumnResizer.js index 870172eeb..de736083d 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumnResizer.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumnResizer.js @@ -15,17 +15,17 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, { */ minWidth: 14, - constructor: function(config) { + constructor: function (config) { Ext.apply(this, config); Ext.tree.ColumnResizer.superclass.constructor.call(this); }, - init: function(tree) { + init: function (tree) { this.tree = tree; tree.on('render', this.initEvents, this); }, - initEvents: function(tree) { + initEvents: function (tree) { tree.mon(tree.innerHd, 'mousemove', this.handleHdMove, this); this.tracker = new Ext.dd.DragTracker({ onBeforeStart: this.onBeforeStart.createDelegate(this), @@ -39,7 +39,7 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, { tree.on('beforedestroy', this.tracker.destroy, this.tracker); }, - handleHdMove: function(e, t) { + handleHdMove: function (e, t) { var hw = 5, x = e.getPageX(), hd = e.getTarget('.x-treegrid-hd', 3, true); @@ -74,12 +74,12 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, { } }, - onBeforeStart: function(e) { + onBeforeStart: function (e) { this.dragHd = this.activeHd; return !!this.dragHd; }, - onStart: function(e) { + onStart: function (e) { this.dragHeadersDisabled = this.tree.headersDisabled; this.tree.headersDisabled = true; this.proxy = this.tree.body.createChild({ cls: 'x-treegrid-resizer' }); @@ -98,14 +98,14 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, { this.tree.innerBody.translatePoints(this.hdX).left; }, - onDrag: function(e) { + onDrag: function (e) { var cursorX = this.tracker.getXY()[0]; this.proxy.setWidth( (cursorX - this.hdX).constrain(this.minWidth, this.maxWidth) ); }, - onEnd: function(e) { + onEnd: function (e) { var nw = this.proxy.getWidth(), tree = this.tree, disabled = this.dragHeadersDisabled; @@ -116,7 +116,7 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, { tree.columns[this.hdIndex].width = nw; tree.updateColumnWidths(); - setTimeout(function() { + setTimeout(function () { tree.headersDisabled = disabled; }, 100); }, diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumns.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumns.js index 312bf2119..0c88f179b 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumns.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridColumns.js @@ -4,9 +4,9 @@ * licensing@sencha.com * http://www.sencha.com/license */ -(function() { +(function () { Ext.override(Ext.list.Column, { - init: function() { + init: function () { var types = Ext.data.Types, st = this.sortType; diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridLoader.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridLoader.js index eb5156a82..db14848ca 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridLoader.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridLoader.js @@ -9,7 +9,7 @@ * @extends Ext.tree.TreeLoader */ Ext.ux.tree.TreeGridLoader = Ext.extend(Ext.tree.TreeLoader, { - createNode: function(attr) { + createNode: function (attr) { if (!attr.uiProvider) { attr.uiProvider = Ext.ux.tree.TreeGridNodeUI; } diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUI.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUI.js index e58a8010a..09b1718cd 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUI.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUI.js @@ -11,7 +11,7 @@ Ext.ux.tree.TreeGridNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { isTreeGridNodeUI: true, - renderElements: function(n, a, targetNode, bulkRender) { + renderElements: function (n, a, targetNode, bulkRender) { var t = n.getOwnerTree(), cols = t.columns, c = cols[0], @@ -111,7 +111,7 @@ Ext.ux.tree.TreeGridNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { }, // private - animExpand: function(cb) { + animExpand: function (cb) { this.ctNode.style.display = ''; Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this, cb); }, @@ -121,7 +121,7 @@ Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { isTreeGridNodeUI: true, // private - render: function() { + render: function () { if (!this.rendered) { this.wrap = this.ctNode = this.node.ownerTree.innerCt.dom; this.node.expanded = true; @@ -131,13 +131,13 @@ Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { // weird table-layout: fixed issue in webkit var ct = this.ctNode; ct.style.tableLayout = null; - (function() { + (function () { ct.style.tableLayout = 'fixed'; }.defer(1)); } }, - destroy: function() { + destroy: function () { if (this.elNode) { Ext.dd.Registry.unregister(this.elNode.id); } diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUIFix.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUIFix.js index 4c21bc340..7708bd78e 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUIFix.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridNodeUIFix.js @@ -9,7 +9,7 @@ */ Ext.override(Ext.ux.tree.TreeGridNodeUI, { - updateColumns: function() { + updateColumns: function () { if (!this.rendered) return; var a = this.node.attributes, diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridRenderColumn.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridRenderColumn.js index 20bde8acc..ed95d952f 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridRenderColumn.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridRenderColumn.js @@ -1,5 +1,5 @@ Ext.tree.RenderColumn = Ext.extend(Ext.tree.Column, { - constructor: function(c) { + constructor: function (c) { c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}'); c.tpl.format = c.renderer; c.tpl.col = this; diff --git a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridSorter.js b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridSorter.js index 376f41417..fdf1f3838 100644 --- a/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridSorter.js +++ b/deluge/ui/web/js/extjs/ext-extensions/tree/TreeGridSorter.js @@ -40,7 +40,7 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { */ sortDescText: 'Sort Descending', - constructor: function(tree, config) { + constructor: function (tree, config) { if (!Ext.isObject(config)) { config = { property: tree.columns[0].dataIndex || 'text', @@ -58,7 +58,7 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { tree.ddAppendOnly = true; var me = this; - this.defaultSortFn = function(n1, n2) { + this.defaultSortFn = function (n1, n2) { var desc = me.dir && me.dir.toLowerCase() == 'desc', prop = me.property || 'text', sortType = me.sortType, @@ -101,7 +101,7 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { tree.on('headermenuclick', this.onHeaderMenuClick, this); }, - onAfterTreeRender: function() { + onAfterTreeRender: function () { if (this.tree.hmenu) { this.tree.hmenu.insert( 0, @@ -120,14 +120,14 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { this.updateSortIcon(0, 'asc'); }, - onHeaderMenuClick: function(c, id, index) { + onHeaderMenuClick: function (c, id, index) { if (id === 'asc' || id === 'desc') { this.onHeaderClick(c, null, index); return false; } }, - onHeaderClick: function(c, el, i) { + onHeaderClick: function (c, el, i) { if (c && !this.tree.headersDisabled) { var me = this; @@ -139,7 +139,7 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { : this.caseSensitive; me.sortFn = c.sortFn || this.defaultSortFn; - this.tree.root.cascade(function(n) { + this.tree.root.cascade(function (n) { if (!n.isLeaf()) { me.updateSort(me.tree, n); } @@ -150,7 +150,7 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, { }, // private - updateSortIcon: function(col, dir) { + updateSortIcon: function (col, dir) { var sc = this.sortClasses, hds = this.tree.innerHd.select('td').removeClass(sc); hds.item(col).addClass(sc[dir == 'desc' ? 1 : 0]); diff --git a/pyproject.toml b/pyproject.toml index 8962ece64..2674219a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,3 +6,8 @@ requires = [ [tool.black] skip-string-normalization = true + +[tool.isort] +profile = "black" +# Python 2 stdlib +extra_standard_library = ["urlparse", "HTMLParser", "urllib2"] diff --git a/requirements-tests.txt b/requirements-tests.txt index 4390eaf4d..705d96774 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -3,7 +3,7 @@ pytest-twisted pytest-cov mock pre-commit -flake8 +flake8<=3.7.9 flake8-quotes flake8-isort pep8-naming @@ -24,24 +24,6 @@ includes = glib, gio, cairo, pango, pangocairo, atk, gobject, gtk.keysyms, HTMLParser frameworks = CoreFoundation, Foundation, AppKit -[isort] -known_standard_library = future_builtins -known_third_party = -# Ignore gtk modules, primarily for tox testing. - cairo, gi, -# Ignore other module dependencies for pre-commit isort. - twisted, OpenSSL, pytest, recommonmark, chardet, pkg_resources, zope, mock, - sphinx, rencode, six, mako -known_first_party = msgfmt, deluge -order_by_type = true -not_skip = __init__.py -# Black compatible settings -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -line_length=88 -use_parentheses=True - [flake8] max-line-length = 120 builtins = _,_n,__request__ |