diff --git a/dashboard-ui/bower_components/emby-webcomponents/.bower.json b/dashboard-ui/bower_components/emby-webcomponents/.bower.json
index cb026748a8..b8db56203c 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/.bower.json
+++ b/dashboard-ui/bower_components/emby-webcomponents/.bower.json
@@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
- "version": "1.4.178",
- "_release": "1.4.178",
+ "version": "1.4.180",
+ "_release": "1.4.180",
"_resolution": {
"type": "version",
- "tag": "1.4.178",
- "commit": "7c624942d8f173858375ee1b3dfe735a82245af6"
+ "tag": "1.4.180",
+ "commit": "053e9d6503c1b6322ce41ad044787990026d8e18"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1",
diff --git a/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js b/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js
index 9e0c027076..77de63122a 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/focusmanager.js
@@ -262,6 +262,11 @@ define(['dom'], function (dom) {
var elementRect = getViewportBoundingClientRect(curr, windowData);
+ // not currently visible
+ if (!elementRect.width && !elementRect.height) {
+ continue;
+ }
+
switch (direction) {
case 0:
diff --git a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js
index 1fb4fae552..96ecf3b0a1 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/itemcontextmenu.js
@@ -212,7 +212,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
}
}
- if (isMobileApp && options.sync !== false) {
+ if (options.sync !== false) {
if (itemHelper.canSync(user, item)) {
commands.push({
name: globalize.translate('sharedcomponents#SyncToOtherDevice'),
@@ -428,7 +428,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
items: [
{
Id: itemId
- }]
+ }],
+ serverId: serverId
});
});
getResolveFunction(resolve, id)();
@@ -442,7 +443,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
{
Id: itemId
}],
- isLocalSync: true
+ isLocalSync: true,
+ serverId: serverId
});
});
getResolveFunction(resolve, id)();
diff --git a/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js b/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js
index aa68c6332a..b5c9951d62 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/multiselect/multiselect.js
@@ -259,15 +259,13 @@
menuItems.push({
name: globalize.translate('sharedcomponents#Refresh'),
- id: 'refresh',
- ironIcon: 'refresh'
+ id: 'refresh'
});
if (user.Policy.EnableSync) {
menuItems.push({
name: globalize.translate('sharedcomponents#SyncToOtherDevice'),
- id: 'sync',
- ironIcon: 'sync'
+ id: 'sync'
});
}
@@ -345,7 +343,8 @@
return {
Id: i
};
- })
+ }),
+ serverId: serverId
});
});
hideSelections();
@@ -359,7 +358,8 @@
Id: i
};
}),
- isLocalSync: true
+ isLocalSync: true,
+ serverId: serverId
});
});
hideSelections();
diff --git a/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js b/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js
index d72e4c4156..83f5a5b1be 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js
+++ b/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js
@@ -415,7 +415,7 @@ define(['browser', 'layoutManager', 'dom', 'scrollStyles'], function (browser, l
fill: 'both'
};
- if (!animation.immediate || browser.animate) {
+ if (browser.animate) {
animationConfig.easing = 'ease-out';
}
diff --git a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json
index 6b249205f5..98669d50a6 100644
--- a/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json
+++ b/dashboard-ui/bower_components/emby-webcomponents/strings/en-US.json
@@ -254,5 +254,21 @@
"ServerNameIsShuttingDown": "Emby Server - {0} is shutting down.",
"HeaderDeleteItems": "Delete Items",
"ConfirmDeleteItems": "Deleting these items will delete them from both the file system and your media library. Are you sure you wish to continue?",
- "PleaseRestartServerName": "Please restart Emby Server - {0}."
+ "PleaseRestartServerName": "Please restart Emby Server - {0}.",
+ "SyncJobCreated": "Sync job created.",
+ "LabelSyncTo": "Sync to:",
+ "LabelSyncJobName": "Sync job name:",
+ "LabelQuality": "Quality:",
+ "LabelSyncNoTargetsHelp": "It looks like you don't currently have any apps that support sync.",
+ "DownloadScheduled": "Download scheduled",
+ "LearnMore": "Learn more",
+ "LabelProfile": "Profile:",
+ "LabelBitrateMbps": "Bitrate (Mbps):",
+ "SyncUnwatchedVideosOnly": "Sync unwatched videos only",
+ "SyncUnwatchedVideosOnlyHelp": "Only unwatched videos will be synced, and videos will be removed from the device as they are watched.",
+ "AutomaticallySyncNewContent": "Automatically sync new content",
+ "AutomaticallySyncNewContentHelp": "New content added to this folder will be automatically synced to the device.",
+ "LabelItemLimit": "Item limit:",
+ "LabelItemLimitHelp": "Optional. Set a limit to the number of items that will be synced.",
+ "PleaseSelectDeviceToSyncTo": "Please select a device to sync to."
}
\ No newline at end of file
diff --git a/dashboard-ui/bower_components/emby-webcomponents/sync/sync.js b/dashboard-ui/bower_components/emby-webcomponents/sync/sync.js
new file mode 100644
index 0000000000..55ea4e9869
--- /dev/null
+++ b/dashboard-ui/bower_components/emby-webcomponents/sync/sync.js
@@ -0,0 +1,526 @@
+define(['apphost', 'globalize', 'connectionManager', 'layoutManager', 'shell', 'focusManager', 'scrollHelper', 'paper-icon-button-light', 'formDialogStyle'], function (appHost, globalize, connectionManager, layoutManager, shell, focusManager, scrollHelper) {
+
+ var currentDialogOptions;
+
+ function submitJob(dlg, apiClient, userId, syncOptions, form, dialogHelper) {
+
+ if (!userId) {
+ throw new Error('userId cannot be null');
+ }
+
+ if (!syncOptions) {
+ throw new Error('syncOptions cannot be null');
+ }
+
+ if (!form) {
+ throw new Error('form cannot be null');
+ }
+
+ var selectSyncTarget = form.querySelector('#selectSyncTarget');
+ var target = selectSyncTarget ? selectSyncTarget.value : null;
+
+ if (!target) {
+
+ require(['toast'], function (toast) {
+ toast(globalize.translate('sharedcomponents#PleaseSelectDeviceToSyncTo'));
+ });
+ return false;
+ }
+
+ var options = {
+
+ userId: userId,
+ TargetId: target,
+
+ ParentId: syncOptions.ParentId,
+ Category: syncOptions.Category
+ };
+
+ setJobValues(options, form);
+
+ if (syncOptions.items && syncOptions.items.length) {
+ options.ItemIds = (syncOptions.items || []).map(function (i) {
+ return i.Id || i;
+ }).join(',');
+ }
+
+ apiClient.ajax({
+
+ type: "POST",
+ url: apiClient.getUrl("Sync/Jobs"),
+ data: JSON.stringify(options),
+ contentType: "application/json",
+ dataType: 'json'
+
+ }).then(function () {
+
+ dialogHelper.close(dlg);
+ require(['toast'], function (toast) {
+
+ var msg = target == apiClient.deviceId() ? globalize.translate('sharedcomponents#DownloadScheduled') : globalize.translate('sharedcomponents#SyncJobCreated');
+
+ toast(msg);
+ });
+ });
+
+ return true;
+ }
+
+ function setJobValues(job, form) {
+
+ var txtBitrate = form.querySelector('#txtBitrate');
+ var bitrate = txtBitrate ? txtBitrate.value : null;
+
+ if (bitrate) {
+ bitrate = parseFloat(bitrate) * 1000000;
+ }
+ job.Bitrate = bitrate;
+
+ var txtSyncJobName = form.querySelector('#txtSyncJobName');
+ if (txtSyncJobName) {
+ job.Name = txtSyncJobName.value;
+ }
+
+ var selectQuality = form.querySelector('#selectQuality');
+ if (selectQuality) {
+ job.Quality = selectQuality.value;
+ }
+
+ var selectProfile = form.querySelector('#selectProfile');
+ if (selectProfile) {
+ job.Profile = selectProfile.value;
+ }
+
+ var txtItemLimit = form.querySelector('#txtItemLimit');
+ if (txtItemLimit) {
+ job.ItemLimit = txtItemLimit.value || null;
+ }
+
+ var chkSyncNewContent = form.querySelector('#chkSyncNewContent');
+ if (chkSyncNewContent) {
+ job.SyncNewContent = chkSyncNewContent.checked;
+ }
+
+ var chkUnwatchedOnly = form.querySelector('#chkUnwatchedOnly');
+ if (chkUnwatchedOnly) {
+ job.UnwatchedOnly = chkUnwatchedOnly.checked;
+ }
+ }
+
+ function renderForm(options) {
+
+ return new Promise(function (resolve, reject) {
+
+ require(['emby-checkbox', 'emby-input', 'emby-select'], function () {
+
+ appHost.appInfo().then(function (appInfo) {
+ renderFormInternal(options, appInfo, resolve);
+ });
+ });
+ });
+ }
+
+ function onHelpLinkClick(e) {
+
+ shell.openUrl(this.href);
+
+ e.preventDefault();
+ return false;
+ }
+
+ function renderFormInternal(options, appInfo, resolve) {
+
+ var elem = options.elem;
+ var dialogOptions = options.dialogOptions;
+
+ var targets = dialogOptions.Targets;
+
+ var html = '';
+
+ var targetContainerClass = options.isLocalSync ? ' hide' : '';
+
+ if (options.showName || dialogOptions.Options.indexOf('Name') != -1) {
+
+ html += '
';
+ html += '';
+ html += '
';
+ }
+
+ if (options.readOnlySyncTarget) {
+ html += '';
+ html += '';
+ html += '
';
+ } else {
+ html += '';
+ html += '
';
+ if (!targets.length) {
+ html += '
' + globalize.translate('sharedcomponents#LabelSyncNoTargetsHelp') + '
';
+ html += '
';
+ }
+ html += '
';
+ }
+
+ html += '';
+ html += '
';
+ html += '
';
+ html += '
';
+
+ html += '';
+ html += '
';
+ html += '
';
+ html += '
';
+
+ html += '';
+ html += '';
+ html += '
';
+
+ if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) {
+ html += '';
+ html += '
';
+ html += '
' + globalize.translate('sharedcomponents#SyncUnwatchedVideosOnlyHelp') + '
';
+ html += '
';
+ }
+
+ if (dialogOptions.Options.indexOf('SyncNewContent') != -1) {
+ html += '';
+ html += '
';
+ html += '
' + globalize.translate('sharedcomponents#AutomaticallySyncNewContentHelp') + '
';
+ html += '
';
+ }
+
+ if (dialogOptions.Options.indexOf('ItemLimit') != -1) {
+ html += '';
+ }
+
+ //html += '';
+ //html += '';
+
+ elem.innerHTML = html;
+
+ var selectSyncTarget = elem.querySelector('#selectSyncTarget');
+ if (selectSyncTarget) {
+ selectSyncTarget.addEventListener('change', function () {
+ loadQualityOptions(elem, this.value, options.dialogOptionsFn).then(resolve);
+ });
+ selectSyncTarget.dispatchEvent(new CustomEvent('change', {
+ bubbles: true
+ }));
+ }
+
+ var selectProfile = elem.querySelector('#selectProfile');
+ if (selectProfile) {
+ selectProfile.addEventListener('change', function () {
+ onProfileChange(elem, this.value);
+ });
+ selectProfile.dispatchEvent(new CustomEvent('change', {
+ bubbles: true
+ }));
+ }
+
+ var selectQuality = elem.querySelector('#selectQuality');
+ if (selectQuality) {
+ selectQuality.addEventListener('change', function () {
+ onQualityChange(elem, this.value);
+ });
+ selectQuality.dispatchEvent(new CustomEvent('change', {
+ bubbles: true
+ }));
+ }
+
+ var lnkHelp = elem.querySelector('.lnkHelp');
+ if (lnkHelp) {
+ lnkHelp.addEventListener('click', onHelpLinkClick);
+ }
+
+ focusManager.autoFocus(elem);
+ }
+
+ function showSyncMenu(options) {
+
+ return new Promise(function (resolve, reject) {
+
+ require(["registrationservices", 'dialogHelper', 'formDialogStyle'], function (registrationServices, dialogHelper) {
+ registrationServices.validateFeature('sync').then(function () {
+
+ showSyncMenuInternal(dialogHelper, options).then(resolve, reject);
+
+ }, reject);
+ });
+ });
+ }
+
+ function showSyncMenuInternal(dialogHelper, options) {
+
+ var apiClient = connectionManager.getApiClient(options.serverId);
+
+ var userId = apiClient.getCurrentUserId();
+
+ var dialogOptionsQuery = {
+ UserId: userId,
+ ItemIds: (options.items || []).map(function (i) {
+ return i.Id || i;
+ }).join(','),
+
+ ParentId: options.ParentId,
+ Category: options.Category
+ };
+
+ return apiClient.getJSON(apiClient.getUrl('Sync/Options', dialogOptionsQuery)).then(function (dialogOptions) {
+
+ currentDialogOptions = dialogOptions;
+
+ var dlgElementOptions = {
+ removeOnClose: true,
+ scrollY: false,
+ autoFocus: false
+ };
+
+ if (layoutManager.tv) {
+ dlgElementOptions.size = 'fullscreen';
+ } else {
+ dlgElementOptions.size = 'small';
+ }
+
+ var dlg = dialogHelper.createDialog(dlgElementOptions);
+
+ dlg.classList.add('formDialog');
+
+ var html = '';
+ html += '';
+
+ html += '';
+ html += '
';
+
+ html += '
';
+
+ html += '
';
+ html += '
';
+
+
+ dlg.innerHTML = html;
+ document.body.appendChild(dlg);
+ var submitted = false;
+
+ dlg.querySelector('form').addEventListener('submit', function (e) {
+
+ submitted = submitJob(dlg, apiClient, userId, options, this, dialogHelper);
+
+ e.preventDefault();
+ return false;
+ });
+
+ dlg.querySelector('.btnCancel').addEventListener('click', function () {
+ dialogHelper.close(dlg);
+ });
+
+ if (layoutManager.tv) {
+ scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
+ }
+
+ var promise = dialogHelper.open(dlg);
+
+ renderForm({
+ elem: dlg.querySelector('.formFields'),
+ dialogOptions: dialogOptions,
+ dialogOptionsFn: getTargetDialogOptionsFn(apiClient, dialogOptionsQuery),
+ isLocalSync: options.isLocalSync
+ });
+
+ return promise.then(function () {
+ if (submitted) {
+ return Promise.resolve();
+ }
+ return Promise.reject();
+ });
+ });
+ }
+
+ function getTargetDialogOptionsFn(apiClient, query) {
+
+ return function (targetId) {
+
+ query.TargetId = targetId;
+ return apiClient.getJSON(apiClient.getUrl('Sync/Options', query));
+ };
+ }
+
+ function setQualityFieldVisible(form, visible) {
+
+ var fldQuality = form.querySelector('.fldQuality');
+ var selectQuality = form.querySelector('#selectQuality');
+
+ if (visible) {
+ if (fldQuality) {
+ fldQuality.classList.remove('hide');
+ }
+ if (selectQuality) {
+ selectQuality.setAttribute('required', 'required');
+ }
+ } else {
+ if (fldQuality) {
+ fldQuality.classList.add('hide');
+ }
+ if (selectQuality) {
+ selectQuality.removeAttribute('required');
+ }
+ }
+ }
+
+ function onProfileChange(form, profileId) {
+
+ var options = currentDialogOptions || {};
+ var option = (options.ProfileOptions || []).filter(function (o) {
+ return o.Id == profileId;
+ })[0];
+
+ var qualityOptions = options.QualityOptions || [];
+
+ if (option) {
+ form.querySelector('.profileDescription').innerHTML = option.Description || '';
+ setQualityFieldVisible(form, qualityOptions.length > 0 && option.EnableQualityOptions && options.Options.indexOf('Quality') != -1);
+ } else {
+ form.querySelector('.profileDescription').innerHTML = '';
+ setQualityFieldVisible(form, qualityOptions.length > 0 && options.Options.indexOf('Quality') != -1);
+ }
+ }
+
+ function onQualityChange(form, qualityId) {
+
+ var options = currentDialogOptions || {};
+ var option = (options.QualityOptions || []).filter(function (o) {
+ return o.Id == qualityId;
+ })[0];
+
+ var qualityDescription = form.querySelector('.qualityDescription');
+
+ if (option) {
+ qualityDescription.innerHTML = option.Description || '';
+ } else {
+ qualityDescription.innerHTML = '';
+ }
+
+ var fldBitrate = form.querySelector('.fldBitrate');
+ var txtBitrate = form.querySelector('#txtBitrate');
+
+ if (qualityId == 'custom') {
+
+ if (fldBitrate) {
+ fldBitrate.classList.remove('hide');
+ }
+ if (txtBitrate) {
+ txtBitrate.setAttribute('required', 'required');
+ }
+ } else {
+ if (fldBitrate) {
+ fldBitrate.classList.add('hide');
+ }
+ if (txtBitrate) {
+ txtBitrate.removeAttribute('required');
+ }
+ }
+ }
+
+ function renderTargetDialogOptions(form, options) {
+
+ currentDialogOptions = options;
+
+ var fldProfile = form.querySelector('.fldProfile');
+ var selectProfile = form.querySelector('#selectProfile');
+
+ if (options.ProfileOptions.length && options.Options.indexOf('Profile') != -1) {
+ if (fldProfile) {
+ fldProfile.classList.remove('hide');
+ }
+ if (selectProfile) {
+ selectProfile.setAttribute('required', 'required');
+ }
+ } else {
+ if (fldProfile) {
+ fldProfile.classList.add('hide');
+ }
+ if (selectProfile) {
+ selectProfile.removeAttribute('required');
+ }
+ }
+
+ setQualityFieldVisible(form, options.QualityOptions.length > 0);
+
+ if (selectProfile) {
+ selectProfile.innerHTML = options.ProfileOptions.map(function (o) {
+
+ var selectedAttribute = o.IsDefault ? ' selected="selected"' : '';
+ return '';
+
+ }).join('');
+
+ selectProfile.dispatchEvent(new CustomEvent('change', {
+ bubbles: true
+ }));
+ }
+
+ var selectQuality = form.querySelector('#selectQuality');
+ if (selectQuality) {
+ selectQuality.innerHTML = options.QualityOptions.map(function (o) {
+
+ var selectedAttribute = o.IsDefault ? ' selected="selected"' : '';
+ return '';
+
+ }).join('');
+
+ selectQuality.dispatchEvent(new CustomEvent('change', {
+ bubbles: true
+ }));
+ }
+ }
+
+ function loadQualityOptions(form, targetId, dialogOptionsFn) {
+
+ return dialogOptionsFn(targetId).then(function (options) {
+
+ return renderTargetDialogOptions(form, options);
+ });
+ }
+
+ return {
+
+ showMenu: showSyncMenu,
+ renderForm: renderForm,
+ setJobValues: setJobValues
+ };
+});
\ No newline at end of file
diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json
index f4bfef4a7c..e1304d174b 100644
--- a/dashboard-ui/bower_components/iron-meta/.bower.json
+++ b/dashboard-ui/bower_components/iron-meta/.bower.json
@@ -26,14 +26,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"main": "iron-meta.html",
- "homepage": "https://github.com/polymerelements/iron-meta",
+ "homepage": "https://github.com/PolymerElements/iron-meta",
"_release": "1.1.1",
"_resolution": {
"type": "version",
"tag": "v1.1.1",
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
},
- "_source": "git://github.com/polymerelements/iron-meta.git",
+ "_source": "git://github.com/PolymerElements/iron-meta.git",
"_target": "^1.0.0",
- "_originalSource": "polymerelements/iron-meta"
+ "_originalSource": "PolymerElements/iron-meta"
}
\ No newline at end of file
diff --git a/dashboard-ui/bower_components/polymer/.bower.json b/dashboard-ui/bower_components/polymer/.bower.json
index a96f0f050e..25eb84c037 100644
--- a/dashboard-ui/bower_components/polymer/.bower.json
+++ b/dashboard-ui/bower_components/polymer/.bower.json
@@ -32,14 +32,14 @@
"iron-component-page": "polymerElements/iron-component-page#^1.1.6"
},
"private": true,
- "homepage": "https://github.com/Polymer/polymer",
+ "homepage": "https://github.com/polymer/polymer",
"_release": "1.6.1",
"_resolution": {
"type": "version",
"tag": "v1.6.1",
"commit": "1f197d9d7874b1e5808b2a5c26f34446a7d912fc"
},
- "_source": "git://github.com/Polymer/polymer.git",
+ "_source": "git://github.com/polymer/polymer.git",
"_target": "^1.1.0",
- "_originalSource": "Polymer/polymer"
+ "_originalSource": "polymer/polymer"
}
\ No newline at end of file
diff --git a/dashboard-ui/components/categorysyncbuttons.js b/dashboard-ui/components/categorysyncbuttons.js
index cd0f3677ba..9e33c6bd1f 100644
--- a/dashboard-ui/components/categorysyncbuttons.js
+++ b/dashboard-ui/components/categorysyncbuttons.js
@@ -35,7 +35,8 @@
require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({
ParentId: parentId,
- Category: category
+ Category: category,
+ serverId: ApiClient.serverId()
});
});
}
diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js
index 36532963c6..873c545944 100644
--- a/dashboard-ui/scripts/itemdetailpage.js
+++ b/dashboard-ui/scripts/itemdetailpage.js
@@ -2041,7 +2041,8 @@
function onSyncClick() {
require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({
- items: [currentItem]
+ items: [currentItem],
+ serverId: ApiClient.serverId()
});
});
}
@@ -2058,7 +2059,9 @@
require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({
items: [currentItem],
- isLocalSync: true
+ isLocalSync: true,
+ serverId: ApiClient.serverId()
+
}).then(function () {
reload(view, params);
}, resetSyncStatus);
diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js
index 94a5fb61ca..40e589270e 100644
--- a/dashboard-ui/scripts/site.js
+++ b/dashboard-ui/scripts/site.js
@@ -1320,6 +1320,7 @@ var AppInfo = {};
define("chaptercardbuilder", [embyWebComponentsBowerPath + "/cardbuilder/chaptercardbuilder"], returnFirstDependency);
define("tvguide", [embyWebComponentsBowerPath + "/guide/guide", 'embyRouter'], returnFirstDependency);
+ define("syncDialog", [embyWebComponentsBowerPath + "/sync/sync"], returnFirstDependency);
define("voiceDialog", [embyWebComponentsBowerPath + "/voice/voicedialog"], returnFirstDependency);
define("voiceReceiver", [embyWebComponentsBowerPath + "/voice/voicereceiver"], returnFirstDependency);
define("voiceProcessor", [embyWebComponentsBowerPath + "/voice/voiceprocessor"], returnFirstDependency);
@@ -1352,8 +1353,6 @@ var AppInfo = {};
paths.appStorage = getAppStorage(apiClientBowerPath);
}
- paths.syncDialog = "scripts/sync";
-
var sha1Path = bowerPath + "/cryptojslib/components/sha1-min";
var md5Path = bowerPath + "/cryptojslib/components/md5-min";
var shim = {};
diff --git a/dashboard-ui/scripts/sync.js b/dashboard-ui/scripts/sync.js
deleted file mode 100644
index 3cc24ace42..0000000000
--- a/dashboard-ui/scripts/sync.js
+++ /dev/null
@@ -1,413 +0,0 @@
-define(['apphost', 'jQuery', 'paper-icon-button-light'], function (appHost, $) {
-
- var currentDialogOptions;
-
- function submitJob(dlg, userId, syncOptions, form, dialogHelper) {
-
- if (!userId) {
- throw new Error('userId cannot be null');
- }
-
- if (!syncOptions) {
- throw new Error('syncOptions cannot be null');
- }
-
- if (!form) {
- throw new Error('form cannot be null');
- }
-
- var target = $('#selectSyncTarget', form).val();
-
- if (!target) {
-
- require(['toast'], function (toast) {
- toast(Globalize.translate('MessagePleaseSelectDeviceToSyncTo'));
- });
- return false;
- }
-
- var options = {
-
- userId: userId,
- TargetId: target,
-
- ParentId: syncOptions.ParentId,
- Category: syncOptions.Category
- };
-
- setJobValues(options, form);
-
- if (syncOptions.items && syncOptions.items.length) {
- options.ItemIds = (syncOptions.items || []).map(function (i) {
- return i.Id || i;
- }).join(',');
- }
-
- ApiClient.ajax({
-
- type: "POST",
- url: ApiClient.getUrl("Sync/Jobs"),
- data: JSON.stringify(options),
- contentType: "application/json",
- dataType: 'json'
-
- }).then(function () {
-
- dialogHelper.close(dlg);
- require(['toast'], function (toast) {
-
- var msg = target == ApiClient.deviceId() ? Globalize.translate('MessageDownloadScheduled') : Globalize.translate('MessageSyncJobCreated');
-
- toast(msg);
- });
- });
-
- return true;
- }
-
- function setJobValues(job, form) {
-
- var bitrate = $('#txtBitrate', form).val() || null;
-
- if (bitrate) {
- bitrate = parseFloat(bitrate) * 1000000;
- }
-
- job.Name = $('#txtSyncJobName', form).val();
- job.Quality = $('#selectQuality', form).val() || null;
- job.Profile = $('#selectProfile', form).val() || null;
- job.Bitrate = bitrate;
- job.ItemLimit = $('#txtItemLimit', form).val() || null;
- job.SyncNewContent = $('#chkSyncNewContent', form).checked();
- job.UnwatchedOnly = $('#chkUnwatchedOnly', form).checked();
- }
-
- function renderForm(options) {
-
- return new Promise(function (resolve, reject) {
-
- require(['emby-checkbox', 'emby-input', 'emby-select'], function () {
-
- appHost.appInfo().then(function (appInfo) {
- renderFormInternal(options, appInfo, resolve);
- });
- });
- });
- }
-
- function renderFormInternal(options, appInfo, resolve) {
-
- var elem = options.elem;
- var dialogOptions = options.dialogOptions;
-
- var targets = dialogOptions.Targets;
-
- var html = '';
-
- var targetContainerClass = options.isLocalSync ? ' hide' : '';
-
- if (options.showName || dialogOptions.Options.indexOf('Name') != -1) {
-
- html += '';
- html += '';
- html += '
';
- }
-
- if (options.readOnlySyncTarget) {
- html += '';
- html += '';
- html += '
';
- } else {
- html += '';
- html += '
';
- if (!targets.length) {
- html += '
' + Globalize.translate('LabelSyncNoTargetsHelp') + '
';
- html += '
';
- }
- html += '
';
- }
-
- html += '';
- html += '
';
- html += '
';
- html += '
';
-
- html += '';
- html += '
';
- html += '
';
- html += '
';
-
- html += '';
- html += '';
- html += '
';
-
- if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) {
- html += '';
- html += '
';
- html += '
' + Globalize.translate('OptionSyncUnwatchedVideosOnlyHelp') + '
';
- html += '
';
- }
-
- if (dialogOptions.Options.indexOf('SyncNewContent') != -1) {
- html += '';
- html += '
';
- html += '
' + Globalize.translate('OptionAutomaticallySyncNewContentHelp') + '
';
- html += '
';
- }
-
- if (dialogOptions.Options.indexOf('ItemLimit') != -1) {
- html += '';
- }
-
- //html += '';
- //html += '';
-
- elem.innerHTML = html;
-
- $('#selectSyncTarget', elem).on('change', function () {
-
- loadQualityOptions(elem, this.value, options.dialogOptionsFn).then(resolve);
-
- }).trigger('change');
-
- $('#selectProfile', elem).on('change', function () {
-
- onProfileChange(elem, this.value);
-
- }).trigger('change');
-
- $('#selectQuality', elem).on('change', function () {
-
- onQualityChange(elem, this.value);
-
- }).trigger('change');
-
- }
-
- function showSyncMenu(options) {
-
- return new Promise(function (resolve, reject) {
-
- require(["registrationservices", 'dialogHelper', 'formDialogStyle'], function (registrationServices, dialogHelper) {
- registrationServices.validateFeature('sync').then(function () {
-
- showSyncMenuInternal(dialogHelper, options).then(resolve, reject);
-
- }, reject);
- });
- });
- }
-
- function showSyncMenuInternal(dialogHelper, options) {
-
- var userId = Dashboard.getCurrentUserId();
-
- var dialogOptionsQuery = {
- UserId: userId,
- ItemIds: (options.items || []).map(function (i) {
- return i.Id || i;
- }).join(','),
-
- ParentId: options.ParentId,
- Category: options.Category
- };
-
- return ApiClient.getJSON(ApiClient.getUrl('Sync/Options', dialogOptionsQuery)).then(function (dialogOptions) {
-
- currentDialogOptions = dialogOptions;
-
- var dlg = dialogHelper.createDialog({
- size: 'small',
- removeOnClose: true,
- autoFocus: false
- });
-
- dlg.classList.add('ui-body-a');
- dlg.classList.add('background-theme-a');
- dlg.classList.add('formDialog');
-
- var html = '';
- html += '';
-
- html += '';
- html += '
';
-
- html += '
';
-
- html += '
';
- html += '
';
-
-
- dlg.innerHTML = html;
- document.body.appendChild(dlg);
- var submitted = false;
-
- $('form', dlg).on('submit', function () {
-
- submitted = submitJob(dlg, userId, options, this, dialogHelper);
-
- return false;
- });
-
- $('.btnCancel', dlg).on('click', function () {
- dialogHelper.close(dlg);
- });
-
- var promise = dialogHelper.open(dlg);
-
- renderForm({
- elem: dlg.querySelector('.formFields'),
- dialogOptions: dialogOptions,
- dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery),
- isLocalSync: options.isLocalSync
- });
-
- return promise.then(function () {
- if (submitted) {
- return Promise.resolve();
- }
- return Promise.reject();
- });
- });
- }
-
- function getTargetDialogOptionsFn(query) {
-
- return function (targetId) {
-
- query.TargetId = targetId;
- return ApiClient.getJSON(ApiClient.getUrl('Sync/Options', query));
- };
- }
-
- function setQualityFieldVisible(form, visible) {
-
- if (visible) {
- $('.fldQuality', form).show();
- $('#selectQuality', form).attr('required', 'required');
- } else {
- $('.fldQuality', form).hide();
- $('#selectQuality', form).removeAttr('required');
- }
- }
-
- function onProfileChange(form, profileId) {
-
- var options = currentDialogOptions || {};
- var option = (options.ProfileOptions || []).filter(function (o) {
- return o.Id == profileId;
- })[0];
-
- var qualityOptions = options.QualityOptions || [];
-
- if (option) {
- $('.profileDescription', form).html(option.Description || '');
- setQualityFieldVisible(form, qualityOptions.length > 0 && option.EnableQualityOptions && options.Options.indexOf('Quality') != -1);
- } else {
- $('.profileDescription', form).html('');
- setQualityFieldVisible(form, qualityOptions.length > 0 && options.Options.indexOf('Quality') != -1);
- }
- }
-
- function onQualityChange(form, qualityId) {
-
- var options = currentDialogOptions || {};
- var option = (options.QualityOptions || []).filter(function (o) {
- return o.Id == qualityId;
- })[0];
-
- if (option) {
- $('.qualityDescription', form).html(option.Description || '');
- } else {
- $('.qualityDescription', form).html('');
- }
-
- if (qualityId == 'custom') {
- $('.fldBitrate', form).show();
- $('#txtBitrate', form).attr('required', 'required');
- } else {
- $('.fldBitrate', form).hide();
- $('#txtBitrate', form).removeAttr('required').val('');
- }
- }
-
- function renderTargetDialogOptions(form, options) {
-
- currentDialogOptions = options;
-
- if (options.ProfileOptions.length && options.Options.indexOf('Profile') != -1) {
- $('.fldProfile', form).show();
- $('#selectProfile', form).attr('required', 'required');
- } else {
- $('.fldProfile', form).hide();
- $('#selectProfile', form).removeAttr('required');
- }
-
- setQualityFieldVisible(options.QualityOptions.length > 0);
-
- $('#selectProfile', form).html(options.ProfileOptions.map(function (o) {
-
- var selectedAttribute = o.IsDefault ? ' selected="selected"' : '';
- return '';
-
- }).join('')).trigger('change');
-
- $('#selectQuality', form).html(options.QualityOptions.map(function (o) {
-
- var selectedAttribute = o.IsDefault ? ' selected="selected"' : '';
- return '';
-
- }).join('')).trigger('change');
- }
-
- function loadQualityOptions(form, targetId, dialogOptionsFn) {
-
- return dialogOptionsFn(targetId).then(function (options) {
-
- return renderTargetDialogOptions(form, options);
- });
- }
-
- return {
-
- showMenu: showSyncMenu,
- renderForm: renderForm,
- setJobValues: setJobValues
- };
-});
\ No newline at end of file