diff --git a/dashboard-ui/components/collectioneditor/collectioneditor.js b/dashboard-ui/components/collectioneditor/collectioneditor.js
index a5de2a6b4..99db7de03 100644
--- a/dashboard-ui/components/collectioneditor/collectioneditor.js
+++ b/dashboard-ui/components/collectioneditor/collectioneditor.js
@@ -1,4 +1,4 @@
-define([], function () {
+define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog'], function () {
function onSubmit() {
Dashboard.showLoadingMsg();
@@ -192,39 +192,36 @@
items = items || [];
- require(['components/paperdialoghelper'], function () {
+ var dlg = PaperDialogHelper.createDialog({
+ size: 'small'
+ });
- var dlg = PaperDialogHelper.createDialog({
- size: 'small'
- });
+ var html = '';
+ html += '
';
+ html += '';
- var html = '';
- html += '
';
- html += '';
+ var title = items.length ? Globalize.translate('HeaderAddToCollection') : Globalize.translate('HeaderNewCollection');
- var title = items.length ? Globalize.translate('HeaderAddToCollection') : Globalize.translate('HeaderNewCollection');
+ html += '
' + title + '
';
+ html += '
';
- html += '
' + title + '
';
- html += '
';
+ html += '
';
+ html += getEditorHtml();
+ html += '
';
- html += '
';
- html += getEditorHtml();
- html += '
';
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
+ var editorContent = dlg.querySelector('.editorContent');
+ initEditor(editorContent, items);
- var editorContent = dlg.querySelector('.editorContent');
- initEditor(editorContent, items);
+ $(dlg).on('iron-overlay-closed', onDialogClosed);
- $(dlg).on('iron-overlay-closed', onDialogClosed);
+ PaperDialogHelper.openWithHash(dlg, 'collectioneditor');
- PaperDialogHelper.openWithHash(dlg, 'collectioneditor');
+ $('.btnCloseDialog', dlg).on('click', function () {
- $('.btnCloseDialog', dlg).on('click', function () {
-
- PaperDialogHelper.close(dlg);
- });
+ PaperDialogHelper.close(dlg);
});
};
}
diff --git a/dashboard-ui/components/dialog.js b/dashboard-ui/components/dialog.js
new file mode 100644
index 000000000..57e7b22b0
--- /dev/null
+++ b/dashboard-ui/components/dialog.js
@@ -0,0 +1,55 @@
+define(['fade-in-animation', 'fade-out-animation', 'paper-dialog'], function () {
+
+ return function (options) {
+
+ var title = options.title;
+ var message = options.message;
+ var buttons = options.buttons;
+ var callback = options.callback;
+
+ var id = 'paperdlg' + new Date().getTime();
+
+ var html = '';
+ html += '
' + title + '
';
+ html += '
' + message + '
';
+ html += '
';
+
+ var index = 0;
+ html += buttons.map(function (b) {
+
+ var dataIndex = ' data-index="' + index + '"';
+ index++;
+ return '' + b + '';
+
+ }).join('');
+
+ html += '
';
+ html += '';
+
+ $(document.body).append(html);
+
+ // This timeout is obviously messy but it's unclear how to determine when the webcomponent is ready for use
+ // element onload never fires
+ setTimeout(function () {
+
+ var dlg = document.getElementById(id);
+
+ $('.dialogButton', dlg).on('click', function () {
+
+ if (callback) {
+ callback(parseInt(this.getAttribute('data-index')));
+ }
+
+ });
+
+ // Has to be assigned a z-index after the call to .open()
+ dlg.addEventListener('iron-overlay-closed', function (e) {
+
+ dlg.parentNode.removeChild(dlg);
+ });
+
+ dlg.open();
+
+ }, 300);
+ };
+});
\ No newline at end of file
diff --git a/dashboard-ui/components/directorybrowser/directorybrowser.js b/dashboard-ui/components/directorybrowser/directorybrowser.js
index e71fadb88..bda773502 100644
--- a/dashboard-ui/components/directorybrowser/directorybrowser.js
+++ b/dashboard-ui/components/directorybrowser/directorybrowser.js
@@ -1,4 +1,4 @@
-define([], function () {
+define(['components/paperdialoghelper', 'paper-item'], function () {
var systemInfo;
function getSystemInfo() {
@@ -213,55 +213,52 @@
getSystemInfo().then(function (systemInfo) {
- require(['components/paperdialoghelper'], function () {
-
- var dlg = PaperDialogHelper.createDialog({
- theme: 'a',
- size: 'medium'
- });
-
- dlg.classList.add('directoryPicker');
-
- var html = '';
- html += '
';
+ html += getEditorHtml(options, systemInfo);
+ html += '
';
+
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
+
+ var editorContent = dlg.querySelector('.editorContent');
+ initEditor(editorContent, options, fileOptions);
+
+ // Has to be assigned a z-index after the call to .open()
+ $(dlg).on('iron-overlay-opened', function () {
+ this.querySelector('#txtDirectoryPickerPath input').focus();
+ });
+ $(dlg).on('iron-overlay-closed', onDialogClosed);
+
+ PaperDialogHelper.openWithHash(dlg, 'directorybrowser');
+
+ $('.btnCloseDialog', dlg).on('click', function () {
+
+ PaperDialogHelper.close(dlg);
+ });
+
+ currentDialog = dlg;
+
+ var txtCurrentPath = $('#txtDirectoryPickerPath', editorContent);
+
+ if (options.path) {
+ txtCurrentPath.val(options.path);
+ }
+
+ refreshDirectoryBrowser(editorContent, txtCurrentPath.val());
+
});
};
diff --git a/dashboard-ui/components/imagedownloader/imagedownloader.js b/dashboard-ui/components/imagedownloader/imagedownloader.js
index 4bafbf5a2..600b75699 100644
--- a/dashboard-ui/components/imagedownloader/imagedownloader.js
+++ b/dashboard-ui/components/imagedownloader/imagedownloader.js
@@ -1,4 +1,4 @@
-(function ($, window, document) {
+define(['components/paperdialoghelper', 'paper-checkbox', 'paper-dialog'], function () {
var currentItemId;
var currentItemType;
@@ -312,7 +312,7 @@
currentDeferred.resolveWith(null, [hasChanges]);
}
- window.ImageDownloader = {
+ return {
show: function (itemId, itemType, imageType) {
var deferred = DeferredBuilder.Deferred();
@@ -323,12 +323,8 @@
browsableImageType = imageType || 'Primary';
selectedProvider = null;
- require(['components/paperdialoghelper'], function () {
-
- showEditor(itemId, itemType);
- });
+ showEditor(itemId, itemType);
return deferred.promise();
}
};
-
-})(jQuery, window, document);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/dashboard-ui/components/imageeditor/imageeditor.js b/dashboard-ui/components/imageeditor/imageeditor.js
index 7440601dd..891ead37d 100644
--- a/dashboard-ui/components/imageeditor/imageeditor.js
+++ b/dashboard-ui/components/imageeditor/imageeditor.js
@@ -1,4 +1,4 @@
-(function ($, document, window, FileReader, escape) {
+define(['components/paperdialoghelper', 'css!css/metadataeditor.css'], function () {
var currentItem;
var currentDeferred;
@@ -190,7 +190,7 @@
}
function showImageDownloader(page, imageType) {
- require(['components/imagedownloader/imagedownloader'], function () {
+ require(['components/imagedownloader/imagedownloader'], function (ImageDownloader) {
ImageDownloader.show(currentItem.Id, currentItem.Type, imageType).then(function (hasChanged) {
@@ -209,7 +209,7 @@
require(['components/imageuploader/imageuploader'], function () {
ImageUploader.show(currentItem.Id, {
-
+
theme: options.theme
}).then(function (hasChanged) {
@@ -285,7 +285,7 @@
currentDeferred.resolveWith(null, [hasChanges]);
}
- window.ImageEditor = {
+ return {
show: function (itemId, options) {
var deferred = DeferredBuilder.Deferred();
@@ -293,13 +293,8 @@
currentDeferred = deferred;
hasChanges = false;
- require(['components/paperdialoghelper'], function () {
-
- Dashboard.importCss('css/metadataeditor.css');
- showEditor(itemId, options);
- });
+ showEditor(itemId, options);
return deferred.promise();
}
};
-
-})(jQuery, document, window, window.FileReader, escape);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/dashboard-ui/components/imageuploader/imageuploader.js b/dashboard-ui/components/imageuploader/imageuploader.js
index 24d47f669..29336ff28 100644
--- a/dashboard-ui/components/imageuploader/imageuploader.js
+++ b/dashboard-ui/components/imageuploader/imageuploader.js
@@ -182,7 +182,7 @@
currentDeferred = deferred;
hasChanges = false;
- require(['components/paperdialoghelper'], function () {
+ require(['components/paperdialoghelper', 'paper-dialog'], function () {
showEditor(itemId, options);
});
diff --git a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js
index 93e28b341..05f9d929c 100644
--- a/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js
+++ b/dashboard-ui/components/medialibrarycreator/medialibrarycreator.js
@@ -1,4 +1,4 @@
-define([], function () {
+define(['components/paperdialoghelper', 'paper-dialog'], function () {
var currentDeferred;
var hasChanges;
@@ -186,57 +186,53 @@
currentDeferred = deferred;
hasChanges = false;
- require(['components/paperdialoghelper'], function () {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', 'components/medialibrarycreator/medialibrarycreator.template.html', true);
- var xhr = new XMLHttpRequest();
- xhr.open('GET', 'components/medialibrarycreator/medialibrarycreator.template.html', true);
+ xhr.onload = function (e) {
- xhr.onload = function (e) {
+ var template = this.response;
+ var dlg = PaperDialogHelper.createDialog({
+ size: 'small',
+ theme: 'a',
- var template = this.response;
- var dlg = PaperDialogHelper.createDialog({
- size: 'small',
- theme: 'a',
+ // In (at least) chrome this is causing the text field to not be editable
+ modal: false
+ });
- // In (at least) chrome this is causing the text field to not be editable
- modal: false
- });
+ var html = '';
+ html += '
';
+ html += '';
- var html = '';
- html += '
';
- html += '';
+ var title = Globalize.translate('ButtonAddMediaLibrary');
- var title = Globalize.translate('ButtonAddMediaLibrary');
+ html += '
' + title + '
';
+ html += '
';
- html += '
' + title + '
';
- html += '
';
+ html += '
';
+ html += Globalize.translateDocument(template);
+ html += '
';
- html += '
';
- html += Globalize.translateDocument(template);
- html += '
';
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
+ var editorContent = dlg.querySelector('.editorContent');
+ initEditor(editorContent, options.collectionTypeOptions);
- var editorContent = dlg.querySelector('.editorContent');
- initEditor(editorContent, options.collectionTypeOptions);
+ $(dlg).on('iron-overlay-closed', onDialogClosed);
- $(dlg).on('iron-overlay-closed', onDialogClosed);
+ PaperDialogHelper.openWithHash(dlg, 'medialibrarycreator');
- PaperDialogHelper.openWithHash(dlg, 'medialibrarycreator');
+ $('.btnCloseDialog', dlg).on('click', function () {
- $('.btnCloseDialog', dlg).on('click', function () {
+ PaperDialogHelper.close(dlg);
+ });
- PaperDialogHelper.close(dlg);
- });
+ paths = [];
+ renderPaths(editorContent);
+ }
- paths = [];
- renderPaths(editorContent);
- }
-
- xhr.send();
-
- });
+ xhr.send();
return deferred.promise();
};
diff --git a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js
index 60b8a08b0..6038ee7ea 100644
--- a/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js
+++ b/dashboard-ui/components/medialibraryeditor/medialibraryeditor.js
@@ -1,4 +1,4 @@
-define([], function () {
+define(['components/paperdialoghelper'], function () {
var currentDeferred;
var hasChanges;
@@ -140,54 +140,50 @@
currentDeferred = deferred;
hasChanges = false;
- require(['components/paperdialoghelper'], function () {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', 'components/medialibraryeditor/medialibraryeditor.template.html', true);
- var xhr = new XMLHttpRequest();
- xhr.open('GET', 'components/medialibraryeditor/medialibraryeditor.template.html', true);
+ xhr.onload = function (e) {
- xhr.onload = function (e) {
+ var template = this.response;
+ var dlg = PaperDialogHelper.createDialog({
+ size: 'small',
+ theme: 'a',
- var template = this.response;
- var dlg = PaperDialogHelper.createDialog({
- size: 'small',
- theme: 'a',
+ // In (at least) chrome this is causing the text field to not be editable
+ modal: false
+ });
- // In (at least) chrome this is causing the text field to not be editable
- modal: false
- });
+ var html = '';
+ html += '
';
+ html += '';
- var html = '';
- html += '
';
- html += '';
+ html += '
' + options.library.Name + '
';
+ html += '
';
- html += '
' + options.library.Name + '
';
- html += '
';
+ html += '
';
+ html += Globalize.translateDocument(template);
+ html += '
';
- html += '
';
- html += Globalize.translateDocument(template);
- html += '
';
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
+ var editorContent = dlg.querySelector('.editorContent');
+ initEditor(editorContent, options);
- var editorContent = dlg.querySelector('.editorContent');
- initEditor(editorContent, options);
+ $(dlg).on('iron-overlay-closed', onDialogClosed);
- $(dlg).on('iron-overlay-closed', onDialogClosed);
+ PaperDialogHelper.openWithHash(dlg, 'medialibraryeditor');
- PaperDialogHelper.openWithHash(dlg, 'medialibraryeditor');
+ $('.btnCloseDialog', dlg).on('click', function () {
- $('.btnCloseDialog', dlg).on('click', function () {
+ PaperDialogHelper.close(dlg);
+ });
- PaperDialogHelper.close(dlg);
- });
+ refreshLibraryFromServer(editorContent);
+ }
- refreshLibraryFromServer(editorContent);
- }
-
- xhr.send();
-
- });
+ xhr.send();
return deferred.promise();
};
diff --git a/dashboard-ui/components/metadataeditor/metadataeditor.js b/dashboard-ui/components/metadataeditor/metadataeditor.js
index d9f135cb4..5f282702b 100644
--- a/dashboard-ui/components/metadataeditor/metadataeditor.js
+++ b/dashboard-ui/components/metadataeditor/metadataeditor.js
@@ -1,112 +1 @@
-(function ($, document, window, FileReader, escape) {
-
- var currentItem;
-
- function getBaseRemoteOptions() {
-
- var options = {};
-
- options.itemId = currentItem.Id;
-
- return options;
- }
-
- function reload(page, item) {
-
- Dashboard.showLoadingMsg();
-
- if (item) {
- reloadItem(page, item);
- }
- else {
- ApiClient.getItem(Dashboard.getCurrentUserId(), currentItem.Id).then(function (item) {
- reloadItem(page, item);
- });
- }
- }
-
- function reloadItem(page, item) {
-
- currentItem = item;
-
- }
-
- function initEditor(page) {
-
- }
-
- function showEditor(itemId) {
-
- Dashboard.showLoadingMsg();
-
- var xhr = new XMLHttpRequest();
- xhr.open('GET', 'components/metadataeditor/metadataeditor.template.html', true);
-
- xhr.onload = function (e) {
-
- var template = this.response;
- ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
-
- var dlg = document.createElement('paper-dialog');
-
- dlg.setAttribute('with-backdrop', 'with-backdrop');
- dlg.setAttribute('role', 'alertdialog');
- // without this safari will scroll the background instead of the dialog contents
- dlg.setAttribute('modal', 'modal');
- // seeing max call stack size exceeded in the debugger with this
- dlg.setAttribute('noAutoFocus', 'noAutoFocus');
- dlg.entryAnimation = 'scale-up-animation';
- dlg.exitAnimation = 'fade-out-animation';
- dlg.classList.add('smoothScrollY');
-
- var html = '';
- html += '
';
- html += '';
- html += '
' + Globalize.translate('ButtonEdit') + '
';
- html += '
';
-
- html += '
';
- html += Globalize.translateDocument(template);
- html += '
';
-
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
-
- initEditor(dlg);
-
- // Has to be assigned a z-index after the call to .open()
- $(dlg).on('iron-overlay-closed', onDialogClosed);
-
- PaperDialogHelper.openWithHash(dlg, 'metadataeditor');
-
- var editorContent = dlg.querySelector('.editorContent');
- reload(editorContent, item);
-
- $('.btnCloseDialog', dlg).on('click', function () {
-
- PaperDialogHelper.close(dlg);
- });
- });
- }
-
- xhr.send();
- }
-
- function onDialogClosed() {
-
- $(this).remove();
- Dashboard.hideLoadingMsg();
- }
-
- window.MetadataEditor = {
- show: function (itemId) {
-
- require(['components/paperdialoghelper'], function () {
-
- Dashboard.importCss('css/metadataeditor.css');
- showEditor(itemId);
- });
- }
- };
-
-})(jQuery, document, window, window.FileReader, escape);
\ No newline at end of file
+
\ No newline at end of file
diff --git a/dashboard-ui/components/playlisteditor/playlisteditor.js b/dashboard-ui/components/playlisteditor/playlisteditor.js
index 07d895f60..2c30213a7 100644
--- a/dashboard-ui/components/playlisteditor/playlisteditor.js
+++ b/dashboard-ui/components/playlisteditor/playlisteditor.js
@@ -1,4 +1,4 @@
-define([], function () {
+define(['components/paperdialoghelper', 'paper-dialog'], function () {
var lastPlaylistId = '';
@@ -197,39 +197,36 @@
items = items || [];
- require(['components/paperdialoghelper'], function () {
+ var dlg = PaperDialogHelper.createDialog({
+ size: 'small'
+ });
- var dlg = PaperDialogHelper.createDialog({
- size: 'small'
- });
+ var html = '';
+ html += '
';
+ html += '';
- var html = '';
- html += '
';
- html += '';
+ var title = Globalize.translate('HeaderAddToPlaylist');
- var title = Globalize.translate('HeaderAddToPlaylist');
+ html += '
' + title + '
';
+ html += '
';
- html += '
' + title + '
';
- html += '
';
+ html += '
';
+ html += getEditorHtml();
+ html += '
';
- html += '
';
- html += getEditorHtml();
- html += '
';
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
+ var editorContent = dlg.querySelector('.editorContent');
+ initEditor(editorContent, items);
- var editorContent = dlg.querySelector('.editorContent');
- initEditor(editorContent, items);
+ $(dlg).on('iron-overlay-closed', onDialogClosed);
- $(dlg).on('iron-overlay-closed', onDialogClosed);
+ PaperDialogHelper.openWithHash(dlg, 'playlisteditor');
- PaperDialogHelper.openWithHash(dlg, 'playlisteditor');
+ $('.btnCloseDialog', dlg).on('click', function () {
- $('.btnCloseDialog', dlg).on('click', function () {
-
- PaperDialogHelper.close(dlg);
- });
+ PaperDialogHelper.close(dlg);
});
};
}
diff --git a/dashboard-ui/components/sharingwidget.js b/dashboard-ui/components/sharingwidget.js
new file mode 100644
index 000000000..4601cf10b
--- /dev/null
+++ b/dashboard-ui/components/sharingwidget.js
@@ -0,0 +1,78 @@
+define(['thirdparty/social-share-kit-1.0.4/dist/js/social-share-kit.min', 'css!thirdparty/social-share-kit-1.0.4/dist/css/social-share-kit.css', 'fade-in-animation', 'fade-out-animation', 'paper-dialog'], function () {
+
+ function showMenu(options, successCallback, cancelCallback) {
+
+ var id = 'dlg' + new Date().getTime();
+ var html = '';
+
+ html += '';
+
+ html += '
' + Globalize.translate('HeaderShare') + '
';
+
+ html += '
';
+ html += '
';
+
+ // We can only do facebook if we can guarantee that the current page is available over the internet, since FB will try to probe it.
+ if (Dashboard.isConnectMode()) {
+ html += '';
+ }
+
+ html += '
';
+ html += '
';
+
+ html += '
';
+ html += Globalize.translate('ButtonShareHelp');
+ html += '
';
+
+ html += '
';
+ html += '' + Globalize.translate('ButtonCancel') + '';
+ html += '
';
+
+ html += '';
+
+ $(document.body).append(html);
+
+ var isShared = false;
+
+ setTimeout(function () {
+
+ var dlg = document.getElementById(id);
+
+ dlg.open();
+
+ var shareInfo = options.share;
+
+ SocialShareKit.init({
+ selector: '#' + id + ' .ssk',
+ url: shareInfo.Url,
+ title: shareInfo.Name,
+ text: shareInfo.Overview,
+ image: shareInfo.ImageUrl,
+ via: 'Emby'
+ });
+
+ // Has to be assigned a z-index after the call to .open()
+ $(dlg).on('iron-overlay-closed', function () {
+ $(this).remove();
+
+ if (isShared) {
+ successCallback(options);
+ } else {
+ cancelCallback(options);
+ }
+ });
+
+ // Has to be assigned a z-index after the call to .open()
+ $('.ssk', dlg).on('click', function () {
+ isShared = true;
+ dlg.close();
+ });
+
+ }, 100);
+
+ }
+
+ return {
+ showMenu: showMenu
+ };
+});
\ No newline at end of file
diff --git a/dashboard-ui/components/subtitleeditor/subtitleeditor.js b/dashboard-ui/components/subtitleeditor/subtitleeditor.js
index 381bd2c88..18859d895 100644
--- a/dashboard-ui/components/subtitleeditor/subtitleeditor.js
+++ b/dashboard-ui/components/subtitleeditor/subtitleeditor.js
@@ -1,4 +1,4 @@
-(function ($, window, document) {
+define(['components/paperdialoghelper'], function () {
var currentItem;
@@ -12,7 +12,7 @@
var url = 'Videos/' + currentItem.Id + '/Subtitles/' + index;
ApiClient.ajax({
-
+
type: 'GET',
url: url
@@ -385,14 +385,7 @@
Dashboard.hideLoadingMsg();
}
- window.SubtitleEditor = {
- show: function (itemId) {
-
- require(['components/paperdialoghelper'], function () {
-
- showEditor(itemId);
- });
- }
+ return {
+ show: showEditor
};
-
-})(jQuery, window, document);
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/dashboard-ui/components/testermessage.js b/dashboard-ui/components/testermessage.js
new file mode 100644
index 000000000..467e753cf
--- /dev/null
+++ b/dashboard-ui/components/testermessage.js
@@ -0,0 +1,29 @@
+(function () {
+
+ function onPageShow() {
+
+ var msg;
+
+ var settingsKey = "betatester";
+
+ var expectedValue = new Date().toDateString() + "3";
+ if (appStorage.getItem(settingsKey) == expectedValue) {
+ return;
+ }
+
+ msg = 'At your convenience, please take a moment to visit the Emby Community and leave testing feedback related to this beta build. Your feedback will help us improve the release before it goes public. Thank you for being a part of the Emby beta test team.';
+
+ msg += "