diff --git a/couchpotato/core/_base/downloader/static/downloaders.js b/couchpotato/core/_base/downloader/static/downloaders.js index 45215158..49dc67ec 100644 --- a/couchpotato/core/_base/downloader/static/downloaders.js +++ b/couchpotato/core/_base/downloader/static/downloaders.js @@ -16,8 +16,8 @@ var DownloadersBase = new Class({ var setting_page = App.getPage('Settings'); setting_page.addEvent('create', function(){ - Object.each(setting_page.tabs.downloaders.groups, self.addTestButton.bind(self)) - }) + Object.each(setting_page.tabs.downloaders.groups, self.addTestButton.bind(self)); + }); }, @@ -44,19 +44,19 @@ var DownloadersBase = new Class({ if(json.success){ message = new Element('span.success', { 'text': 'Connection successful' - }).inject(button, 'after') + }).inject(button, 'after'); } else { var msg_text = 'Connection failed. Check logs for details.'; if(json.hasOwnProperty('msg')) msg_text = json.msg; message = new Element('span.failed', { 'text': msg_text - }).inject(button, 'after') + }).inject(button, 'after'); } (function(){ message.destroy(); - }).delay(3000) + }).delay(3000); } }); } diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 331e0707..1ee937a8 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -27,7 +27,7 @@ var UpdaterBase = new Class({ App.trigger('message', ['No updates available']); } } - }) + }); }, @@ -50,8 +50,8 @@ var UpdaterBase = new Class({ self.message.destroy(); } } - }) - }, (timeout || 0)) + }); + }, (timeout || 0)); }, @@ -84,7 +84,7 @@ var UpdaterBase = new Class({ 'click': self.doUpdate.bind(self) } }) - ).inject(document.body) + ).inject(document.body); }, doUpdate: function(){ @@ -96,7 +96,7 @@ var UpdaterBase = new Class({ if(json.success) self.updating(); else - App.unBlockPage() + App.unBlockPage(); } }); }, diff --git a/couchpotato/core/downloaders/putio/static/putio.js b/couchpotato/core/downloaders/putio/static/putio.js index f58292ae..438348f8 100644 --- a/couchpotato/core/downloaders/putio/static/putio.js +++ b/couchpotato/core/downloaders/putio/static/putio.js @@ -17,7 +17,7 @@ var PutIODownloader = new Class({ var putio_set = 0; fieldset.getElements('input[type=text]').each(function(el){ - putio_set += +(el.get('value') != ''); + putio_set += +(el.get('value') !== ''); }); new Element('.ctrlHolder').adopt( @@ -57,7 +57,7 @@ var PutIODownloader = new Class({ } }) ).inject(fieldset.getElement('.test_button'), 'before'); - }) + }); } diff --git a/couchpotato/core/media/_base/search/static/search.js b/couchpotato/core/media/_base/search/static/search.js index 12227641..5fa24888 100644 --- a/couchpotato/core/media/_base/search/static/search.js +++ b/couchpotato/core/media/_base/search/static/search.js @@ -21,11 +21,11 @@ var BlockSearch = new Class({ if(focus_timer) clearTimeout(focus_timer); self.el.addClass('focused'); if(this.get('value')) - self.hideResults(false) + self.hideResults(false); }, 'blur': function(){ focus_timer = (function(){ - self.el.removeClass('focused') + self.el.removeClass('focused'); }).delay(100); } } @@ -71,7 +71,7 @@ var BlockSearch = new Class({ self.media = {}; self.results.empty(); - self.el.removeClass('filled') + self.el.removeClass('filled'); } }, @@ -105,7 +105,7 @@ var BlockSearch = new Class({ self.api_request.cancel(); if(self.autocomplete_timer) clearTimeout(self.autocomplete_timer); - self.autocomplete_timer = self.autocomplete.delay(300, self) + self.autocomplete_timer = self.autocomplete.delay(300, self); } }, @@ -115,10 +115,10 @@ var BlockSearch = new Class({ if(!self.q()){ self.hideResults(true); - return + return; } - self.list() + self.list(); }, list: function(){ @@ -139,7 +139,7 @@ var BlockSearch = new Class({ 'q': q }, 'onComplete': self.fill.bind(self, q) - }) + }); } else self.fill(q, cache); @@ -158,14 +158,14 @@ var BlockSearch = new Class({ Object.each(json, function(media){ if(typeOf(media) == 'array'){ - Object.each(media, function(m){ + Object.each(media, function(me){ - var m = new BlockSearch[m.type.capitalize() + 'Item'](m); + var m = new BlockSearch[me.type.capitalize() + 'Item'](me); $(m).inject(self.results); self.media[m.imdb || 'r-'+Math.floor(Math.random()*10000)] = m; if(q == m.imdb) - m.showOptions() + m.showOptions(); }); } @@ -176,12 +176,12 @@ var BlockSearch = new Class({ rc = self.result_container.getCoordinates(); self.results.setStyle('max-height', (w.y - rc.top - 50) + 'px'); - self.mask.fade('out') + self.mask.fade('out'); }, loading: function(bool){ - this.el[bool ? 'addClass' : 'removeClass']('loading') + this.el[bool ? 'addClass' : 'removeClass']('loading'); }, q: function(){ diff --git a/couchpotato/core/media/movie/_base/static/list.js b/couchpotato/core/media/movie/_base/static/list.js index 323a22ae..6fa75b8d 100644 --- a/couchpotato/core/media/movie/_base/static/list.js +++ b/couchpotato/core/media/movie/_base/static/list.js @@ -53,7 +53,7 @@ var MovieList = new Class({ self.getMovies(); App.on('movie.added', self.movieAdded.bind(self)); - App.on('movie.deleted', self.movieDeleted.bind(self)) + App.on('movie.deleted', self.movieDeleted.bind(self)); }, movieDeleted: function(notification){ @@ -67,7 +67,7 @@ var MovieList = new Class({ self.setCounter(self.counter_count-1); self.total_movies--; } - }) + }); } self.checkIfEmpty(); @@ -97,7 +97,7 @@ var MovieList = new Class({ self.scrollspy = new ScrollSpy({ min: function(){ var c = self.load_more.getCoordinates(); - return c.top - window.document.getSize().y - 300 + return c.top - window.document.getSize().y - 300; }, onEnter: self.loadMore.bind(self) }); @@ -138,7 +138,7 @@ var MovieList = new Class({ self.empty_message = null; } - if(self.total_movies && count == 0 && !self.empty_message){ + if(self.total_movies && count === 0 && !self.empty_message){ var message = (self.filter.search ? 'for "'+self.filter.search+'"' : '') + (self.filter.starts_with ? ' in '+self.filter.starts_with+'' : ''); @@ -245,7 +245,7 @@ var MovieList = new Class({ el.getSiblings().hide(); setTimeout(function(){ el.getSiblings().setStyle('display', null); - }, 100) + }, 100); } } }), @@ -261,7 +261,7 @@ var MovieList = new Class({ new Element('option', { 'value': profile.get('_id'), 'text': profile.get('label') - }).inject(self.mass_edit_quality) + }).inject(self.mass_edit_quality); }); self.filter_menu.addLink( @@ -289,8 +289,8 @@ var MovieList = new Class({ available_chars = json.chars; available_chars.each(function(c){ - self.letters[c.capitalize()].addClass('available') - }) + self.letters[c.capitalize()].addClass('available'); + }); } }); @@ -301,7 +301,7 @@ var MovieList = new Class({ 'events': { 'click:relay(li.available)': function(e, el){ self.activateLetter(el.get('data-letter')); - self.getMovies(true) + self.getMovies(true); } } }) @@ -317,7 +317,7 @@ var MovieList = new Class({ }); // All - self.letters['all'] = new Element('li.letter_all.available.active', { + self.letters.all = new Element('li.letter_all.available.active', { 'text': 'ALL' }).inject(self.navigation_alpha); @@ -346,7 +346,7 @@ var MovieList = new Class({ var selected = 0, movies = self.movies.length; self.movies.each(function(movie){ - selected += movie.isSelected() ? 1 : 0 + selected += movie.isSelected() ? 1 : 0; }); var indeterminate = selected > 0 && selected < movies, @@ -441,10 +441,10 @@ var MovieList = new Class({ var ids = []; self.movies.each(function(movie){ if (movie.isSelected()) - ids.include(movie.get('_id')) + ids.include(movie.get('_id')); }); - return ids + return ids; }, massEditToggleAll: function(){ @@ -453,10 +453,10 @@ var MovieList = new Class({ var select = self.mass_edit_select.get('checked'); self.movies.each(function(movie){ - movie.select(select) + movie.select(select); }); - self.calculateSelected() + self.calculateSelected(); }, reset: function(){ @@ -537,7 +537,7 @@ var MovieList = new Class({ self.load_more.set('text', 'loading...'); } - if(self.movies.length == 0 && self.options.loader){ + if(self.movies.length === 0 && self.options.loader){ self.loader_first = new Element('div.loading').adopt( new Element('div.message', {'text': self.options.title ? 'Loading \'' + self.options.title + '\'' : 'Loading...'}) @@ -590,7 +590,7 @@ var MovieList = new Class({ loadMore: function(){ var self = this; if(self.offset >= self.options.limit) - self.getMovies() + self.getMovies(); }, store: function(movies){ @@ -603,7 +603,7 @@ var MovieList = new Class({ checkIfEmpty: function(){ var self = this; - var is_empty = self.movies.length == 0 && (self.total_movies == 0 || self.total_movies === undefined); + var is_empty = self.movies.length === 0 && (self.total_movies === 0 || self.total_movies === undefined); if(self.title) self.title[is_empty ? 'hide' : 'show'](); diff --git a/couchpotato/core/media/movie/_base/static/manage.js b/couchpotato/core/media/movie/_base/static/manage.js index c967c459..27f9f5e1 100644 --- a/couchpotato/core/media/movie/_base/static/manage.js +++ b/couchpotato/core/media/movie/_base/static/manage.js @@ -126,12 +126,12 @@ var MoviesManage = new Class({ (folder_progress.eta > 0 ? ', ' + new Date ().increment('second', folder_progress.eta).timeDiffInWords().replace('from now', 'to go') : '') }), new Element('span.percentage', {'text': folder_progress.total ? Math.round(((folder_progress.total-folder_progress.to_go)/folder_progress.total)*100) + '%' : '0%'}) - ).inject(self.progress_container) + ).inject(self.progress_container); }); } } - }) + }); }, 1000); }, @@ -141,10 +141,10 @@ var MoviesManage = new Class({ for (folder in progress_object) { if (progress_object.hasOwnProperty(folder)) { - temp_array.push(folder) + temp_array.push(folder); } } - return temp_array.stableSort() + return temp_array.stableSort(); } }); diff --git a/couchpotato/core/media/movie/_base/static/movie.actions.js b/couchpotato/core/media/movie/_base/static/movie.actions.js index 09a998f3..de78818c 100644 --- a/couchpotato/core/media/movie/_base/static/movie.actions.js +++ b/couchpotato/core/media/movie/_base/static/movie.actions.js @@ -12,19 +12,19 @@ var MovieAction = new Class({ self.create(); if(self.el) - self.el.addClass(self.class_name) + self.el.addClass(self.class_name); }, create: function(){}, disable: function(){ if(this.el) - this.el.addClass('disable') + this.el.addClass('disable'); }, enable: function(){ if(this.el) - this.el.removeClass('disable') + this.el.removeClass('disable'); }, getTitle: function(){ @@ -37,7 +37,7 @@ var MovieAction = new Class({ try { return self.movie.original_title ? self.movie.original_title : self.movie.titles[0]; } - catch(e){ + catch(e2){ return 'Unknown'; } } @@ -46,10 +46,10 @@ var MovieAction = new Class({ get: function(key){ var self = this; try { - return self.movie.get(key) + return self.movie.get(key); } catch(e){ - return self.movie[key] + return self.movie[key]; } }, @@ -63,7 +63,7 @@ var MovieAction = new Class({ }, toElement: function(){ - return this.el || null + return this.el || null; } }); @@ -105,7 +105,7 @@ MA.Release = new Class({ } }); - if(!self.movie.data.releases || self.movie.data.releases.length == 0) + if(!self.movie.data.releases || self.movie.data.releases.length === 0) self.el.hide(); else self.showHelper(); @@ -162,14 +162,14 @@ MA.Release = new Class({ var quality = Quality.getQuality(release.quality) || {}, info = release.info || {}, - provider = self.get(release, 'provider') + (info['provider_extra'] ? self.get(release, 'provider_extra') : ''); + provider = self.get(release, 'provider') + (info.provider_extra ? self.get(release, 'provider_extra') : ''); var release_name = self.get(release, 'name'); if(release.files && release.files.length > 0){ try { var movie_file = release.files.filter(function(file){ var type = File.Type.get(file.type_id); - return type && type.identifier == 'movie' + return type && type.identifier == 'movie'; }).pick(); release_name = movie_file.path.split(Api.getOption('path_sep')).getLast(); } @@ -177,19 +177,19 @@ MA.Release = new Class({ } // Create release - release['el'] = new Element('div', { + release.el = new Element('div', { 'class': 'item '+release.status, 'id': 'release_'+release._id }).adopt( new Element('span.name', {'text': release_name, 'title': release_name}), new Element('span.status', {'text': release.status, 'class': 'release_status '+release.status}), new Element('span.quality', {'text': quality.label + (release.is_3d ? ' 3D' : '') || 'n/a'}), - new Element('span.size', {'text': info['size'] ? Math.floor(self.get(release, 'size')) : 'n/a'}), + new Element('span.size', {'text': info.size ? Math.floor(self.get(release, 'size')) : 'n/a'}), new Element('span.age', {'text': self.get(release, 'age')}), new Element('span.score', {'text': self.get(release, 'score')}), new Element('span.provider', { 'text': provider, 'title': provider }), - info['detail_url'] ? new Element('a.info.icon2', { - 'href': info['detail_url'], + info.detail_url ? new Element('a.info.icon2', { + 'href': info.detail_url, 'target': '_blank' }) : new Element('a'), new Element('a.download.icon2', { @@ -283,7 +283,7 @@ MA.Release = new Class({ new Element('span.or', { 'text': 'or pick one below' })] : null - ) + ); } self.last_release = null; @@ -342,13 +342,13 @@ MA.Release = new Class({ 'click': self.markMovieDone.bind(self) } }) - ) + ); } }, get: function(release, type){ - return (release.info && release.info[type] !== undefined) ? release.info[type] : 'n/a' + return (release.info && release.info[type] !== undefined) ? release.info[type] : 'n/a'; }, download: function(release){ @@ -386,7 +386,7 @@ MA.Release = new Class({ 'data': { 'id': release._id } - }) + }); }, @@ -403,7 +403,7 @@ MA.Release = new Class({ movie.set('tween', { 'duration': 300, 'onComplete': function(){ - self.movie.destroy() + self.movie.destroy(); } }); movie.tween('height', 0); @@ -508,7 +508,7 @@ MA.Trailer = new Class({ self.player.addEventListener('onStateChange', change_quality); } - }).send() + }).send(); }, @@ -523,7 +523,7 @@ MA.Trailer = new Class({ setTimeout(function(){ self.container.destroy(); self.close_button.destroy(); - }, 1800) + }, 1800); } @@ -585,7 +585,7 @@ MA.Edit = new Class({ // Fill categories var categories = CategoryList.getAll(); - if(categories.length == 0) + if(categories.length === 0) self.category_select.hide(); else { self.category_select.show(); @@ -686,11 +686,12 @@ MA.Readd = new Class({ Extends: MovieAction, create: function(){ - var self = this; + var self = this, + movie_done = self.movie.data.status == 'done', + snatched; - var movie_done = self.movie.data.status == 'done'; if(self.movie.data.releases && !movie_done) - var snatched = self.movie.data.releases.filter(function(release){ + snatched = self.movie.data.releases.filter(function(release){ return release.status && (release.status == 'snatched' || release.status == 'seeding' || release.status == 'downloaded' || release.status == 'done'); }).length; @@ -792,7 +793,7 @@ MA.Delete = new Class({ movie.set('tween', { 'duration': 300, 'onComplete': function(){ - self.movie.destroy() + self.movie.destroy(); } }); movie.tween('height', 0); @@ -847,7 +848,7 @@ MA.Files = new Class({ new Element('div.file.item').adopt( new Element('span.name', {'text': file}), new Element('span.type', {'text': type}) - ).inject(rel) + ).inject(rel); }); }); }); diff --git a/couchpotato/core/media/movie/_base/static/movie.js b/couchpotato/core/media/movie/_base/static/movie.js index e2977a14..4a786e95 100644 --- a/couchpotato/core/media/movie/_base/static/movie.js +++ b/couchpotato/core/media/movie/_base/static/movie.js @@ -47,7 +47,7 @@ var Movie = new Class({ // Remove spinner self.global_events['movie.searcher.ended'] = function(notification){ if(notification.data && self.data._id == notification.data._id) - self.busy(false) + self.busy(false); }; App.on('movie.searcher.ended', self.global_events['movie.searcher.ended']); @@ -62,7 +62,7 @@ var Movie = new Class({ var updated = false; self.data.releases.each(function(release){ if(release._id == data._id){ - release['status'] = data.status; + release.status = data.status; updated = true; } }); @@ -107,7 +107,7 @@ var Movie = new Class({ self.mask = null; }, timeout || 400); } - }, timeout || 1000) + }, timeout || 1000); } else if(!self.spinner) { self.createMask(); @@ -150,7 +150,7 @@ var Movie = new Class({ if(self.data.info.release_date) [self.data.info.release_date.dvd, self.data.info.release_date.theater].each(function(timestamp){ - if (timestamp > 0 && (eta == null || Math.abs(timestamp - now) < Math.abs(eta - now))) + if (timestamp > 0 && (eta === null || Math.abs(timestamp - now) < Math.abs(eta - now))) eta = timestamp; }); @@ -163,7 +163,7 @@ var Movie = new Class({ self.select_checkbox = new Element('input[type=checkbox].inlay', { 'events': { 'change': function(){ - self.fireEvent('select') + self.fireEvent('select'); } } }), @@ -193,7 +193,7 @@ var Movie = new Class({ 'click': function(e){ var releases = self.el.getElement('.actions .releases'); if(releases.isVisible()) - releases.fireEvent('click', [e]) + releases.fireEvent('click', [e]); } } }) @@ -213,9 +213,9 @@ var Movie = new Class({ self.profile.getTypes().each(function(type){ var q = self.addQuality(type.get('quality'), type.get('3d')); - if((type.finish == true || type.get('finish')) && !q.hasClass('finish')){ + if((type.finish === true || type.get('finish')) && !q.hasClass('finish')){ q.addClass('finish'); - q.set('title', q.get('title') + ' Will finish searching for this movie if this quality is found.') + q.set('title', q.get('title') + ' Will finish searching for this movie if this quality is found.'); } }); @@ -226,14 +226,14 @@ var Movie = new Class({ Object.each(self.options.actions, function(action, key){ self.action[key.toLowerCase()] = action = new self.options.actions[key](self); if(action.el) - self.actions.adopt(action) + self.actions.adopt(action); }); }, updateReleases: function(){ var self = this; - if(!self.data.releases || self.data.releases.length == 0) return; + if(!self.data.releases || self.data.releases.length === 0) return; self.data.releases.each(function(release){ @@ -245,7 +245,7 @@ var Movie = new Class({ if (q && !q.hasClass(status)){ q.addClass(status); - q.set('title', (q.get('title') ? q.get('title') : '') + ' status: '+ status) + q.set('title', (q.get('title') ? q.get('title') : '') + ' status: '+ status); } }); @@ -271,7 +271,7 @@ var Movie = new Class({ else if(self.data.info.titles.length > 0) return self.getUnprefixedTitle(self.data.info.titles[0]); - return 'Unknown movie' + return 'Unknown movie'; }, getUnprefixedTitle: function(t){ @@ -293,7 +293,7 @@ var Movie = new Class({ self.el.addEvent('outerClick', function(){ self.removeView(); - self.slide('out') + self.slide('out'); }); el.show(); self.data_container.addClass('hide_right'); @@ -324,7 +324,7 @@ var Movie = new Class({ removeView: function(){ var self = this; - self.el.removeClass(self.view+'_view') + self.el.removeClass(self.view+'_view'); }, getIdentifier: function(){ @@ -339,12 +339,12 @@ var Movie = new Class({ }, get: function(attr){ - return this.data[attr] || this.data.info[attr] + return this.data[attr] || this.data.info[attr]; }, select: function(bool){ var self = this; - self.select_checkbox_class[bool ? 'check' : 'uncheck']() + self.select_checkbox_class[bool ? 'check' : 'uncheck'](); }, isSelected: function(){ diff --git a/couchpotato/core/media/movie/_base/static/search.js b/couchpotato/core/media/movie/_base/static/search.js index 0fa17417..cc2b0d7f 100644 --- a/couchpotato/core/media/movie/_base/static/search.js +++ b/couchpotato/core/media/movie/_base/static/search.js @@ -48,7 +48,7 @@ var BlockSearchMovieItem = new Class({ self.alternativeTitle({ 'title': title }); - }) + }); }, alternativeTitle: function(alternative){ @@ -68,7 +68,7 @@ var BlockSearchMovieItem = new Class({ }, get: function(key){ - return this.info[key] + return this.info[key]; }, showOptions: function(){ @@ -77,7 +77,7 @@ var BlockSearchMovieItem = new Class({ self.createOptions(); self.data_container.addClass('open'); - self.el.addEvent('outerClick', self.closeOptions.bind(self)) + self.el.addEvent('outerClick', self.closeOptions.bind(self)); }, @@ -85,7 +85,7 @@ var BlockSearchMovieItem = new Class({ var self = this; self.data_container.removeClass('open'); - self.el.removeEvents('outerClick') + self.el.removeEvents('outerClick'); }, add: function(e){ @@ -132,10 +132,11 @@ var BlockSearchMovieItem = new Class({ if(!self.options_el.hasClass('set')){ + var in_library; if(info.in_library){ - var in_library = []; + in_library = []; (info.in_library.releases || []).each(function(release){ - in_library.include(release.quality) + in_library.include(release.quality); }); } @@ -171,14 +172,14 @@ var BlockSearchMovieItem = new Class({ Array.each(self.alternative_titles, function(alt){ new Element('option', { 'text': alt.title - }).inject(self.title_select) + }).inject(self.title_select); }); // Fill categories var categories = CategoryList.getAll(); - if(categories.length == 0) + if(categories.length === 0) self.category_select.hide(); else { self.category_select.show(); @@ -199,12 +200,12 @@ var BlockSearchMovieItem = new Class({ new Element('option', { 'value': profile.get('_id'), 'text': profile.get('label') - }).inject(self.profile_select) + }).inject(self.profile_select); }); self.options_el.addClass('set'); - if(categories.length == 0 && self.title_select.getElements('option').length == 1 && profiles.length == 1 && + if(categories.length === 0 && self.title_select.getElements('option').length == 1 && profiles.length == 1 && !(self.info.in_wanted && self.info.in_wanted.profile_id || in_library)) self.add(); @@ -218,12 +219,12 @@ var BlockSearchMovieItem = new Class({ self.mask = new Element('div.mask').inject(self.el).fade('hide'); createSpinner(self.mask); - self.mask.fade('in') + self.mask.fade('in'); }, toElement: function(){ - return this.el + return this.el; } }); diff --git a/couchpotato/core/media/movie/_base/static/wanted.js b/couchpotato/core/media/movie/_base/static/wanted.js index d7613516..b3da4dee 100644 --- a/couchpotato/core/media/movie/_base/static/wanted.js +++ b/couchpotato/core/media/movie/_base/static/wanted.js @@ -91,7 +91,7 @@ var MoviesWanted = new Class({ }; if(!self.folder_browser){ - self.folder_browser = new Option['Directory']("Scan", "folder", "", options); + self.folder_browser = new Option.Directory("Scan", "folder", "", options); self.folder_browser.save = function() { var folder = self.folder_browser.getValue(); diff --git a/couchpotato/core/media/movie/charts/static/charts.js b/couchpotato/core/media/movie/charts/static/charts.js index 146db1aa..62c8c1ec 100644 --- a/couchpotato/core/media/movie/charts/static/charts.js +++ b/couchpotato/core/media/movie/charts/static/charts.js @@ -58,7 +58,7 @@ var Charts = new Class({ self.el_refreshing_text.hide(); self.el_refresh_link.show(); - if(!json || json.count == 0){ + if(!json || json.count === 0){ self.el_no_charts_enabled.show(); self.el_refresh_link.show(); self.el_refreshing_text.hide(); @@ -85,15 +85,14 @@ var Charts = new Class({ var m = new BlockSearchMovieItem(movie, { 'onAdded': function(){ - self.afterAdded(m, movie) + self.afterAdded(m, movie); } }); var in_database_class = (chart.hide_wanted && movie.in_wanted) ? 'hidden' : (movie.in_wanted ? 'chart_in_wanted' : ((chart.hide_library && movie.in_library) ? 'hidden': (movie.in_library ? 'chart_in_library' : ''))), in_database_title = movie.in_wanted ? 'Movie in wanted list' : (movie.in_library ? 'Movie in library' : ''); - m.el - .addClass(in_database_class) + m.el.addClass(in_database_class) .grab( new Element('div.chart_number', { 'text': it++, @@ -135,7 +134,7 @@ var Charts = new Class({ 'text': plot, 'events': { 'click': function(){ - this.toggleClass('full') + this.toggleClass('full'); } } }) : null diff --git a/couchpotato/core/media/movie/suggestion/static/suggest.js b/couchpotato/core/media/movie/suggestion/static/suggest.js index e8dd9354..625c7a74 100644 --- a/couchpotato/core/media/movie/suggestion/static/suggest.js +++ b/couchpotato/core/media/movie/suggestion/static/suggest.js @@ -60,7 +60,7 @@ var SuggestList = new Class({ var self = this; - if(!json || json.count == 0){ + if(!json || json.count === 0){ self.el.hide(); } else { @@ -69,7 +69,7 @@ var SuggestList = new Class({ var m = new BlockSearchMovieItem(movie, { 'onAdded': function(){ - self.afterAdded(m, movie) + self.afterAdded(m, movie); } }); m.data_container.grab( @@ -114,7 +114,7 @@ var SuggestList = new Class({ 'text': plot, 'events': { 'click': function(){ - this.toggleClass('full') + this.toggleClass('full'); } } }) : null diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index 59098895..96e96d58 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -32,7 +32,7 @@ var NotificationBase = new Class({ window.addEvent('load', function(){ self.startInterval.delay($(window).getSize().x <= 480 ? 2000 : 100, self); - }) + }); }, @@ -46,16 +46,15 @@ var NotificationBase = new Class({ new Element('span.'+(result.read ? 'read' : '' )).adopt( new Element('span.message', {'html': result.message}), new Element('span.added', {'text': added.timeDiffInWords(), 'title': added}) - ) - , 'top'); + ), 'top'); self.notifications.include(result); if((result.important !== undefined || result.sticky !== undefined) && !result.read){ var sticky = true; - App.trigger('message', [result.message, sticky, result]) + App.trigger('message', [result.message, sticky, result]); } else if(!result.read){ - self.setBadge(self.notifications.filter(function(n){ return !n.read}).length) + self.setBadge(self.notifications.filter(function(n){ return !n.read; }).length); } }, @@ -63,7 +62,7 @@ var NotificationBase = new Class({ setBadge: function(value){ var self = this; self.badge.set('text', value); - self.badge[value ? 'show' : 'hide']() + self.badge[value ? 'show' : 'hide'](); }, markAsRead: function(force_ids){ @@ -72,13 +71,13 @@ var NotificationBase = new Class({ if(!force_ids) { var rn = self.notifications.filter(function(n){ - return !n.read && n.important === undefined + return !n.read && n.important === undefined; }); - var ids = []; + ids = []; rn.each(function(n){ - ids.include(n._id) - }) + ids.include(n._id); + }); } if(ids.length > 0) @@ -87,9 +86,9 @@ var NotificationBase = new Class({ 'ids': ids.join(',') }, 'onSuccess': function(){ - self.setBadge('') + self.setBadge(''); } - }) + }); }, @@ -104,7 +103,7 @@ var NotificationBase = new Class({ self.request = Api.request('notification.listener', { 'data': {'init':true}, 'onSuccess': function(json){ - self.processData(json, true) + self.processData(json, true); } }).send(); @@ -112,7 +111,7 @@ var NotificationBase = new Class({ if(self.request && self.request.isRunning()){ self.request.cancel(); - self.startPoll() + self.startPoll(); } }, 120000); @@ -130,15 +129,15 @@ var NotificationBase = new Class({ self.request = Api.request('nonblock/notification.listener', { 'onSuccess': function(json){ - self.processData(json, false) + self.processData(json, false); }, 'data': { 'last_id': self.last_id }, 'onFailure': function(){ - self.startPoll.delay(2000, self) + self.startPoll.delay(2000, self); } - }).send() + }).send(); }, @@ -160,7 +159,7 @@ var NotificationBase = new Class({ }); if(json.result.length > 0) - self.last_id = json.result.getLast().message_id + self.last_id = json.result.getLast().message_id; } // Restart poll @@ -179,7 +178,7 @@ var NotificationBase = new Class({ }).inject(self.message_container, 'top'); setTimeout(function(){ - new_message.addClass('show') + new_message.addClass('show'); }, 10); var hide_message = function(){ @@ -211,8 +210,8 @@ var NotificationBase = new Class({ var setting_page = App.getPage('Settings'); setting_page.addEvent('create', function(){ - Object.each(setting_page.tabs.notifications.groups, self.addTestButton.bind(self)) - }) + Object.each(setting_page.tabs.notifications.groups, self.addTestButton.bind(self)); + }); }, @@ -235,20 +234,21 @@ var NotificationBase = new Class({ button.set('text', button_name); + var message; if(json.success){ - var message = new Element('span.success', { + message = new Element('span.success', { 'text': 'Notification successful' - }).inject(button, 'after') + }).inject(button, 'after'); } else { - var message = new Element('span.failed', { + message = new Element('span.failed', { 'text': 'Notification failed. Check logs for details.' - }).inject(button, 'after') + }).inject(button, 'after'); } (function(){ message.destroy(); - }).delay(3000) + }).delay(3000); } }); } diff --git a/couchpotato/core/notifications/twitter/static/twitter.js b/couchpotato/core/notifications/twitter/static/twitter.js index 75c96a8e..97465b64 100644 --- a/couchpotato/core/notifications/twitter/static/twitter.js +++ b/couchpotato/core/notifications/twitter/static/twitter.js @@ -16,7 +16,7 @@ var TwitterNotification = new Class({ var twitter_set = 0; fieldset.getElements('input[type=text]').each(function(el){ - twitter_set += +(el.get('value') != ''); + twitter_set += +(el.get('value') !== ''); }); @@ -57,7 +57,7 @@ var TwitterNotification = new Class({ } }) ).inject(fieldset.getElement('.test_button'), 'before'); - }) + }); } diff --git a/couchpotato/core/plugins/category/static/category.js b/couchpotato/core/plugins/category/static/category.js index 6d160be1..bab28050 100644 --- a/couchpotato/core/plugins/category/static/category.js +++ b/couchpotato/core/plugins/category/static/category.js @@ -52,7 +52,7 @@ var CategoryListBase = new Class({ }); - }) + }); }, @@ -71,7 +71,7 @@ var CategoryListBase = new Class({ 'events': { 'click': function(){ var category = self.createCategory(); - $(category).inject(self.category_container) + $(category).inject(self.category_container); } } }) @@ -79,15 +79,15 @@ var CategoryListBase = new Class({ // Add categories, that aren't part of the core (for editing) Array.each(self.categories, function(category){ - $(category).inject(self.category_container) + $(category).inject(self.category_container); }); }, getCategory: function(id){ return this.categories.filter(function(category){ - return category.data._id == id - }).pick() + return category.data._id == id; + }).pick(); }, getAll: function(){ @@ -97,7 +97,7 @@ var CategoryListBase = new Class({ createCategory: function(data){ var self = this; - var data = data || {'id': randomString()}; + data = data || {'id': randomString()}; var category = new Category(data); self.categories.include(category); @@ -225,7 +225,7 @@ var Category = new Class({ ) ); - self.makeSortable() + self.makeSortable(); }, @@ -248,7 +248,7 @@ var Category = new Class({ } }); - }).delay(delay || 0, self) + }).delay(delay || 0, self); }, @@ -262,13 +262,13 @@ var Category = new Class({ 'preferred' : self.el.getElement('.category_preferred input').get('value'), 'ignored' : self.el.getElement('.category_ignored input').get('value'), 'destination': self.data.destination - } + }; }, del: function(){ var self = this; - if(self.data.label == undefined){ + if(self.data.label === undefined){ self.el.destroy(); return; } @@ -318,11 +318,11 @@ var Category = new Class({ }, get: function(attr){ - return this.data[attr] + return this.data[attr]; }, toElement: function(){ - return this.el + return this.el; } }); diff --git a/couchpotato/core/plugins/log/static/log.js b/couchpotato/core/plugins/log/static/log.js index 71a65d0d..85b8dc2b 100644 --- a/couchpotato/core/plugins/log/static/log.js +++ b/couchpotato/core/plugins/log/static/log.js @@ -8,20 +8,19 @@ Page.Log = new Class({ has_tab: false, log_items: [], - report_text: '\ -### Steps to reproduce:\n\ -1. ..\n\ -2. ..\n\ -\n\ -### Information:\n\ -Movie(s) I have this with: ...\n\ -Quality of the movie being searched: ...\n\ -Providers I use: ...\n\ -Version of CouchPotato: {version}\n\ -Running on: ...\n\ -\n\ -### Logs:\n\ -```\n{issue}```', + report_text: '### Steps to reproduce:\n'+ + '1. ..\n'+ + '2. ..\n'+ + '\n'+ + '### Information:\n'+ + 'Movie(s) I have this with: ...\n'+ + 'Quality of the movie being searched: ...\n'+ + 'Providers I use: ...\n'+ + 'Version of CouchPotato: {version}\n'+ + 'Running on: ...\n'+ + '\n'+ + '### Logs:\n'+ + '```\n{issue}```', indexAction: function () { var self = this; @@ -133,7 +132,7 @@ Running on: ...\n\ new Element('span.message', { 'text': log.message }) - )) + )); }); return elements; diff --git a/couchpotato/core/plugins/profile/static/profile.js b/couchpotato/core/plugins/profile/static/profile.js index 35ad81b9..e6086215 100644 --- a/couchpotato/core/plugins/profile/static/profile.js +++ b/couchpotato/core/plugins/profile/static/profile.js @@ -81,7 +81,7 @@ var Profile = new Class({ 'quality': quality, 'finish': data.finish[nr] || false, '3d': data['3d'] ? data['3d'][nr] || false : false - }) + }); }); } @@ -123,7 +123,7 @@ var Profile = new Class({ } }); - }).delay(delay, self) + }).delay(delay, self); }, @@ -148,7 +148,7 @@ var Profile = new Class({ }); }); - return data + return data; }, addType: function(data){ @@ -177,7 +177,7 @@ var Profile = new Class({ var self = this; return self.types.filter(function(type){ - return type.get('quality') + return type.get('quality'); }); }, @@ -231,15 +231,15 @@ var Profile = new Class({ }, get: function(attr){ - return this.data[attr] + return this.data[attr]; }, isCore: function(){ - return this.data.core + return this.data.core; }, toElement: function(){ - return this.el + return this.el; } }); @@ -342,7 +342,7 @@ Profile.Type = new Class({ 'text': q.label, 'value': q.identifier, 'data-allow_3d': q.allow_3d - }).inject(self.qualities) + }).inject(self.qualities); }); self.qualities.set('value', self.data.quality); @@ -358,7 +358,7 @@ Profile.Type = new Class({ 'quality': self.qualities.get('value'), 'finish': +self.finish.checked, '3d': +self['3d'].checked - } + }; }, get: function(key){ diff --git a/couchpotato/core/plugins/quality/static/quality.js b/couchpotato/core/plugins/quality/static/quality.js index d233b1ce..2d98d22b 100644 --- a/couchpotato/core/plugins/quality/static/quality.js +++ b/couchpotato/core/plugins/quality/static/quality.js @@ -12,20 +12,20 @@ var QualityBase = new Class({ self.profiles = []; Array.each(data.profiles, self.createProfilesClass.bind(self)); - App.addEvent('loadSettings', self.addSettings.bind(self)) + App.addEvent('loadSettings', self.addSettings.bind(self)); }, getProfile: function(id){ return this.profiles.filter(function(profile){ - return profile.data._id == id - }).pick() + return profile.data._id == id; + }).pick(); }, // Hide items when getting profiles getActiveProfiles: function(){ return Array.filter(this.profiles, function(profile){ - return !profile.data.hide + return !profile.data.hide; }); }, @@ -37,7 +37,7 @@ var QualityBase = new Class({ } catch(e){} - return {} + return {}; }, addSettings: function(){ @@ -58,7 +58,7 @@ var QualityBase = new Class({ self.createProfileOrdering(); self.createSizes(); - }) + }); }, @@ -68,7 +68,7 @@ var QualityBase = new Class({ createProfiles: function(){ var self = this; - var non_core_profiles = Array.filter(self.profiles, function(profile){ return !profile.isCore() }); + var non_core_profiles = Array.filter(self.profiles, function(profile){ return !profile.isCore(); }); var count = non_core_profiles.length; self.settings.createGroup({ @@ -81,7 +81,7 @@ var QualityBase = new Class({ 'events': { 'click': function(){ var profile = self.createProfilesClass(); - $(profile).inject(self.profile_container) + $(profile).inject(self.profile_container); } } }) @@ -89,7 +89,7 @@ var QualityBase = new Class({ // Add profiles, that aren't part of the core (for editing) Array.each(non_core_profiles, function(profile){ - $(profile).inject(self.profile_container) + $(profile).inject(self.profile_container); }); }, @@ -97,7 +97,7 @@ var QualityBase = new Class({ createProfilesClass: function(data){ var self = this; - var data = data || {'id': randomString()}; + data = data || {'id': randomString()}; var profile = new Profile(data); self.profiles.include(profile); @@ -190,7 +190,6 @@ var QualityBase = new Class({ 'name': 'sizes' }).inject(self.content); - new Element('div.item.head.ctrlHolder').adopt( new Element('span.label', {'text': 'Quality'}), new Element('span.min', {'text': 'Min'}), @@ -204,7 +203,7 @@ var QualityBase = new Class({ 'value': quality.size_min, 'events': { 'keyup': function(e){ - self.changeSize(quality.identifier, 'size_min', e.target.get('value')) + self.changeSize(quality.identifier, 'size_min', e.target.get('value')); } } }), @@ -212,11 +211,11 @@ var QualityBase = new Class({ 'value': quality.size_max, 'events': { 'keyup': function(e){ - self.changeSize(quality.identifier, 'size_max', e.target.get('value')) + self.changeSize(quality.identifier, 'size_max', e.target.get('value')); } } }) - ).inject(group) + ).inject(group); }); }, @@ -235,7 +234,7 @@ var QualityBase = new Class({ 'value': value } }); - }).delay(300) + }).delay(300); } diff --git a/couchpotato/core/plugins/userscript/static/userscript.js b/couchpotato/core/plugins/userscript/static/userscript.js index c52dbee2..31ecb594 100644 --- a/couchpotato/core/plugins/userscript/static/userscript.js +++ b/couchpotato/core/plugins/userscript/static/userscript.js @@ -54,7 +54,7 @@ var UserscriptSettingTab = new Class({ initialize: function(){ var self = this; - App.addEvent('loadSettings', self.addSettings.bind(self)) + App.addEvent('loadSettings', self.addSettings.bind(self)); }, @@ -88,7 +88,7 @@ var UserscriptSettingTab = new Class({ 'events': { 'click': function(e){ (e).stop(); - alert('Drag it to your bookmark ;)') + alert('Drag it to your bookmark ;)'); } } }), diff --git a/couchpotato/core/plugins/wizard/static/wizard.js b/couchpotato/core/plugins/wizard/static/wizard.js index f215dbf4..2f2ff4f5 100644 --- a/couchpotato/core/plugins/wizard/static/wizard.js +++ b/couchpotato/core/plugins/wizard/static/wizard.js @@ -41,7 +41,7 @@ Page.Wizard = new Class({ 'content': function(){ return App.createUserscriptButtons().setStyles({ 'background-image': "url('https://couchpota.to/media/images/userscript.gif')" - }) + }); } }, 'finish': { @@ -103,7 +103,7 @@ Page.Wizard = new Class({ (function(){ var sc = self.el.getElement('.wgroup_'+action); self.scroll.start(0, sc.getCoordinates().top-80); - }).delay(1) + }).delay(1); }, orderGroups: function(){ @@ -114,8 +114,9 @@ Page.Wizard = new Class({ self.groups.each(function(group){ + var group_container; if(self.headers[group]){ - var group_container = new Element('.wgroup_'+group, { + group_container = new Element('.wgroup_'+group, { 'styles': { 'opacity': 0.2 }, @@ -127,7 +128,7 @@ Page.Wizard = new Class({ if(self.headers[group].include){ self.headers[group].include.each(function(inc){ group_container.addClass('wgroup_'+inc); - }) + }); } var content = self.headers[group].content; @@ -148,7 +149,7 @@ Page.Wizard = new Class({ tab_navigation = []; self.headers[group].include.each(function(inc){ tab_navigation.include(tabs.getElement('.t_'+inc)); - }) + }); } if(tab_navigation && group_container){ @@ -165,7 +166,7 @@ Page.Wizard = new Class({ 'href': App.createUrl('wizard/'+group), 'text': (self.headers[group].label || group).capitalize() }) - ).inject(tabs) + ).inject(tabs); } else @@ -190,7 +191,7 @@ Page.Wizard = new Class({ } if(self.headers[group] && self.headers[group].event) - self.headers[group].event.call() + self.headers[group].event.call(); }); // Remove toggle @@ -220,22 +221,22 @@ Page.Wizard = new Class({ g.tween('opacity', 1); }; - if(nr == 0) + if(nr === 0) func(); new ScrollSpy( { min: function(){ var c = g.getCoordinates(); var top = c.top-(window.getSize().y/2); - return top > minimum ? minimum : top + return top > minimum ? minimum : top; }, max: function(){ var c = g.getCoordinates(); - return c.top+(c.height/2) + return c.top+(c.height/2); }, onEnter: func, onLeave: function(){ - g.tween('opacity', 0.2) + g.tween('opacity', 0.2); } }); }); diff --git a/couchpotato/static/scripts/api.js b/couchpotato/static/scripts/api.js index 28c0c512..df3d0ff3 100644 --- a/couchpotato/static/scripts/api.js +++ b/couchpotato/static/scripts/api.js @@ -14,15 +14,15 @@ var ApiClass = new Class({ 'callbackKey': 'callback_func', 'method': 'get', 'url': self.createUrl(type, {'t': randomString()}) - }, options)).send() + }, options)).send(); }, createUrl: function(action, params){ - return this.options.url + (action || 'default') + '/' + (params ? '?'+Object.toQueryString(params) : '') + return this.options.url + (action || 'default') + '/' + (params ? '?'+Object.toQueryString(params) : ''); }, getOption: function(name){ - return this.options[name] + return this.options[name]; } }); diff --git a/couchpotato/static/scripts/block.js b/couchpotato/static/scripts/block.js index 487c384a..dce38459 100644 --- a/couchpotato/static/scripts/block.js +++ b/couchpotato/static/scripts/block.js @@ -19,7 +19,7 @@ var BlockBase = new Class({ }, getParent: function(){ - return this.page + return this.page; }, hide: function(){ @@ -31,7 +31,7 @@ var BlockBase = new Class({ }, toElement: function(){ - return this.el + return this.el; } }); diff --git a/couchpotato/static/scripts/block/menu.js b/couchpotato/static/scripts/block/menu.js index b36c4e85..6c5ced75 100644 --- a/couchpotato/static/scripts/block/menu.js +++ b/couchpotato/static/scripts/block/menu.js @@ -25,16 +25,15 @@ var BlockMenu = new Class({ self.el.addEvent('outerClick', self.removeOuterClick.bind(self)); this.addEvent('outerClick', function(e){ if(e.target.get('tag') != 'input') - self.removeOuterClick() - }) + self.removeOuterClick(); + }); } else - self.removeOuterClick() - + self.removeOuterClick(); } } }) - ) + ); }, diff --git a/couchpotato/static/scripts/block/navigation.js b/couchpotato/static/scripts/block/navigation.js index d1b332ac..43d48e4e 100644 --- a/couchpotato/static/scripts/block/navigation.js +++ b/couchpotato/static/scripts/block/navigation.js @@ -20,7 +20,7 @@ var BlockNavigation = new Class({ 'text': 'back to top', 'events': { 'click': function(){ - window.scroll(0,0) + window.scroll(0,0); } }, 'tween': { @@ -32,10 +32,10 @@ var BlockNavigation = new Class({ new ScrollSpy({ min: 400, onLeave: function(){ - self.backtotop.fade('out') + self.backtotop.fade('out'); }, onEnter: function(){ - self.backtotop.fade('in') + self.backtotop.fade('in'); } }); @@ -44,7 +44,7 @@ var BlockNavigation = new Class({ if($(document.body).getParent().hasClass('menu_shown')) self.toggleMenu(); } - }) + }); }, @@ -53,7 +53,7 @@ var BlockNavigation = new Class({ return new Element('li.tab_'+(name || 'unknown')).grab( new Element('a', tab) - ).inject(self.nav) + ).inject(self.nav); }, diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index a176e8e7..98915489 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -49,7 +49,7 @@ return this.options[name]; } catch(e){ - return null + return null; } }, @@ -69,7 +69,7 @@ }, isMac: function(){ - return Browser.platform == 'mac' + return Browser.platform == 'mac'; }, createLayout: function(){ @@ -125,19 +125,19 @@ ]; setting_links.each(function(a){ - self.block.more.addLink(a) + self.block.more.addLink(a); }); new ScrollSpy({ min: 10, onLeave: function(){ - $(self.block.header).removeClass('with_shadow') + $(self.block.header).removeClass('with_shadow'); }, onEnter: function(){ - $(self.block.header).addClass('with_shadow') + $(self.block.header).addClass('with_shadow'); } - }) + }); }, createPages: function(){ @@ -161,14 +161,12 @@ $(page['class']).inject(self.pages); }); - delete pages; - self.fireEvent('load'); }, sortPageByOrder: function(a, b){ - return (a.order || 100) - (b.order || 100) + return (a.order || 100) - (b.order || 100); }, openPage: function(url) { @@ -178,7 +176,8 @@ var page_name = self.route.getPage().capitalize(), action = self.route.getAction(), params = self.route.getParams(), - current_url = self.route.getCurrentUrl(); + current_url = self.route.getCurrentUrl(), + page; if(current_url == self.current_url) return; @@ -187,12 +186,12 @@ self.current_page.hide(); try { - var page = self.pages[page_name] || self.pages.Home; + page = self.pages[page_name] || self.pages.Home; page.open(action, params, current_url); page.show(); } catch(e){ - console.error("Can't open page:" + url, e) + console.error("Can't open page:" + url, e); } self.current_page = page; @@ -201,11 +200,11 @@ }, getBlock: function(block_name){ - return this.block[block_name] + return this.block[block_name]; }, getPage: function(name){ - return this.pages[name] + return this.pages[name]; }, shutdown: function(){ @@ -281,7 +280,7 @@ var onFailure = function(){ self.checkAvailable.delay(1000, self, [delay, onAvailable]); self.fireEvent('unload'); - } + }; var request = Api.request('app.available', { 'timeout': 2000, @@ -298,7 +297,7 @@ } }); - }).delay(delay || 0) + }).delay(delay || 0); }, blockPage: function(message, title){ @@ -322,12 +321,12 @@ var self = this; if(self.mask) self.mask.get('tween').start('opacity', 0).chain(function(){ - this.element.destroy() + this.element.destroy(); }); }, createUrl: function(action, params){ - return this.options.base_url + (action ? action+'/' : '') + (params ? '?'+Object.toQueryString(params) : '') + return this.options.base_url + (action ? action+'/' : '') + (params ? '?'+Object.toQueryString(params) : ''); }, openDerefered: function(e, el){ @@ -364,7 +363,7 @@ 'events': { 'click': function(e){ (e).stop(); - alert('Drag it to your bookmark ;)') + alert('Drag it to your bookmark ;)'); } } }), @@ -447,19 +446,19 @@ var Route = new Class({ initialize: function(defaults){ var self = this; - self.defaults = defaults + self.defaults = defaults; }, parse: function(){ var self = this; var rep = function (pa) { - return pa.replace(Api.getOption('url'), '/').replace(App.getOption('base_url'), '/') + return pa.replace(Api.getOption('url'), '/').replace(App.getOption('base_url'), '/'); }; var path = rep(History.getPath()); if(path == '/' && location.hash){ - path = rep(location.hash.replace('#', '/')) + path = rep(location.hash.replace('#', '/')); } self.current = path.replace(/^\/+|\/+$/g, ''); var url = self.current.split('/'); @@ -471,46 +470,46 @@ var Route = new Class({ if(url.length > 1){ var key; url.each(function(el, nr){ - if(nr%2 == 0) + if(nr%2 === 0) key = el; else if(key) { self.params[key] = el; - key = null + key = null; } - }) + }); } else if(url.length == 1){ self.params[url] = true; } - return self + return self; }, getPage: function(){ - return this.page + return this.page; }, getAction: function(){ - return this.action + return this.action; }, getParams: function(){ - return this.params + return this.params; }, getCurrentUrl: function(){ - return this.current + return this.current; }, get: function(param){ - return this.params[param] + return this.params[param]; } }); var p = function(){ - if(typeof(console) !== 'undefined' && console != null) - console.log(arguments) + if(typeof(console) !== 'undefined' && console !== null) + console.log(arguments); }; @@ -553,14 +552,14 @@ var p = function(){ function randomString(length, extra) { - var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz" + (extra ? '-._!@#$%^&*()+=' : ''); - var stringLength = length || 8; - var randomString = ''; - for (var i = 0; i < stringLength; i++) { + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz" + (extra ? '-._!@#$%^&*()+=' : ''), + string_length = length || 8, + random_string = ''; + for (var i = 0; i < string_length; i++) { var rnum = Math.floor(Math.random() * chars.length); - randomString += chars.charAt(rnum); + random_string += chars.charAt(rnum); } - return randomString; + return random_string; } (function(){ @@ -576,7 +575,7 @@ function randomString(length, extra) { var valueOf = function(object, path) { var ptr = object; - path.each(function(key) { ptr = ptr[key] }); + path.each(function(key) { ptr = ptr[key]; }); return ptr; }; diff --git a/couchpotato/static/scripts/library/question.js b/couchpotato/static/scripts/library/question.js index 64feadbf..7f8bc90a 100644 --- a/couchpotato/static/scripts/library/question.js +++ b/couchpotato/static/scripts/library/question.js @@ -10,7 +10,7 @@ var Question = new Class( { self.createQuestion(); self.answers.each(function(answer) { self.createAnswer(answer); - }) + }); }, @@ -24,7 +24,7 @@ var Question = new Class( { new Element('div.hint', { 'html': this.hint }) - ).fade('hide').inject(document.body).fade('in') + ).fade('hide').inject(document.body).fade('in'); }, @@ -32,7 +32,7 @@ var Question = new Class( { var self = this; var answer = new Element('a', Object.merge(options, { - 'class' : 'answer button '+(options['class'] || '')+(options['cancel'] ? ' cancel' : '') + 'class' : 'answer button '+(options['class'] || '')+(options.cancel ? ' cancel' : '') })).inject(this.container); if (options.cancel) { @@ -55,7 +55,7 @@ var Question = new Class( { close : function() { var self = this; self.container.fade('out'); - (function(){self.container.destroy()}).delay(1000); + (function(){self.container.destroy();}).delay(1000); }, toElement : function() { diff --git a/couchpotato/static/scripts/library/scrollspy.js b/couchpotato/static/scripts/library/scrollspy.js index 2120eb52..053aab60 100644 --- a/couchpotato/static/scripts/library/scrollspy.js +++ b/couchpotato/static/scripts/library/scrollspy.js @@ -50,7 +50,7 @@ var ScrollSpy = new Class({ min = typeOf(self.options.min) == 'function' ? self.options.min() : self.options.min, max = typeOf(self.options.max) == 'function' ? self.options.max() : self.options.max; - if(xy >= min && (max == 0 || xy <= max)) { + if(xy >= min && (max === 0 || xy <= max)) { /* trigger enter event if necessary */ if(!self.inside) { /* record as inside */ @@ -90,4 +90,4 @@ var ScrollSpy = new Class({ addListener: function() { this.start(); } -}); \ No newline at end of file +});