From 88bd9c7abb9173549f5a7825e8ec0dbf3da1dd1c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 30 Jan 2016 14:31:22 -0500 Subject: [PATCH] move paper dialog helper --- .../collectioneditor/collectioneditor.js | 2 +- .../directorybrowser/directorybrowser.js | 2 +- .../imagedownloader/imagedownloader.js | 2 +- .../components/imageeditor/imageeditor.js | 2 +- .../components/imageuploader/imageuploader.js | 2 +- .../itemidentifier/itemidentifier.js | 2 +- .../medialibrarycreator.js | 2 +- .../medialibraryeditor/medialibraryeditor.js | 2 +- .../metadataeditor/metadataeditor.js | 2 +- .../playlisteditor/playlisteditor.js | 2 +- .../recordingcreator/recordingcreator.js | 2 +- .../subtitleeditor/subtitleeditor.js | 2 +- dashboard-ui/scripts/librarybrowser.js | 2 +- dashboard-ui/scripts/livetvcomponents.js | 4 ++-- dashboard-ui/scripts/registrationservices.js | 2 +- dashboard-ui/scripts/site.js | 19 +++++++++++++++++++ dashboard-ui/scripts/sync.js | 8 ++++---- dashboard-ui/voice/voice.js | 10 +++++----- 18 files changed, 44 insertions(+), 25 deletions(-) diff --git a/dashboard-ui/components/collectioneditor/collectioneditor.js b/dashboard-ui/components/collectioneditor/collectioneditor.js index abaab91b68..949a7c7c7e 100644 --- a/dashboard-ui/components/collectioneditor/collectioneditor.js +++ b/dashboard-ui/components/collectioneditor/collectioneditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input'], function (paperDialogHelper) { function onSubmit() { Dashboard.showLoadingMsg(); diff --git a/dashboard-ui/components/directorybrowser/directorybrowser.js b/dashboard-ui/components/directorybrowser/directorybrowser.js index cee3c1dae4..16deb8e7bb 100644 --- a/dashboard-ui/components/directorybrowser/directorybrowser.js +++ b/dashboard-ui/components/directorybrowser/directorybrowser.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-item', 'paper-input', 'paper-fab', 'paper-item-body'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-item', 'paper-input', 'paper-fab', 'paper-item-body'], function (paperDialogHelper) { var systemInfo; function getSystemInfo() { diff --git a/dashboard-ui/components/imagedownloader/imagedownloader.js b/dashboard-ui/components/imagedownloader/imagedownloader.js index 7af2ebf684..1052bff02f 100644 --- a/dashboard-ui/components/imagedownloader/imagedownloader.js +++ b/dashboard-ui/components/imagedownloader/imagedownloader.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) { var currentItemId; var currentItemType; diff --git a/dashboard-ui/components/imageeditor/imageeditor.js b/dashboard-ui/components/imageeditor/imageeditor.js index 127f455a0e..fdbfa9236e 100644 --- a/dashboard-ui/components/imageeditor/imageeditor.js +++ b/dashboard-ui/components/imageeditor/imageeditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'css!css/metadataeditor.css', 'paper-fab'], function (paperDialogHelper) { +define(['paperdialoghelper', 'css!css/metadataeditor.css', 'paper-fab'], function (paperDialogHelper) { var currentItem; var currentDeferred; diff --git a/dashboard-ui/components/imageuploader/imageuploader.js b/dashboard-ui/components/imageuploader/imageuploader.js index ff58dc9451..37d524f69c 100644 --- a/dashboard-ui/components/imageuploader/imageuploader.js +++ b/dashboard-ui/components/imageuploader/imageuploader.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-dialog', 'paper-fab'], function (paperDialogHelper) { var currentItemId; var currentFile; diff --git a/dashboard-ui/components/itemidentifier/itemidentifier.js b/dashboard-ui/components/itemidentifier/itemidentifier.js index eed94646bd..5162a0f38b 100644 --- a/dashboard-ui/components/itemidentifier/itemidentifier.js +++ b/dashboard-ui/components/itemidentifier/itemidentifier.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-dialog', 'paper-fab', 'paper-input', 'paper-checkbox'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-dialog', 'paper-fab', 'paper-input', 'paper-checkbox'], function (paperDialogHelper) { var currentItem; var currentDeferred; diff --git a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js index f0baa5c272..5d7de85cd3 100644 --- a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js +++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-dialog', 'paper-input', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { var currentDeferred; var hasChanges; diff --git a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js index 0eb22ce395..7a722d09f0 100644 --- a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js +++ b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { var currentDeferred; var hasChanges; diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.js b/dashboard-ui/components/metadataeditor/metadataeditor.js index 0a364e3c12..2d0a58607f 100644 --- a/dashboard-ui/components/metadataeditor/metadataeditor.js +++ b/dashboard-ui/components/metadataeditor/metadataeditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-checkbox', 'paper-dialog', 'paper-input', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { var currentDialog; var metadataEditorInfo; diff --git a/dashboard-ui/components/playlisteditor/playlisteditor.js b/dashboard-ui/components/playlisteditor/playlisteditor.js index c20bd2d3d1..2cbab4f736 100644 --- a/dashboard-ui/components/playlisteditor/playlisteditor.js +++ b/dashboard-ui/components/playlisteditor/playlisteditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-dialog', 'paper-input'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-dialog', 'paper-input'], function (paperDialogHelper) { var lastPlaylistId = ''; diff --git a/dashboard-ui/components/recordingcreator/recordingcreator.js b/dashboard-ui/components/recordingcreator/recordingcreator.js index 3ce81187b6..185dcc3584 100644 --- a/dashboard-ui/components/recordingcreator/recordingcreator.js +++ b/dashboard-ui/components/recordingcreator/recordingcreator.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'scripts/livetvcomponents', 'livetvcss', 'paper-checkbox', 'paper-input', 'paper-toggle-button'], function (paperDialogHelper) { +define(['paperdialoghelper', 'scripts/livetvcomponents', 'livetvcss', 'paper-checkbox', 'paper-input', 'paper-toggle-button'], function (paperDialogHelper) { var currentProgramId; var currentDialog; diff --git a/dashboard-ui/components/subtitleeditor/subtitleeditor.js b/dashboard-ui/components/subtitleeditor/subtitleeditor.js index c9078ac91f..5c9b83d41b 100644 --- a/dashboard-ui/components/subtitleeditor/subtitleeditor.js +++ b/dashboard-ui/components/subtitleeditor/subtitleeditor.js @@ -1,4 +1,4 @@ -define(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { +define(['paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { var currentItem; diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 0b85ca2b94..960b0c6a1b 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -2877,7 +2877,7 @@ showSortMenu: function (options) { - require(['components/paperdialoghelper', 'paper-dialog', 'paper-radio-button', 'paper-radio-group', 'scale-up-animation', 'fade-in-animation', 'fade-out-animation'], function (paperDialogHelper) { + require(['paperdialoghelper', 'paper-dialog', 'paper-radio-button', 'paper-radio-group', 'scale-up-animation', 'fade-in-animation', 'fade-out-animation'], function (paperDialogHelper) { var dlg = paperDialogHelper.createDialog({ removeOnClose: true, diff --git a/dashboard-ui/scripts/livetvcomponents.js b/dashboard-ui/scripts/livetvcomponents.js index b6d5e9e1ba..7931af5bce 100644 --- a/dashboard-ui/scripts/livetvcomponents.js +++ b/dashboard-ui/scripts/livetvcomponents.js @@ -253,7 +253,7 @@ function showOverlay(elem, item) { - require(['components/paperdialoghelper', 'scale-up-animation', 'fade-out-animation'], function () { + require(['paperdialoghelper', 'scale-up-animation', 'fade-out-animation'], function (paperdialoghelper) { var dlg = document.createElement('paper-dialog'); @@ -300,7 +300,7 @@ LibraryBrowser.renderGenres($('.itemGenres', dlg), item, 3); $('.miscTvProgramInfo', dlg).html(LibraryBrowser.getMiscInfoHtml(item)); - PaperDialogHelper.positionTo(dlg, elem); + paperdialoghelper.positionTo(dlg, elem); dlg.open(); diff --git a/dashboard-ui/scripts/registrationservices.js b/dashboard-ui/scripts/registrationservices.js index 5ce9d2452d..c56749777b 100644 --- a/dashboard-ui/scripts/registrationservices.js +++ b/dashboard-ui/scripts/registrationservices.js @@ -97,7 +97,7 @@ function showPlaybackOverlay(resolve, reject) { - require(['components/paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { + require(['paperdialoghelper', 'paper-fab', 'paper-item-body', 'paper-icon-item'], function (paperDialogHelper) { var dlg = paperDialogHelper.createDialog({}); diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index c383972210..b91b9028ff 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1806,6 +1806,10 @@ var AppInfo = {}; } } + function returnFirstDependency(obj) { + return obj; + } + function initRequire() { var urlArgs = "v=" + (window.dashboardVersion || new Date().getDate()); @@ -1848,6 +1852,8 @@ var AppInfo = {}; qualityoptions: embyWebComponentsBowerPath + "/qualityoptions", connectservice: apiClientBowerPath + '/connectservice', hammer: bowerPath + "/hammerjs/hammer.min", + performanceManager: embyWebComponentsBowerPath + "/performancemanager", + focusManager: embyWebComponentsBowerPath + "/focusmanager", imageLoader: embyWebComponentsBowerPath + "/images/imagehelper" }; @@ -1994,6 +2000,19 @@ var AppInfo = {}; define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"]); define("offlineusersync", [apiClientBowerPath + "/sync/offlineusersync"]); define("mediasync", [apiClientBowerPath + "/sync/mediasync"]); + + define("paperdialoghelper", [embyWebComponentsBowerPath + "/paperdialoghelper/paperdialoghelper"], returnFirstDependency); + + // alias + define("historyManager", [], function () { + return { + pushState: function (state, title, url) { + state.navigate = false; + history.pushState(state, title, url); + jQuery.onStatePushed(state); + } + }; + }); } function init(hostingAppInfo) { diff --git a/dashboard-ui/scripts/sync.js b/dashboard-ui/scripts/sync.js index 9a5eb56152..3f34f58bba 100644 --- a/dashboard-ui/scripts/sync.js +++ b/dashboard-ui/scripts/sync.js @@ -2,7 +2,7 @@ var currentDialogOptions; - function submitJob(dlg, userId, syncOptions, form) { + function submitJob(dlg, userId, syncOptions, form, paperDialogHelper) { if (!userId) { throw new Error('userId cannot be null'); @@ -51,7 +51,7 @@ }).then(function () { - PaperDialogHelper.close(dlg); + paperDialogHelper.close(dlg); $(window.SyncManager).trigger('jobsubmit'); Dashboard.alert(Globalize.translate('MessageSyncJobCreated')); }); @@ -216,7 +216,7 @@ function showSyncMenuInternal(options) { - require(['components/paperdialoghelper', 'paper-fab'], function (paperDialogHelper) { + require(['paperdialoghelper', 'paper-fab'], function (paperDialogHelper) { var userId = Dashboard.getCurrentUserId(); @@ -271,7 +271,7 @@ $('form', dlg).on('submit', function () { - submitJob(dlg, userId, options, this); + submitJob(dlg, userId, options, this, paperDialogHelper); return false; }); diff --git a/dashboard-ui/voice/voice.js b/dashboard-ui/voice/voice.js index 8f36a47913..bf27341223 100644 --- a/dashboard-ui/voice/voice.js +++ b/dashboard-ui/voice/voice.js @@ -1,4 +1,4 @@ -(function () { +define(['paperdialoghelper'], function (paperDialogHelper) { var currentRecognition; @@ -87,7 +87,7 @@ var dlg = currentDialog; if (dlg) { - PaperDialogHelper.close(dlg); + paperDialogHelper.close(dlg); } resolve(); @@ -227,7 +227,7 @@ } var currentDialog; - function showVoiceHelp(paperDialogHelper) { + function showVoiceHelp() { var dlg = paperDialogHelper.createDialog({ size: 'medium', @@ -359,7 +359,7 @@ currentRecognition = recognition; if (createUI !== false) { - require(['components/paperdialoghelper', 'paper-fab', 'css!voice/voice.css'], showVoiceHelp); + require(['paper-fab', 'css!voice/voice.css'], showVoiceHelp); } } @@ -378,4 +378,4 @@ startListening: startListening }; -})(); \ No newline at end of file +}); \ No newline at end of file