diff options
49 files changed, 201 insertions, 152 deletions
diff --git a/module/remote/create_jstypes.py b/module/remote/create_jstypes.py index ad05ec9a8..90afa4c96 100644 --- a/module/remote/create_jstypes.py +++ b/module/remote/create_jstypes.py @@ -14,9 +14,11 @@ def main(): print "generating apitypes.js" - f = open(join(module, 'web', 'static', 'js', 'utils', 'apitypes.js'), 'wb') + f = open(join(module, 'web', 'app', 'scripts', 'utils', 'apitypes.js'), 'wb') f.write("""// Autogenerated, do not edit! +/*jslint -W070: false*/ define([], function() { +\t'use strict'; \treturn { """) diff --git a/module/web/.jshintrc b/module/web/.jshintrc index 393dc7ee5..0cff430d9 100644 --- a/module/web/.jshintrc +++ b/module/web/.jshintrc @@ -3,7 +3,6 @@ "browser": true, "esnext": true, "bitwise": true, - "camelcase": true, "curly": true, "eqeqeq": true, "immed": true, @@ -14,8 +13,17 @@ "quotmark": "single", "regexp": true, "undef": true, - "unused": true, "strict": true, "trailing": true, - "smarttabs": true + "smarttabs": true, + "unused": false, + "camelcase": false, + "-W030": false, + "-W015": false, + "-W116": false, + "predef": [ + "require", + "define", + "alert" + ] } diff --git a/module/web/Gruntfile.js b/module/web/Gruntfile.js index 6e51c9b63..4799afb01 100644 --- a/module/web/Gruntfile.js +++ b/module/web/Gruntfile.js @@ -107,7 +107,7 @@ module.exports = function(grunt) { }, all: [ 'Gruntfile.js', - '<%= yeoman.app %>/scripts/{,*/}*.js', + '<%= yeoman.app %>/scripts/**/*.js', '!<%= yeoman.app %>/scripts/vendor/*', 'test/spec/{,*/}*.js' ] diff --git a/module/web/app/scripts/app.js b/module/web/app/scripts/app.js index f841c9393..427cb1bc8 100644 --- a/module/web/app/scripts/app.js +++ b/module/web/app/scripts/app.js @@ -50,10 +50,10 @@ define([ App.apiRequest = function(method, data, options) { options || (options = {}); options.url = App.apiUrl('api/' + method); - options.dataType = "json"; + options.dataType = 'json'; if (data) { - options.type = "POST"; + options.type = 'POST'; options.data = {}; // Convert arguments to json _.keys(data).map(function(key) { diff --git a/module/web/app/scripts/collections/AccountList.js b/module/web/app/scripts/collections/AccountList.js index 1bcf87c1e..bfc2af5a3 100644 --- a/module/web/app/scripts/collections/AccountList.js +++ b/module/web/app/scripts/collections/AccountList.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/Account'], function($, Backbone, _, App, Account) { + 'use strict'; return Backbone.Collection.extend({ diff --git a/module/web/app/scripts/collections/FileList.js b/module/web/app/scripts/collections/FileList.js index e91088867..873f4c0e3 100644 --- a/module/web/app/scripts/collections/FileList.js +++ b/module/web/app/scripts/collections/FileList.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'models/File'], function($, Backbone, _, File) { + 'use strict'; return Backbone.Collection.extend({ diff --git a/module/web/app/scripts/collections/InteractionList.js b/module/web/app/scripts/collections/InteractionList.js index 57622a075..24f8b9248 100644 --- a/module/web/app/scripts/collections/InteractionList.js +++ b/module/web/app/scripts/collections/InteractionList.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/InteractionTask'], function($, Backbone, _, App, InteractionTask) { + 'use strict'; return Backbone.Collection.extend({ diff --git a/module/web/app/scripts/collections/PackageList.js b/module/web/app/scripts/collections/PackageList.js index a36f8bcdc..7bee861a4 100644 --- a/module/web/app/scripts/collections/PackageList.js +++ b/module/web/app/scripts/collections/PackageList.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'models/Package'], function($, Backbone, _, Package) { + 'use strict'; return Backbone.Collection.extend({ diff --git a/module/web/app/scripts/collections/ProgressList.js b/module/web/app/scripts/collections/ProgressList.js index 1706d5f16..51849d8de 100644 --- a/module/web/app/scripts/collections/ProgressList.js +++ b/module/web/app/scripts/collections/ProgressList.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'models/Progress'], function($, Backbone, _, Progress) { + 'use strict'; return Backbone.Collection.extend({ diff --git a/module/web/app/scripts/config.js b/module/web/app/scripts/config.js index 9aeaf65a2..398d97e11 100644 --- a/module/web/app/scripts/config.js +++ b/module/web/app/scripts/config.js @@ -36,9 +36,9 @@ require.config({ hbs: { disableI18n: true, helperPathCallback: // Callback to determine the path to look for helpers - function (name) { - // Some helpers are accumulated into one file - if (name.indexOf('file') === 0) + function(name) { + // Some helpers are accumulated into one file + if (name.indexOf('file') === 0) name = 'fileHelper'; return 'helpers/' + name; diff --git a/module/web/app/scripts/helpers/fileHelper.js b/module/web/app/scripts/helpers/fileHelper.js index d48d7d863..156be58f0 100644 --- a/module/web/app/scripts/helpers/fileHelper.js +++ b/module/web/app/scripts/helpers/fileHelper.js @@ -7,17 +7,17 @@ define('helpers/fileHelper', ['handlebars', 'utils/apitypes', 'helpers/formatTim if (file.finished) return 'finished'; else if (file.failed) - return "failed"; + return 'failed'; else if (file.offline) - return "offline"; + return 'offline'; else if (file.online) - return "online"; + return 'online'; else if (file.waiting) - return "waiting"; + return 'waiting'; else if (file.downloading) - return "downloading"; + return 'downloading'; - return ""; + return ''; } // TODO @@ -31,17 +31,17 @@ define('helpers/fileHelper', ['handlebars', 'utils/apitypes', 'helpers/formatTim var msg = file.download.statusmsg; if (file.failed) { - s = "<i class='icon-remove'></i> "; + s = '<i class="icon-remove"></i> '; if (file.download.error) s += file.download.error; else s += msg; } else if (file.finished) - s = "<i class='icon-ok'></i> " + msg; + s = '<i class="icon-ok"></i> ' + msg; else if (file.downloading) - s = "<div class='progress'><div class='bar' style='width: " + file.progress + "%'> " + - formatTime(file.eta) + "</div></div>"; + s = '<div class="progress"><div class="bar" style="width: ' + file.progress + '%"> ' + + formatTime(file.eta) + '</div></div>'; else if (file.waiting) - s = "<i class='icon-time'></i> " + formatTime(file.eta); + s = '<i class="icon-time"></i> ' + formatTime(file.eta); else s = msg; diff --git a/module/web/app/scripts/helpers/formatSize.js b/module/web/app/scripts/helpers/formatSize.js index a50588bc6..3b62e74c7 100644 --- a/module/web/app/scripts/helpers/formatSize.js +++ b/module/web/app/scripts/helpers/formatSize.js @@ -1,9 +1,11 @@ // Format bytes in human readable format define('helpers/formatSize', ['handlebars'], function(Handlebars) { - var sizes = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"]; + 'use strict'; + + var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']; function formatSize(bytes, options) { if (!bytes || bytes === 0) return '0 B'; - var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10); // round to two digits return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i]; } diff --git a/module/web/app/scripts/helpers/formatTime.js b/module/web/app/scripts/helpers/formatTime.js index 77d67a39c..757ff73ad 100644 --- a/module/web/app/scripts/helpers/formatTime.js +++ b/module/web/app/scripts/helpers/formatTime.js @@ -1,12 +1,12 @@ // Format bytes in human readable format -define('helpers/formatTime', ['handlebars', 'utils/remaining'], function(Handlebars, Remaining) { - +define('helpers/formatTime', ['handlebars', 'vendor/remaining'], function(Handlebars, Remaining) { + 'use strict'; function formatTime(seconds, options) { if (seconds === Infinity) return '∞'; else if (!seconds || seconds <= 0) - return "-"; + return '-'; // TODO: digital or written string return Remaining.getStringDigital(seconds, window.dates); diff --git a/module/web/app/scripts/models/Account.js b/module/web/app/scripts/models/Account.js index c6e023578..a2e24b056 100644 --- a/module/web/app/scripts/models/Account.js +++ b/module/web/app/scripts/models/Account.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($, Backbone, _, App, Api) { + 'use strict'; return Backbone.Model.extend({ diff --git a/module/web/app/scripts/models/ConfigHolder.js b/module/web/app/scripts/models/ConfigHolder.js index b05b1e14b..40efbc7c0 100644 --- a/module/web/app/scripts/models/ConfigHolder.js +++ b/module/web/app/scripts/models/ConfigHolder.js @@ -1,12 +1,13 @@ define(['jquery', 'backbone', 'underscore', 'app', './ConfigItem'], function($, Backbone, _, App, ConfigItem) { + 'use strict'; return Backbone.Model.extend({ defaults: { - name: "", - label: "", - description: "", + name: '', + label: '', + description: '', long_description: null, // simple list but no collection items: null, diff --git a/module/web/app/scripts/models/ConfigItem.js b/module/web/app/scripts/models/ConfigItem.js index 01a85c6cc..2d325c2a2 100644 --- a/module/web/app/scripts/models/ConfigItem.js +++ b/module/web/app/scripts/models/ConfigItem.js @@ -1,12 +1,13 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($, Backbone, _, App, Api) { + 'use strict'; return Backbone.Model.extend({ defaults: { - name: "", - label: "", - description: "", + name: '', + label: '', + description: '', input: null, default_value: null, value: null, diff --git a/module/web/app/scripts/models/File.js b/module/web/app/scripts/models/File.js index 524637cb4..3beb7f270 100644 --- a/module/web/app/scripts/models/File.js +++ b/module/web/app/scripts/models/File.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($, Backbone, _, App, Api) { + 'use strict'; var Finished = [Api.DownloadStatus.Finished, Api.DownloadStatus.Skipped]; var Failed = [Api.DownloadStatus.Failed, Api.DownloadStatus.Aborted, Api.DownloadStatus.TempOffline, Api.DownloadStatus.Offline]; @@ -46,7 +47,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($ options = App.apiRequest( 'deleteFiles/[' + this.get('fid') + ']', null, options); - options.method = "post"; + options.method = 'post'; return Backbone.Model.prototype.destroy.call(this, options); }, diff --git a/module/web/app/scripts/models/InteractionTask.js b/module/web/app/scripts/models/InteractionTask.js index 56fdbf8bf..54c739d4b 100644 --- a/module/web/app/scripts/models/InteractionTask.js +++ b/module/web/app/scripts/models/InteractionTask.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($, Backbone, _, App, Api) { + 'use strict'; return Backbone.Model.extend({ @@ -10,11 +11,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], type: null, input: null, default_value: null, - title: "", - description: "", - plugin: "", + title: '', + description: '', + plugin: '', // additional attributes - result: "" + result: '' }, // Model Constructor diff --git a/module/web/app/scripts/models/Package.js b/module/web/app/scripts/models/Package.js index 3435265fe..a34ec1c69 100644 --- a/module/web/app/scripts/models/Package.js +++ b/module/web/app/scripts/models/Package.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/FileList', 'require'], function($, Backbone, _, App, FileList, require) { + 'use strict'; return Backbone.Model.extend({ @@ -8,12 +9,12 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/FileList', 'requ defaults: { pid: -1, name: null, - folder: "", + folder: '', root: -1, owner: -1, - site: "", - comment: "", - password: "", + site: '', + comment: '', + password: '', added: -1, tags: null, status: -1, diff --git a/module/web/app/scripts/models/Progress.js b/module/web/app/scripts/models/Progress.js index 96beb0198..b0bbb684d 100644 --- a/module/web/app/scripts/models/Progress.js +++ b/module/web/app/scripts/models/Progress.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'utils/apitypes'], function($, Backbone, _, Api) { + 'use strict'; return Backbone.Model.extend({ diff --git a/module/web/app/scripts/models/ServerStatus.js b/module/web/app/scripts/models/ServerStatus.js index 9242bdf95..59739b41e 100644 --- a/module/web/app/scripts/models/ServerStatus.js +++ b/module/web/app/scripts/models/ServerStatus.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; return Backbone.Model.extend({ @@ -20,7 +21,7 @@ define(['jquery', 'backbone', 'underscore'], }, - fetch: function() { + fetch: function(options) { options || (options = {}); options.url = 'api/getServerStatus'; diff --git a/module/web/app/scripts/models/TreeCollection.js b/module/web/app/scripts/models/TreeCollection.js index a528854b5..2f761e6cc 100644 --- a/module/web/app/scripts/models/TreeCollection.js +++ b/module/web/app/scripts/models/TreeCollection.js @@ -1,49 +1,50 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/Package', 'collections/FileList', 'collections/PackageList'], function($, Backbone, _, App, Package, FileList, PackageList) { - - // TreeCollection - // A Model and not a collection, aggregates other collections - return Backbone.Model.extend({ - - defaults : { - root: null, - packages: null, - files: null - }, - - initialize: function() { - - }, - - fetch: function(options) { - options || (options = {}); - var pid = options.pid || -1; - - options = App.apiRequest( - 'getFileTree/' + pid, - {full: false}, - options); - - console.log('Fetching package tree ' + pid); - return Backbone.Model.prototype.fetch.call(this, options); - }, - - // Parse the response and updates the collections - parse: function(resp) { - var ret = {}; - if (!this.has('packages')) - ret.packages = new PackageList(_.values(resp.packages)); - else - this.get('packages').set(_.values(resp.packages)); - - if (!this.has('files')) - ret.files = new FileList(_.values(resp.files)); - else - this.get('files').set(_.values(resp.files)); - - ret.root = new Package(resp.root); - return ret; - } - - }); -});
\ No newline at end of file + 'use strict'; + + // TreeCollection + // A Model and not a collection, aggregates other collections + return Backbone.Model.extend({ + + defaults: { + root: null, + packages: null, + files: null + }, + + initialize: function() { + + }, + + fetch: function(options) { + options || (options = {}); + var pid = options.pid || -1; + + options = App.apiRequest( + 'getFileTree/' + pid, + {full: false}, + options); + + console.log('Fetching package tree ' + pid); + return Backbone.Model.prototype.fetch.call(this, options); + }, + + // Parse the response and updates the collections + parse: function(resp) { + var ret = {}; + if (!this.has('packages')) + ret.packages = new PackageList(_.values(resp.packages)); + else + this.get('packages').set(_.values(resp.packages)); + + if (!this.has('files')) + ret.files = new FileList(_.values(resp.files)); + else + this.get('files').set(_.values(resp.files)); + + ret.root = new Package(resp.root); + return ret; + } + + }); + });
\ No newline at end of file diff --git a/module/web/app/scripts/routers/defaultRouter.js b/module/web/app/scripts/routers/defaultRouter.js index 95b8de967..4b00d160c 100644 --- a/module/web/app/scripts/routers/defaultRouter.js +++ b/module/web/app/scripts/routers/defaultRouter.js @@ -1,8 +1,9 @@ -define(['jquery','backbone','views/headerView'], function($, Backbone, HeaderView){ +define(['jquery', 'backbone', 'views/headerView'], function($, Backbone, HeaderView) { + 'use strict'; var Router = Backbone.Router.extend({ - initialize: function(){ + initialize: function() { Backbone.history.start(); }, @@ -14,7 +15,7 @@ define(['jquery','backbone','views/headerView'], function($, Backbone, HeaderVie }, - 'home': function(){ + 'home': function() { // Instantiating mainView and anotherView instances var headerView = new HeaderView(); diff --git a/module/web/app/scripts/routers/mobileRouter.js b/module/web/app/scripts/routers/mobileRouter.js index 7f1f7805e..e24cb7a34 100644 --- a/module/web/app/scripts/routers/mobileRouter.js +++ b/module/web/app/scripts/routers/mobileRouter.js @@ -1,11 +1,12 @@ -define(['jquery','backbone', 'underscore'], function($, Backbone, _){ +define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; return Backbone.Router.extend({ - initialize: function(){ - _.bindAll(this, "changePage"); + initialize: function() { + _.bindAll(this, 'changePage'); - this.$el = $("#content"); + this.$el = $('#content'); // Tells Backbone to start watching for hashchange events Backbone.history.start(); @@ -20,27 +21,27 @@ define(['jquery','backbone', 'underscore'], function($, Backbone, _){ }, - 'home': function(){ + 'home': function() { var self = this; - $("#p1").fastClick(function(){ - self.changePage($("<div class='page' style='background-color: #9acd32;'><h1>Page 1</h1><br>some content<br>sdfdsf<br>sdffg<h3>oiuzz</h3></div>")); + $('#p1').fastClick(function() { + self.changePage($('<div class=\'page\' style=\'background-color: #9acd32;\'><h1>Page 1</h1><br>some content<br>sdfdsf<br>sdffg<h3>oiuzz</h3></div>')); }); - $("#p2").bind("click", function(){ - self.changePage($("<div class='page' style='background-color: blue;'><h1>Page 2</h1><br>some content<br>sdfdsf<br><h2>sdfsdf</h2>sdffg</div>")); + $('#p2').bind('click', function() { + self.changePage($('<div class=\'page\' style=\'background-color: blue;\'><h1>Page 2</h1><br>some content<br>sdfdsf<br><h2>sdfsdf</h2>sdffg</div>')); }); }, - changePage: function(content){ + changePage: function(content) { - var oldpage = this.$el.find(".page"); - content.css({x: "100%"}); + var oldpage = this.$el.find('.page'); + content.css({x: '100%'}); this.$el.append(content); - content.transition({x:0}, function(){ - window.setTimeout(function(){ + content.transition({x: 0}, function() { + window.setTimeout(function() { oldpage.remove(); }, 400); }); diff --git a/module/web/app/scripts/utils/animations.js b/module/web/app/scripts/utils/animations.js index 5131d3b8a..7f89afef1 100644 --- a/module/web/app/scripts/utils/animations.js +++ b/module/web/app/scripts/utils/animations.js @@ -1,4 +1,5 @@ define(['jquery', 'underscore', 'transit'], function(jQuery, _) { + 'use strict'; // Adds an element and computes its height, which is saved as data attribute // Important function to have slide animations diff --git a/module/web/app/scripts/utils/apitypes.js b/module/web/app/scripts/utils/apitypes.js index 28620250e..cbbc9064f 100644 --- a/module/web/app/scripts/utils/apitypes.js +++ b/module/web/app/scripts/utils/apitypes.js @@ -1,5 +1,7 @@ // Autogenerated, do not edit! +/*jslint -W070: false*/ define([], function() { + 'use strict'; return { DownloadState: {'Failed': 3, 'All': 0, 'Unmanaged': 4, 'Finished': 1, 'Unfinished': 2}, DownloadStatus: {'Downloading': 10, 'NA': 0, 'Processing': 14, 'Waiting': 9, 'Decrypting': 13, 'Paused': 4, 'Failed': 7, 'Finished': 5, 'Skipped': 6, 'Unknown': 16, 'Aborted': 12, 'Online': 2, 'TempOffline': 11, 'Offline': 1, 'Custom': 15, 'Starting': 8, 'Queued': 3}, diff --git a/module/web/app/scripts/utils/dialogs.js b/module/web/app/scripts/utils/dialogs.js index 13478ff88..4933b7ed2 100644 --- a/module/web/app/scripts/utils/dialogs.js +++ b/module/web/app/scripts/utils/dialogs.js @@ -1,13 +1,14 @@ // Loads all helper and set own handlebars rules -define(['jquery', 'underscore', 'views/abstract/modalView'], function($, _, modal) { +define(['jquery', 'underscore', 'views/abstract/modalView'], function($, _, Modal) { + 'use strict'; // Shows the confirm dialog for given context // on success executes func with context _.confirm = function(template, func, context) { - template = "text!tpl/" + template; + template = 'text!tpl/' + template; _.requireOnce([template], function(html) { var template = _.compile(html); - var dialog = new modal(template, _.bind(func, context)); + var dialog = new Modal(template, _.bind(func, context)); dialog.show(); }); diff --git a/module/web/app/scripts/utils/initHB.js b/module/web/app/scripts/utils/initHB.js index c977f063d..d7f582521 100644 --- a/module/web/app/scripts/utils/initHB.js +++ b/module/web/app/scripts/utils/initHB.js @@ -2,6 +2,7 @@ define(['underscore', 'handlebars', 'helpers/formatSize', 'helpers/fileHelper', 'helpers/formatTime'], function(_, Handlebars) { + 'use strict'; // Replace with own lexer rules compiled from handlebars.l Handlebars.Parser.lexer.rules = [/^(?:[^\x00]*?(?=(<%)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|$)))/, /^(?:\{\{>)/, /^(?:<%=)/, /^(?:<%\/)/, /^(?:\{\{\^)/, /^(?:<%\s*else\b)/, /^(?:\{<%%)/, /^(?:\{\{&)/, /^(?:<%![\s\S]*?%>)/, /^(?:<%)/, /^(?:=)/, /^(?:\.(?=[%} ]))/, /^(?:\.\.)/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:%%>)/, /^(?:%>)/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@[a-zA-Z]+)/, /^(?:true(?=[%}\s]))/, /^(?:false(?=[%}\s]))/, /^(?:[0-9]+(?=[%}\s]))/, /^(?:[a-zA-Z0-9_$-]+(?=[=%}\s\/.]))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; _.compile = Handlebars.compile; diff --git a/module/web/app/scripts/utils/lazyRequire.js b/module/web/app/scripts/utils/lazyRequire.js index b381e0ce6..96c07aa24 100644 --- a/module/web/app/scripts/utils/lazyRequire.js +++ b/module/web/app/scripts/utils/lazyRequire.js @@ -1,17 +1,18 @@ // Define the module. define( [ - "require", "underscore" + 'require', 'underscore' ], function( require, _ ){ + 'use strict'; // Define the states of loading for a given set of modules // within a require() statement. var states = { - unloaded: "UNLOADED", - loading: "LOADING", - loaded: "LOADED" + unloaded: 'UNLOADED', + loading: 'LOADING', + loaded: 'LOADED' }; @@ -86,7 +87,7 @@ define( if (!_.has(instances, dependencies)) instances[dependencies] = lazyRequire.once(); - return instances[dependencies](dependencies, loadCallback) + return instances[dependencies](dependencies, loadCallback); }; diff --git a/module/web/app/scripts/utils/remaining.js b/module/web/app/scripts/vendor/remaining.js index d66a2931a..d66a2931a 100644 --- a/module/web/app/scripts/utils/remaining.js +++ b/module/web/app/scripts/vendor/remaining.js diff --git a/module/web/app/scripts/views/abstract/itemView.js b/module/web/app/scripts/views/abstract/itemView.js index 394044ec4..c37118a4c 100644 --- a/module/web/app/scripts/views/abstract/itemView.js +++ b/module/web/app/scripts/views/abstract/itemView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; // A view that is meant for temporary displaying // All events must be unbound in onDestroy diff --git a/module/web/app/scripts/views/abstract/modalView.js b/module/web/app/scripts/views/abstract/modalView.js index 170681f06..9d1d72869 100644 --- a/module/web/app/scripts/views/abstract/modalView.js +++ b/module/web/app/scripts/views/abstract/modalView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, _) { + 'use strict'; return Backbone.View.extend({ @@ -41,7 +42,7 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, this.$el.css({opacity: 0, scale: 0.7}); var self = this; - $("body").append(this.el); + $('body').append(this.el); this.dialog = this.$el.omniWindow({ overlay: { selector: '#modal-overlay', diff --git a/module/web/app/scripts/views/accounts/accountModal.js b/module/web/app/scripts/views/accounts/accountModal.js index e5315c26c..6c2b226df 100644 --- a/module/web/app/scripts/views/accounts/accountModal.js +++ b/module/web/app/scripts/views/accounts/accountModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/addAccount', 'helpers/pluginIcon', 'select2'], function($, _, App, modalView, template, pluginIcon) { + 'use strict'; return modalView.extend({ events: { @@ -47,7 +48,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial }, format: function(data) { - return '<img class="logo-select" src="' + pluginIcon(data) + '"> ' + data; + return '<img class="logo-select" src="' + pluginIcon(data) + '"> ' + data; }, add: function(e) { diff --git a/module/web/app/scripts/views/dashboard/dashboardView.js b/module/web/app/scripts/views/dashboard/dashboardView.js index 0ae9110d7..e7adba475 100644 --- a/module/web/app/scripts/views/dashboard/dashboardView.js +++ b/module/web/app/scripts/views/dashboard/dashboardView.js @@ -1,6 +1,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', './packageView', './fileView', 'hbs!tpl/dashboard/layout', 'select2'], - function($, Backbone, _, App, TreeCollection, packageView, fileView, template) { + function($, Backbone, _, App, TreeCollection, PackageView, FileView, template) { + 'use strict'; // Renders whole dashboard return Backbone.Marionette.ItemView.extend({ @@ -58,7 +59,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', }); }}); - this.$('.input').select2({tags: ["a", "b", "sdf"]}); + this.$('.input').select2({tags: ['a', 'b', 'sdf']}); }, update: function() { @@ -87,12 +88,12 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection', // TODO sorting ?! // Append a package to the list, index, animate it appendPackage: function(pack, i, animation) { - var el = new packageView({model: pack}).render().el; + var el = new PackageView({model: pack}).render().el; $(this.ui.packages).appendWithAnimation(el, animation); }, appendFile: function(file, i, animation) { - var el = new fileView({model: file}).render().el; + var el = new FileView({model: file}).render().el; $(this.ui.files).appendWithAnimation(el, animation); }, diff --git a/module/web/app/scripts/views/dashboard/fileView.js b/module/web/app/scripts/views/dashboard/fileView.js index c0eec7adf..4e5884ed8 100644 --- a/module/web/app/scripts/views/dashboard/fileView.js +++ b/module/web/app/scripts/views/dashboard/fileView.js @@ -1,5 +1,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'helpers/formatTime', 'hbs!tpl/dashboard/file'], function($, Backbone, _, App, Api, ItemView, formatTime, template) { + 'use strict'; // Renders single file item return ItemView.extend({ @@ -91,7 +92,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abst bar.html(' ' + formatTime(this.model.get('eta'))); } else if (this.model.get('download').status === Api.DownloadStatus.Waiting) { this.$('.second').html( - "<i class='icon-time'></i> " + formatTime(this.model.get('eta'))); + '<i class="icon-time"></i> ' + formatTime(this.model.get('eta'))); } else // Every else state can be renderred normally this.render(); diff --git a/module/web/app/scripts/views/dashboard/filterView.js b/module/web/app/scripts/views/dashboard/filterView.js index bcbda64c8..64bc56724 100644 --- a/module/web/app/scripts/views/dashboard/filterView.js +++ b/module/web/app/scripts/views/dashboard/filterView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Package', 'hbs!tpl/dashboard/actionbar'], + /*jslint -W040: false*/ function($, Backbone, _, App, Api, Package, template) { 'use strict'; diff --git a/module/web/app/scripts/views/dashboard/packageView.js b/module/web/app/scripts/views/dashboard/packageView.js index 6e09cbb96..2738fcbea 100644 --- a/module/web/app/scripts/views/dashboard/packageView.js +++ b/module/web/app/scripts/views/dashboard/packageView.js @@ -1,5 +1,6 @@ define(['jquery', 'app', 'views/abstract/itemView', 'underscore', 'hbs!tpl/dashboard/package'], function($, App, itemView, _, template) { + 'use strict'; // Renders a single package item return itemView.extend({ diff --git a/module/web/app/scripts/views/dashboard/selectionView.js b/module/web/app/scripts/views/dashboard/selectionView.js index a070aa9a0..8685fd849 100644 --- a/module/web/app/scripts/views/dashboard/selectionView.js +++ b/module/web/app/scripts/views/dashboard/selectionView.js @@ -96,7 +96,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'], }, pause: function() { - alert("Not implemented yet"); + alert('Not implemented yet'); this.deselect(); }, diff --git a/module/web/app/scripts/views/headerView.js b/module/web/app/scripts/views/headerView.js index bbb999186..512c7259b 100644 --- a/module/web/app/scripts/views/headerView.js +++ b/module/web/app/scripts/views/headerView.js @@ -1,7 +1,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'collections/ProgressList', 'views/progressView', 'views/notificationView', 'helpers/formatSize', 'hbs!tpl/header/layout', 'hbs!tpl/header/status', 'hbs!tpl/header/progressbar' , 'flot'], - function($, _, Backbone, App, ServerStatus, ProgressList, ProgressView, notificationView, formatSize, + function($, _, Backbone, App, ServerStatus, ProgressList, ProgressView, NotificationView, formatSize, template, templateStatus, templateHeader) { 'use strict'; // Renders the header with all information @@ -41,7 +41,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle initialize: function() { var self = this; - this.notificationView = new notificationView(); + this.notificationView = new NotificationView(); this.status = new ServerStatus(); this.listenTo(this.status, 'change', this.update); @@ -60,7 +60,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle ws.onmessage = _.bind(this.onData, this); ws.onerror = function(error) { console.log(error); - alert("WebSocket error" + error); + alert('WebSocket error' + error); }; this.ws = ws; @@ -79,16 +79,16 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle series: { lines: { show: true, lineWidth: 2 }, shadowSize: 0, - color: "#fee247" + color: '#fee247' }, xaxis: { ticks: [] }, yaxis: { ticks: [], min: 1, autoscaleMargin: 0.1, tickFormatter: function(data) { return formatSize(data * 1024); - }, position: "right" }, + }, position: 'right' }, grid: { show: true, // borderColor: "#757575", - borderColor: "white", + borderColor: 'white', borderWidth: 1, labelMargin: 0, axisMargin: 0, @@ -152,9 +152,9 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle open_grabber: function() { var self = this; - _.requireOnce(['views/linkGrabberModal'], function(modalView) { + _.requireOnce(['views/linkGrabberModal'], function(ModalView) { if (self.grabber === null) - self.grabber = new modalView(); + self.grabber = new ModalView(); self.grabber.show(); }); @@ -164,7 +164,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle var data = JSON.parse(evt.data); if (data === null) return; - if (data['@class'] === "ServerStatus") { + if (data['@class'] === 'ServerStatus') { // TODO: load interaction when none available this.status.set(data); @@ -210,7 +210,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ServerStatus', 'colle if (file) { file.set({ progress: prog.getPercent(), - eta: prog.get('eta'), + eta: prog.get('eta') }, {silent: true}); file.trigger('change:progress'); diff --git a/module/web/app/scripts/views/input/inputLoader.js b/module/web/app/scripts/views/input/inputLoader.js index 5ccf07695..11665abb4 100644 --- a/module/web/app/scripts/views/input/inputLoader.js +++ b/module/web/app/scripts/views/input/inputLoader.js @@ -1,4 +1,5 @@ define(['./textInput'], function(textInput) { + 'use strict'; // selects appropriate input element return function(input, value, default_value, description) { diff --git a/module/web/app/scripts/views/input/inputView.js b/module/web/app/scripts/views/input/inputView.js index f2601c3eb..1fbe5042d 100644 --- a/module/web/app/scripts/views/input/inputView.js +++ b/module/web/app/scripts/views/input/inputView.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { + 'use strict'; // Renders input elements return Backbone.View.extend({ @@ -29,7 +30,7 @@ define(['jquery', 'backbone', 'underscore'], function($, Backbone, _) { // this.$el.data('title', "TODO: title"); this.$el.popover({ placement: 'right', - trigger: 'hover', + trigger: 'hover' // delay: { show: 500, hide: 100 } }); } diff --git a/module/web/app/scripts/views/input/textInput.js b/module/web/app/scripts/views/input/textInput.js index 3a6631a0b..0eebbf91e 100644 --- a/module/web/app/scripts/views/input/textInput.js +++ b/module/web/app/scripts/views/input/textInput.js @@ -1,4 +1,5 @@ define(['jquery', 'backbone', 'underscore', './inputView'], function($, Backbone, _, inputView) { + 'use strict'; return inputView.extend({ diff --git a/module/web/app/scripts/views/linkGrabberModal.js b/module/web/app/scripts/views/linkGrabberModal.js index 9be90ac3c..e6f59c134 100644 --- a/module/web/app/scripts/views/linkGrabberModal.js +++ b/module/web/app/scripts/views/linkGrabberModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/linkgrabber'], function($, _, App, modalView, template) { + 'use strict'; // Modal dialog for package adding - triggers package:added when package was added return modalView.extend({ @@ -16,7 +17,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial }, addOnEnter: function(e) { - if (e.keyCode != 13) return; + if (e.keyCode !== 13) return; this.addPackage(e); }, @@ -26,7 +27,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dial { name: $('#inputPackageName').val(), // TODO: better parsing / tokenization - links: $('#inputLinks').val().split("\n") + links: $('#inputLinks').val().split('\n') }, { success: function() { diff --git a/module/web/app/scripts/views/notificationView.js b/module/web/app/scripts/views/notificationView.js index 1dc150c79..abfcd8079 100644 --- a/module/web/app/scripts/views/notificationView.js +++ b/module/web/app/scripts/views/notificationView.js @@ -63,9 +63,9 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList' openQuery: function() { var self = this; - _.requireOnce(['views/queryModal'], function(modalView) { + _.requireOnce(['views/queryModal'], function(ModalView) { if (self.modal === null) { - self.modal = new modalView(); + self.modal = new ModalView(); self.modal.parent = self; } diff --git a/module/web/app/scripts/views/progressView.js b/module/web/app/scripts/views/progressView.js index 6b77d1ba6..3a4bb2825 100644 --- a/module/web/app/scripts/views/progressView.js +++ b/module/web/app/scripts/views/progressView.js @@ -1,6 +1,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'views/abstract/itemView', 'hbs!tpl/header/progress', 'helpers/pluginIcon'], function($, Backbone, _, App, Api, ItemView, template, pluginIcon) { + 'use strict'; // Renders single file item return ItemView.extend({ diff --git a/module/web/app/scripts/views/queryModal.js b/module/web/app/scripts/views/queryModal.js index 5477334a0..7c6439b49 100644 --- a/module/web/app/scripts/views/queryModal.js +++ b/module/web/app/scripts/views/queryModal.js @@ -1,5 +1,6 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'text!tpl/default/queryDialog.html'], function($, _, App, modalView, load_input, template) { + 'use strict'; return modalView.extend({ // TODO: submit on enter reloads the page sometimes @@ -38,8 +39,8 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inpu onRender: function() { // instantiate the input var input = this.model.get('input'); - var inputView = load_input(input); - this.input = new inputView(input); + var InputView = load_input(input); + this.input = new InputView(input); // only renders after wards this.$('#inputField').append(this.input.render().el); }, diff --git a/module/web/app/scripts/views/settings/configSectionView.js b/module/web/app/scripts/views/settings/configSectionView.js index 5bbcf1826..e05701b2a 100644 --- a/module/web/app/scripts/views/settings/configSectionView.js +++ b/module/web/app/scripts/views/settings/configSectionView.js @@ -1,6 +1,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../input/inputLoader', 'hbs!tpl/settings/config', 'hbs!tpl/settings/configItem'], function($, _, Backbone, App, itemView, load_input, template, templateItem) { + 'use strict'; // Renders settings over view page return itemView.extend({ @@ -28,7 +29,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i // initialize the popover this.$('.page-header a').popover({ - placement: 'left', + placement: 'left' // trigger: 'hover' }); @@ -37,8 +38,8 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i _.each(this.model.get('items'), function(item) { var json = item.toJSON(); var el = $('<div>').html(self.templateItem(json)); - var inputView = load_input(item.get('input')); - var input = new inputView(json).render(); + var InputView = load_input(item.get('input')); + var input = new InputView(json).render(); item.set('inputView', input); self.listenTo(input, 'change', _.bind(self.render, self)); @@ -66,7 +67,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i return this; }, - onDestroy: function(){ + onDestroy: function() { // TODO: correct cleanup after building up so many views and models }, @@ -74,7 +75,7 @@ define(['jquery', 'underscore', 'backbone', 'app', '../abstract/itemView', '../i e.stopPropagation(); // TODO: success / failure popups var self = this; - this.model.save({success: function(){ + this.model.save({success: function() { self.render(); App.settingsView.refresh(); }}); diff --git a/module/web/app/scripts/views/settings/pluginChooserModal.js b/module/web/app/scripts/views/settings/pluginChooserModal.js index c604452e6..91e9f11b3 100644 --- a/module/web/app/scripts/views/settings/pluginChooserModal.js +++ b/module/web/app/scripts/views/settings/pluginChooserModal.js @@ -1,6 +1,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'hbs!tpl/dialogs/addPluginConfig', 'helpers/pluginIcon', 'select2'], function($, _, App, modalView, template, pluginIcon) { + 'use strict'; return modalView.extend({ events: { diff --git a/module/web/app/scripts/views/settings/settingsView.js b/module/web/app/scripts/views/settings/settingsView.js index 23701e83d..cad5ab075 100644 --- a/module/web/app/scripts/views/settings/settingsView.js +++ b/module/web/app/scripts/views/settings/settingsView.js @@ -47,11 +47,11 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con refresh: function() { var self = this; - $.ajax(App.apiRequest("getCoreConfig", null, {success: function(data) { + $.ajax(App.apiRequest('getCoreConfig', null, {success: function(data) { self.coreConfig = data; self.renderMenu(); }})); - $.ajax(App.apiRequest("getPluginConfig", null, {success: function(data) { + $.ajax(App.apiRequest('getPluginConfig', null, {success: function(data) { self.pluginConfig = data; self.renderMenu(); }})); @@ -82,7 +82,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con })); // mark the selected element - this.$('li[data-name="' + this.selected + '"]').addClass("active"); + this.$('li[data-name="' + this.selected + '"]').addClass('active'); }, openConfig: function(name) { @@ -151,11 +151,11 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con var el = $(e.target).closest('li'); - this.selected = el.data("name"); + this.selected = el.data('name'); this.openConfig(this.selected); - this.ui.menu.find("li.active").removeClass("active"); - el.addClass("active"); + this.ui.menu.find('li.active').removeClass('active'); + el.addClass('active'); e.preventDefault(); }, @@ -172,9 +172,9 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/ConfigHolder', './con deleteConfig: function(e) { e.stopPropagation(); var el = $(e.target).parent().parent(); - var name = el.data("name"); + var name = el.data('name'); var self = this; - $.ajax(App.apiRequest("deleteConfig", {plugin: name}, { success: function() { + $.ajax(App.apiRequest('deleteConfig', {plugin: name}, { success: function() { self.refresh(); }})); |