From 27c57612f4737f8c7704b1ada93209c4f23cab55 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 14 Sep 2013 00:10:19 -0700 Subject: [PATCH] added global NzbDrone namespace. --- UI/AddSeries/Collection.js | 2 +- UI/AddSeries/RootFolders/Collection.js | 2 +- UI/AddSeries/RootFolders/Model.js | 2 +- UI/Calendar/Collection.js | 2 +- UI/Calendar/UpcomingCollection.js | 2 +- UI/Commands/CommandCollection.js | 2 +- UI/Commands/CommandModel.js | 2 +- UI/History/Collection.js | 2 +- UI/Logs/Collection.js | 2 +- UI/Logs/Files/Collection.js | 2 +- UI/Missing/Collection.js | 2 +- UI/Mixins/AutoComplete.js | 2 +- UI/ProgressMessaging/ProgressMessageCollection.js | 2 +- UI/Quality/QualityProfileCollection.js | 2 +- UI/Quality/QualitySizeCollection.js | 2 +- UI/Release/Collection.js | 2 +- UI/Series/EpisodeCollection.js | 2 +- UI/Series/EpisodeFileCollection.js | 2 +- UI/Series/SeriesCollection.js | 2 +- UI/Series/SeriesModel.js | 2 +- UI/ServerStatus.js | 13 +++++++------ UI/Settings/General/GeneralSettingsModel.js | 2 +- UI/Settings/Indexers/Collection.js | 2 +- UI/Settings/MediaManagement/Naming/Model.js | 2 +- UI/Settings/MediaManagement/Naming/View.js | 2 +- UI/Settings/Notifications/Collection.js | 2 +- .../Profile/QualityProfileSchemaCollection.js | 2 +- UI/Settings/SettingsModel.js | 2 +- UI/System/StatusModel.js | 2 +- UI/app.js | 2 +- 30 files changed, 36 insertions(+), 35 deletions(-) diff --git a/UI/AddSeries/Collection.js b/UI/AddSeries/Collection.js index 04101920b..0dce7bc1e 100644 --- a/UI/AddSeries/Collection.js +++ b/UI/AddSeries/Collection.js @@ -5,7 +5,7 @@ define( 'Series/SeriesModel' ], function (Backbone, SeriesModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/series/lookup', + url : window.NzbDrone.ApiRoot + '/series/lookup', model: SeriesModel, initialize: function (options) { diff --git a/UI/AddSeries/RootFolders/Collection.js b/UI/AddSeries/RootFolders/Collection.js index 19e3e0efd..157bf19ce 100644 --- a/UI/AddSeries/RootFolders/Collection.js +++ b/UI/AddSeries/RootFolders/Collection.js @@ -7,7 +7,7 @@ define( ], function (Backbone, RootFolderModel) { var RootFolderCollection = Backbone.Collection.extend({ - url : window.ApiRoot + '/rootfolder', + url : window.NzbDrone.ApiRoot + '/rootfolder', model: RootFolderModel }); diff --git a/UI/AddSeries/RootFolders/Model.js b/UI/AddSeries/RootFolders/Model.js index 2c54f6ae3..6cd0dc17b 100644 --- a/UI/AddSeries/RootFolders/Model.js +++ b/UI/AddSeries/RootFolders/Model.js @@ -4,7 +4,7 @@ define( 'backbone' ], function (Backbone) { return Backbone.Model.extend({ - urlRoot : window.ApiRoot + '/rootfolder', + urlRoot : window.NzbDrone.ApiRoot + '/rootfolder', defaults: { freeSpace: 0 } diff --git a/UI/Calendar/Collection.js b/UI/Calendar/Collection.js index 41efd7979..87972acf7 100644 --- a/UI/Calendar/Collection.js +++ b/UI/Calendar/Collection.js @@ -5,7 +5,7 @@ define( 'Series/EpisodeModel' ], function (Backbone, EpisodeModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/calendar', + url : window.NzbDrone.ApiRoot + '/calendar', model: EpisodeModel, comparator: function (model) { diff --git a/UI/Calendar/UpcomingCollection.js b/UI/Calendar/UpcomingCollection.js index fdc7d58a0..2429e3744 100644 --- a/UI/Calendar/UpcomingCollection.js +++ b/UI/Calendar/UpcomingCollection.js @@ -6,7 +6,7 @@ define( 'Series/EpisodeModel' ], function (Backbone, Moment, EpisodeModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/calendar', + url : window.NzbDrone.ApiRoot + '/calendar', model: EpisodeModel, comparator: function (model1, model2) { diff --git a/UI/Commands/CommandCollection.js b/UI/Commands/CommandCollection.js index fd6401c66..52aaef365 100644 --- a/UI/Commands/CommandCollection.js +++ b/UI/Commands/CommandCollection.js @@ -7,7 +7,7 @@ define( ], function (Backbone, CommandModel) { var CommandCollection = Backbone.Collection.extend({ - url : window.ApiRoot + '/command', + url : window.NzbDrone.ApiRoot + '/command', model: CommandModel, findCommand: function (command) { diff --git a/UI/Commands/CommandModel.js b/UI/Commands/CommandModel.js index 003feb864..fcb08dd6d 100644 --- a/UI/Commands/CommandModel.js +++ b/UI/Commands/CommandModel.js @@ -4,7 +4,7 @@ define( 'backbone' ], function (Backbone) { return Backbone.Model.extend({ - url: window.ApiRoot + '/command', + url: window.NzbDrone.ApiRoot + '/command', parse: function (response) { response.name = response.name.toLocaleLowerCase(); diff --git a/UI/History/Collection.js b/UI/History/Collection.js index 525bf1e48..e3f19ca04 100644 --- a/UI/History/Collection.js +++ b/UI/History/Collection.js @@ -5,7 +5,7 @@ define( 'backbone.pageable' ], function (HistoryModel, PageableCollection) { return PageableCollection.extend({ - url : window.ApiRoot + '/history', + url : window.NzbDrone.ApiRoot + '/history', model: HistoryModel, state: { diff --git a/UI/Logs/Collection.js b/UI/Logs/Collection.js index 3b6070b59..9b755203a 100644 --- a/UI/Logs/Collection.js +++ b/UI/Logs/Collection.js @@ -1,7 +1,7 @@ 'use strict'; define(['backbone.pageable', 'Logs/Model', ], function (PagableCollection, LogsModel) { return PagableCollection.extend({ - url : window.ApiRoot + '/log', + url : window.NzbDrone.ApiRoot + '/log', model: LogsModel, state: { diff --git a/UI/Logs/Files/Collection.js b/UI/Logs/Files/Collection.js index 969070232..0b2a5c8bb 100644 --- a/UI/Logs/Files/Collection.js +++ b/UI/Logs/Files/Collection.js @@ -2,7 +2,7 @@ define(['Logs/Files/Model' ], function (LogFileModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/log/files', + url : window.NzbDrone.ApiRoot + '/log/files', model: LogFileModel, state: { diff --git a/UI/Missing/Collection.js b/UI/Missing/Collection.js index 7ef9f627f..4461dad06 100644 --- a/UI/Missing/Collection.js +++ b/UI/Missing/Collection.js @@ -5,7 +5,7 @@ define( 'backbone.pageable' ], function (EpisodeModel, PagableCollection) { return PagableCollection.extend({ - url : window.ApiRoot + '/missing', + url : window.NzbDrone.ApiRoot + '/missing', model: EpisodeModel, state: { diff --git a/UI/Mixins/AutoComplete.js b/UI/Mixins/AutoComplete.js index 6da4c82b1..90856cb20 100644 --- a/UI/Mixins/AutoComplete.js +++ b/UI/Mixins/AutoComplete.js @@ -6,7 +6,7 @@ define(function () { $(this).typeahead({ source : function (filter, callback) { $.ajax({ - url : window.ApiRoot + resource, + url : window.NzbDrone.ApiRoot + resource, dataType: 'json', type : 'GET', data : { query: filter }, diff --git a/UI/ProgressMessaging/ProgressMessageCollection.js b/UI/ProgressMessaging/ProgressMessageCollection.js index fe711a908..ca74fb638 100644 --- a/UI/ProgressMessaging/ProgressMessageCollection.js +++ b/UI/ProgressMessaging/ProgressMessageCollection.js @@ -8,7 +8,7 @@ define( ], function (App, Backbone, Messenger) { var ProgressMessageCollection = Backbone.Collection.extend({ - url : window.ApiRoot + '/progressmessage', + url : window.NzbDrone.ApiRoot + '/progressmessage', model: Backbone.Model, initialize: function(){ diff --git a/UI/Quality/QualityProfileCollection.js b/UI/Quality/QualityProfileCollection.js index f75a8c055..dbed578d5 100644 --- a/UI/Quality/QualityProfileCollection.js +++ b/UI/Quality/QualityProfileCollection.js @@ -7,7 +7,7 @@ define( var QualityProfileCollection = Backbone.Collection.extend({ model: QualityProfileModel, - url : window.ApiRoot + '/qualityprofiles' + url : window.NzbDrone.ApiRoot + '/qualityprofiles' }); var profiles = new QualityProfileCollection(); diff --git a/UI/Quality/QualitySizeCollection.js b/UI/Quality/QualitySizeCollection.js index 4919f5ac7..b29fc62f7 100644 --- a/UI/Quality/QualitySizeCollection.js +++ b/UI/Quality/QualitySizeCollection.js @@ -5,6 +5,6 @@ define( ], function (QualitySizeModel) { return Backbone.Collection.extend({ model: QualitySizeModel, - url : window.ApiRoot + '/qualitysize' + url : window.NzbDrone.ApiRoot + '/qualitysize' }); }); diff --git a/UI/Release/Collection.js b/UI/Release/Collection.js index e584f35d0..93ec60c15 100644 --- a/UI/Release/Collection.js +++ b/UI/Release/Collection.js @@ -5,7 +5,7 @@ define( 'backbone.pageable' ], function (ReleaseModel, PagableCollection) { return PagableCollection.extend({ - url : window.ApiRoot + '/release', + url : window.NzbDrone.ApiRoot + '/release', model: ReleaseModel, mode: 'client', diff --git a/UI/Series/EpisodeCollection.js b/UI/Series/EpisodeCollection.js index 52aa024e9..3bd6d9979 100644 --- a/UI/Series/EpisodeCollection.js +++ b/UI/Series/EpisodeCollection.js @@ -5,7 +5,7 @@ define( 'Series/EpisodeModel' ], function (Backbone, EpisodeModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/episodes', + url : window.NzbDrone.ApiRoot + '/episodes', model: EpisodeModel, state: { diff --git a/UI/Series/EpisodeFileCollection.js b/UI/Series/EpisodeFileCollection.js index 2cac898ea..5cd65aaad 100644 --- a/UI/Series/EpisodeFileCollection.js +++ b/UI/Series/EpisodeFileCollection.js @@ -5,7 +5,7 @@ define( 'Series/EpisodeFileModel' ], function (Backbone, EpisodeFileModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/episodefile', + url : window.NzbDrone.ApiRoot + '/episodefile', model: EpisodeFileModel, originalFetch: Backbone.Collection.prototype.fetch, diff --git a/UI/Series/SeriesCollection.js b/UI/Series/SeriesCollection.js index 7c61ac73a..188382775 100644 --- a/UI/Series/SeriesCollection.js +++ b/UI/Series/SeriesCollection.js @@ -5,7 +5,7 @@ define( 'Series/SeriesModel' ], function (Backbone, SeriesModel) { var Collection = Backbone.Collection.extend({ - url : window.ApiRoot + '/series', + url : window.NzbDrone.ApiRoot + '/series', model: SeriesModel, comparator: function (model) { diff --git a/UI/Series/SeriesModel.js b/UI/Series/SeriesModel.js index 5be5eecb4..e73d9cc33 100644 --- a/UI/Series/SeriesModel.js +++ b/UI/Series/SeriesModel.js @@ -7,7 +7,7 @@ define( ], function (Backbone, _) { return Backbone.Model.extend({ - urlRoot: ApiRoot + '/series', + urlRoot: window.NzbDrone.ApiRoot + '/series', defaults: { episodeFileCount: 0, diff --git a/UI/ServerStatus.js b/UI/ServerStatus.js index ff01fb00e..1a5da687b 100644 --- a/UI/ServerStatus.js +++ b/UI/ServerStatus.js @@ -1,18 +1,19 @@ -window.ApiRoot = '/api'; +window.NzbDrone = {}; +window.NzbDrone.ApiRoot = '/api'; var statusText = $.ajax({ type : 'GET', - url : window.ApiRoot + '/system/status', + url : window.NzbDrone.ApiRoot + '/system/status', async: false }).responseText; -window.ServerStatus = JSON.parse(statusText); +window.NzbDrone.ServerStatus = JSON.parse(statusText); -var footerText = window.ServerStatus.version; +var footerText = window.NzbDrone.ServerStatus.version; $(document).ready(function () { - if (window.ServerStatus.branch != 'master') { - footerText += '
' + window.ServerStatus.branch; + if (window.NzbDrone.ServerStatus.branch != 'master') { + footerText += '
' + window.NzbDrone.ServerStatus.branch; } $('#footer-region .version').html(footerText); }); diff --git a/UI/Settings/General/GeneralSettingsModel.js b/UI/Settings/General/GeneralSettingsModel.js index f8854135e..c458cec87 100644 --- a/UI/Settings/General/GeneralSettingsModel.js +++ b/UI/Settings/General/GeneralSettingsModel.js @@ -5,7 +5,7 @@ define( ], function (SettingsModelBase) { return SettingsModelBase.extend({ - url : window.ApiRoot + '/settings/host', + url : window.NzbDrone.ApiRoot + '/settings/host', successMessage: 'General settings saved', errorMessage : 'Failed to save general settings' diff --git a/UI/Settings/Indexers/Collection.js b/UI/Settings/Indexers/Collection.js index 76a8fbe0e..234c97da7 100644 --- a/UI/Settings/Indexers/Collection.js +++ b/UI/Settings/Indexers/Collection.js @@ -5,7 +5,7 @@ define( 'Form/FormBuilder' ], function (IndexerModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/indexer', + url : window.NzbDrone.ApiRoot + '/indexer', model: IndexerModel }); }); diff --git a/UI/Settings/MediaManagement/Naming/Model.js b/UI/Settings/MediaManagement/Naming/Model.js index cb8028556..dbb1e0bf7 100644 --- a/UI/Settings/MediaManagement/Naming/Model.js +++ b/UI/Settings/MediaManagement/Naming/Model.js @@ -4,7 +4,7 @@ define( 'Settings/SettingsModelBase' ], function (ModelBase) { return ModelBase.extend({ - url : window.ApiRoot + '/config/naming', + url : window.NzbDrone.ApiRoot + '/config/naming', successMessage: 'MediaManagement settings saved', errorMessage : 'Couldn\'t save naming settings' }); diff --git a/UI/Settings/MediaManagement/Naming/View.js b/UI/Settings/MediaManagement/Naming/View.js index d33b0bbc0..8cd0027d2 100644 --- a/UI/Settings/MediaManagement/Naming/View.js +++ b/UI/Settings/MediaManagement/Naming/View.js @@ -45,7 +45,7 @@ define( var promise = $.ajax({ type: 'GET', - url : window.ApiRoot + '/config/naming/samples', + url : window.NzbDrone.ApiRoot + '/config/naming/samples', data: this.model.toJSON() }); diff --git a/UI/Settings/Notifications/Collection.js b/UI/Settings/Notifications/Collection.js index a8dd48449..00367ffdf 100644 --- a/UI/Settings/Notifications/Collection.js +++ b/UI/Settings/Notifications/Collection.js @@ -4,7 +4,7 @@ define( 'Settings/Notifications/Model' ], function (NotificationModel) { return Backbone.Collection.extend({ - url : window.ApiRoot + '/notification', + url : window.NzbDrone.ApiRoot + '/notification', model: NotificationModel }); }); diff --git a/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js b/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js index 2a5b80a39..47c3e232d 100644 --- a/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js +++ b/UI/Settings/Quality/Profile/QualityProfileSchemaCollection.js @@ -8,6 +8,6 @@ define( return Backbone.Collection.extend({ model: QualityProfileModel, - url : window.ApiRoot + '/qualityprofiles/schema' + url : window.NzbDrone.ApiRoot + '/qualityprofiles/schema' }); }); diff --git a/UI/Settings/SettingsModel.js b/UI/Settings/SettingsModel.js index 4e0c142ec..1fbccdb74 100644 --- a/UI/Settings/SettingsModel.js +++ b/UI/Settings/SettingsModel.js @@ -2,7 +2,7 @@ define(['app', 'Settings/SettingsModelBase'], function (App, SettingsModelBase) { return SettingsModelBase.extend({ - url : window.ApiRoot + '/settings', + url : window.NzbDrone.ApiRoot + '/settings', successMessage: 'Settings saved', errorMessage : 'Failed to save settings' }); diff --git a/UI/System/StatusModel.js b/UI/System/StatusModel.js index 8fabd1e55..20805cec7 100644 --- a/UI/System/StatusModel.js +++ b/UI/System/StatusModel.js @@ -5,7 +5,7 @@ define( ], function (Backbone) { var model = Backbone.Model.extend({ - url: window.ApiRoot + '/system/status' + url: window.NzbDrone.ApiRoot + '/system/status' }); diff --git a/UI/app.js b/UI/app.js index f9f76c0a1..280a16d39 100644 --- a/UI/app.js +++ b/UI/app.js @@ -1,7 +1,7 @@ 'use strict'; require.config({ - urlArgs: 'v=' + window.ServerStatus.version, + urlArgs: 'v=' + window.NzbDrone.ServerStatus.version, paths: { 'backbone' : 'JsLibraries/backbone',