mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
merge from dev
This commit is contained in:
parent
1c8f02ce0f
commit
33b01d778c
911 changed files with 34157 additions and 57125 deletions
|
@ -2,22 +2,27 @@
|
|||
|
||||
function show(options) {
|
||||
|
||||
require(['paper-menu', 'paper-dialog', 'paper-dialog-scrollable', 'scale-up-animation', 'fade-out-animation'], function () {
|
||||
showInternal(options);
|
||||
});
|
||||
}
|
||||
|
||||
function showInternal(options) {
|
||||
|
||||
// items
|
||||
// positionTo
|
||||
// showCancel
|
||||
// title
|
||||
var id = 'dlg' + new Date().getTime();
|
||||
var html = '';
|
||||
|
||||
var style = "";
|
||||
|
||||
var windowHeight = $(window).height();
|
||||
var pos;
|
||||
|
||||
// If the window height is under a certain amount, don't bother trying to position
|
||||
// based on an element.
|
||||
if (options.positionTo && windowHeight >= 540) {
|
||||
|
||||
var pos = $(options.positionTo).offset();
|
||||
pos = $(options.positionTo).offset();
|
||||
|
||||
pos.top += $(options.positionTo).innerHeight() / 2;
|
||||
pos.left += $(options.positionTo).innerWidth() / 2;
|
||||
|
@ -41,12 +46,8 @@
|
|||
// Do some boundary checking
|
||||
pos.top = Math.max(pos.top, 0);
|
||||
pos.left = Math.max(pos.left, 0);
|
||||
|
||||
style += 'position:fixed;top:' + pos.top + 'px;left:' + pos.left + 'px';
|
||||
}
|
||||
|
||||
html += '<paper-dialog id="' + id + '" with-backdrop style="' + style + '">';
|
||||
|
||||
if (options.title) {
|
||||
html += '<h2>';
|
||||
html += options.title;
|
||||
|
@ -54,7 +55,7 @@
|
|||
}
|
||||
|
||||
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height
|
||||
var isScrollable = !$.browser.safari;
|
||||
var isScrollable = !browserInfo.safari;
|
||||
|
||||
if (isScrollable) {
|
||||
html += '<paper-dialog-scrollable>';
|
||||
|
@ -65,7 +66,11 @@
|
|||
return o.ironIcon;
|
||||
}).length;
|
||||
|
||||
html += '<paper-menu>';
|
||||
if (options.title && !renderIcon) {
|
||||
html += '<paper-menu style="text-align:center;">';
|
||||
} else {
|
||||
html += '<paper-menu>';
|
||||
}
|
||||
for (var i = 0, length = options.items.length; i < length; i++) {
|
||||
|
||||
var option = options.items[i];
|
||||
|
@ -93,39 +98,62 @@
|
|||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '</paper-dialog>';
|
||||
var dlg = document.createElement('paper-dialog');
|
||||
dlg.setAttribute('with-backdrop', 'with-backdrop');
|
||||
dlg.innerHTML = html;
|
||||
|
||||
$(document.body).append(html);
|
||||
if (pos) {
|
||||
dlg.style.position = 'fixed';
|
||||
dlg.style.left = pos.left + 'px';
|
||||
dlg.style.top = pos.top + 'px';
|
||||
}
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
// The animations flicker in IE
|
||||
if (!browserInfo.msie) {
|
||||
dlg.animationConfig = {
|
||||
// scale up
|
||||
'entry': {
|
||||
name: 'scale-up-animation',
|
||||
node: dlg,
|
||||
timing: { duration: 160, easing: 'ease-out' }
|
||||
},
|
||||
// fade out
|
||||
'exit': {
|
||||
name: 'fade-out-animation',
|
||||
node: dlg,
|
||||
timing: { duration: 200, easing: 'ease-in' }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
var dlg = document.getElementById(id);
|
||||
|
||||
dlg.open();
|
||||
}, 50);
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
$(dlg).on('iron-overlay-closed', function () {
|
||||
$(this).remove();
|
||||
});
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
dlg.addEventListener('iron-overlay-closed', function () {
|
||||
dlg.parentNode.removeChild(dlg);
|
||||
});
|
||||
|
||||
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
||||
var eventName = $.browser.chrome || $.browser.safari ? 'click' : 'mousedown';
|
||||
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
||||
var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown';
|
||||
|
||||
$('.actionSheetMenuItem', dlg).on(eventName, function () {
|
||||
$('.actionSheetMenuItem', dlg).on(eventName, function () {
|
||||
|
||||
var selectedId = this.getAttribute('data-id');
|
||||
var selectedId = this.getAttribute('data-id');
|
||||
|
||||
// Add a delay here to allow the click animation to finish, for nice effect
|
||||
setTimeout(function () {
|
||||
// Add a delay here to allow the click animation to finish, for nice effect
|
||||
setTimeout(function () {
|
||||
|
||||
dlg.close();
|
||||
dlg.close();
|
||||
|
||||
if (options.callback) {
|
||||
options.callback(selectedId);
|
||||
}
|
||||
if (options.callback) {
|
||||
options.callback(selectedId);
|
||||
}
|
||||
|
||||
}, 100);
|
||||
});
|
||||
}, 100);
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
window.ActionSheetElement = {
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
function populateReviews(id, page) {
|
||||
|
||||
ApiClient.getPackageReviews(id, null, null, 3).done(function (positive) {
|
||||
ApiClient.getPackageReviews(id, null, null, 3).then(function (positive) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
@ -108,12 +108,12 @@
|
|||
$('.pluginName', page).html(pkg.name);
|
||||
|
||||
if (pkg.targetSystem == 'Server') {
|
||||
$("#btnInstallDiv", page).visible(true);
|
||||
$("#btnInstallDiv", page).removeClass('hide');
|
||||
$("#nonServerMsg", page).hide();
|
||||
$("#pSelectVersion", page).visible(true);
|
||||
$("#pSelectVersion", page).removeClass('hide');
|
||||
} else {
|
||||
$("#btnInstallDiv", page).visible(false);
|
||||
$("#pSelectVersion", page).visible(false);
|
||||
$("#btnInstallDiv", page).addClass('hide');
|
||||
$("#pSelectVersion", page).addClass('hide');
|
||||
|
||||
var msg = Globalize.translate('MessageInstallPluginFromApp');
|
||||
$("#nonServerMsg", page).html(msg).show();
|
||||
|
@ -185,9 +185,9 @@
|
|||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
var promise3 = ApiClient.getPluginSecurityInfo();
|
||||
|
||||
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
|
||||
Promise.all([promise1, promise2, promise3]).then(function (responses) {
|
||||
|
||||
renderPackage(response1[0], response2[0], response3[0], page);
|
||||
renderPackage(responses[0], responses[1], responses[2], page);
|
||||
|
||||
});
|
||||
|
||||
|
@ -233,12 +233,37 @@
|
|||
|
||||
});
|
||||
|
||||
function performInstallation(packageName, guid, updateClass, version) {
|
||||
function performInstallation(page, packageName, guid, updateClass, version) {
|
||||
|
||||
ApiClient.installPlugin(packageName, guid, updateClass, version).done(function () {
|
||||
var developer = $('#developer', page).html().toLowerCase();
|
||||
|
||||
var alertCallback = function (confirmed) {
|
||||
|
||||
if (confirmed) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.installPlugin(packageName, guid, updateClass, version).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (developer != 'luke' && developer != 'ebr') {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
var msg = Globalize.translate('MessagePluginInstallDisclaimer');
|
||||
msg += '<br/>';
|
||||
msg += '<br/>';
|
||||
msg += Globalize.translate('PleaseConfirmPluginInstallation');
|
||||
|
||||
Dashboard.confirm(msg, Globalize.translate('HeaderConfirmPluginInstallation'), alertCallback);
|
||||
|
||||
} else {
|
||||
alertCallback(true);
|
||||
}
|
||||
}
|
||||
|
||||
function addPluginpage() {
|
||||
|
@ -256,7 +281,7 @@
|
|||
var name = getParameterByName('name');
|
||||
var guid = getParameterByName('guid');
|
||||
|
||||
ApiClient.getInstalledPlugins().done(function (plugins) {
|
||||
ApiClient.getInstalledPlugins().then(function (plugins) {
|
||||
|
||||
var installedPlugin = plugins.filter(function (ip) {
|
||||
return ip.Name == name;
|
||||
|
@ -275,7 +300,7 @@
|
|||
title: Globalize.translate('HeaderPluginInstallation')
|
||||
});
|
||||
} else {
|
||||
performInstallation(name, guid, vals[1], version);
|
||||
performInstallation(page, name, guid, vals[1], version);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -80,9 +80,9 @@
|
|||
|
||||
var promise2 = ApiClient.getSystemInfo();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadPage(page, response1[0], response2[0]);
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
var promise2 = ApiClient.getInstalledPlugins();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
renderInstalled(page, response1[0], response2[0]);
|
||||
renderCatalog(page, response1[0], response2[0]);
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
renderInstalled(page, responses[0], responses[1]);
|
||||
renderCatalog(page, responses[0], responses[1]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,24 @@
|
|||
|
||||
return appStorage.getItem('externalplayers') == 'true';
|
||||
},
|
||||
enableCinemaMode: function (val) {
|
||||
|
||||
if (val != null) {
|
||||
update('enableCinemaMode', val.toString());
|
||||
}
|
||||
|
||||
val = appStorage.getItem('enableCinemaMode');
|
||||
|
||||
if (val) {
|
||||
return val != 'false';
|
||||
}
|
||||
|
||||
if (browserInfo.mobile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
enableFullScreen: function (val) {
|
||||
|
||||
if (val != null) {
|
||||
|
@ -95,7 +113,7 @@
|
|||
update('displayLanguage', val);
|
||||
}
|
||||
|
||||
return appStorage.getItem('displayLanguage') || 'en-US';
|
||||
return appStorage.getItem('displayLanguage') || navigator.language || navigator.userLanguage || 'en-US';
|
||||
},
|
||||
|
||||
cameraUploadServers: function (val) {
|
||||
|
|
|
@ -38,13 +38,13 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.deleteOriginalFileFromOrganizationResult(id).done(function () {
|
||||
ApiClient.deleteOriginalFileFromOrganizationResult(id).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
reloadItems(page);
|
||||
|
||||
}).fail(onApiFailure);
|
||||
}, onApiFailure);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -59,10 +59,10 @@
|
|||
includeItemTypes: 'Series',
|
||||
sortBy: 'SortName'
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
Dashboard.hideLoadingMsg();
|
||||
showEpisodeCorrectionPopup(page, item, result.Items);
|
||||
}).fail(onApiFailure);
|
||||
}, onApiFailure);
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,13 +121,13 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.performOrganization(id).done(function () {
|
||||
ApiClient.performOrganization(id).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
reloadItems(page);
|
||||
|
||||
}).fail(onApiFailure);
|
||||
}, onApiFailure);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -149,7 +149,7 @@
|
|||
EndingEpisodeNumber: $('#txtEndingEpisode', form).val()
|
||||
};
|
||||
|
||||
ApiClient.performEpisodeOrganization(resultId, options).done(function () {
|
||||
ApiClient.performEpisodeOrganization(resultId, options).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -157,20 +157,21 @@
|
|||
|
||||
reloadItems(page);
|
||||
|
||||
}).fail(onApiFailure);
|
||||
}, onApiFailure);
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getFileOrganizationResults(query).done(function (result) {
|
||||
ApiClient.getFileOrganizationResults(query).then(function (result) {
|
||||
|
||||
currentResult = result;
|
||||
renderResults(page, result);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}).fail(onApiFailure);
|
||||
|
||||
}, onApiFailure);
|
||||
|
||||
}
|
||||
|
||||
|
@ -351,9 +352,9 @@
|
|||
|
||||
$('.btnClearLog', page).on('click', function () {
|
||||
|
||||
ApiClient.clearOrganizationLog().done(function () {
|
||||
ApiClient.clearOrganizationLog().then(function () {
|
||||
reloadItems(page);
|
||||
}).fail(onApiFailure);
|
||||
}, onApiFailure);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
function onSubmit() {
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
|
||||
ApiClient.getNamedConfiguration('autoorganize').then(function (config) {
|
||||
|
||||
var tvOptions = config.TvOptions;
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
|
||||
tvOptions.CopyOriginalFile = $('#copyOrMoveFile', form).val();
|
||||
|
||||
ApiClient.updateNamedConfiguration('autoorganize', config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration('autoorganize', config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
@ -160,7 +160,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
|
||||
ApiClient.getNamedConfiguration('autoorganize').then(function (config) {
|
||||
loadPage(page, config);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
ParentId: parentId
|
||||
};
|
||||
|
||||
apiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
apiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
var images = result.Items.map(function (i) {
|
||||
return {
|
||||
|
@ -99,7 +99,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
getBackdropItemIds(apiClient, Dashboard.getCurrentUserId(), type, parentId).done(function (images) {
|
||||
getBackdropItemIds(apiClient, Dashboard.getCurrentUserId(), type, parentId).then(function (images) {
|
||||
|
||||
if (images.length) {
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
var channelId = getParameterByName('id');
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).done(function (features) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).then(function (features) {
|
||||
|
||||
if (features.CanFilter) {
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var channelId = getParameterByName('id');
|
||||
var folderId = getParameterByName('folderId');
|
||||
|
@ -78,14 +78,14 @@
|
|||
|
||||
if (folderId) {
|
||||
|
||||
ApiClient.getItem(query.UserId, folderId).done(function (item) {
|
||||
ApiClient.getItem(query.UserId, folderId).then(function (item) {
|
||||
|
||||
LibraryMenu.setTitle(item.Name);
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
ApiClient.getItem(query.UserId, channelId).done(function (item) {
|
||||
ApiClient.getItem(query.UserId, channelId).then(function (item) {
|
||||
|
||||
LibraryMenu.setTitle(item.Name);
|
||||
});
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
query.folderId = folderId;
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -145,9 +145,11 @@
|
|||
showSortMenu(page);
|
||||
});
|
||||
|
||||
}).always(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
}, function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -223,7 +225,7 @@
|
|||
$('.alphabetPicker', page).alphaValue(query.NameStartsWith);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelItemsPage", function () {
|
||||
pageIdOn('pageinit', "channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -261,7 +263,9 @@
|
|||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#channelItemsPage", function () {
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforeshow', "channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
reloadFeatures(page);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
query.UserId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels", query)).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Channels", query)).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -70,7 +70,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelsPage", function () {
|
||||
pageIdOn.on('pageinit', "channelsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -79,8 +79,8 @@
|
|||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'channels.html');
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("channels").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("channels").then(function (config) {
|
||||
|
||||
// This should be null if empty
|
||||
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
|
||||
|
||||
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("channels", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("channels").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("channels").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
Sections.loadLatestChannelItems(page.querySelector('.latestItems'), Dashboard.getCurrentUserId()).always(function() {
|
||||
Sections.loadLatestChannelItems(page.querySelector('.latestItems'), Dashboard.getCurrentUserId()).then(function() {
|
||||
Dashboard.hideLoadingMsg();
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
@ -21,13 +23,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelsPage", function () {
|
||||
pageIdOn('pageinit', "channelsPage", function () {
|
||||
|
||||
var page = this;
|
||||
var pages = page.querySelector('neon-animated-pages');
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -318,14 +318,16 @@
|
|||
|
||||
if (endpointInfo) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
deferred.resolveWith(null, [endpointInfo]);
|
||||
return deferred.promise();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
resolve(endpointInfo);
|
||||
});
|
||||
}
|
||||
|
||||
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).done(function (info) {
|
||||
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||
|
||||
endpointInfo = info;
|
||||
return info;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -351,10 +353,10 @@
|
|||
supportsAc3: AppSettings.enableChromecastAc3()
|
||||
});
|
||||
|
||||
getEndpointInfo().done(function (endpoint) {
|
||||
getEndpointInfo().then(function (endpoint) {
|
||||
|
||||
if (endpoint.IsInNetwork) {
|
||||
ApiClient.getPublicSystemInfo().done(function (info) {
|
||||
ApiClient.getPublicSystemInfo().then(function (info) {
|
||||
|
||||
message.serverAddress = info.LocalAddress;
|
||||
player.sendMessageInternal(message);
|
||||
|
@ -462,17 +464,15 @@
|
|||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
if (query.Ids && query.Ids.split(',').length == 1) {
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) {
|
||||
deferred.resolveWith(null, [
|
||||
{
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
}]);
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
|
||||
resolve({
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -523,7 +523,7 @@
|
|||
|
||||
self.play = function (options) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
|
@ -535,7 +535,7 @@
|
|||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
options.items = result.Items;
|
||||
self.playWithCommand(options, 'PlayNow');
|
||||
|
@ -550,7 +550,7 @@
|
|||
self.playWithCommand = function (options, command) {
|
||||
|
||||
if (!options.items) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).then(function (item) {
|
||||
|
||||
options.items = [item];
|
||||
self.playWithCommand(options, command);
|
||||
|
@ -580,7 +580,7 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
ApiClient.getItem(userId, id).then(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
|
@ -596,7 +596,7 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
ApiClient.getItem(userId, id).then(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
|
@ -811,13 +811,11 @@
|
|||
|
||||
self.getPlayerState = function () {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var result = self.getPlayerStateInternal();
|
||||
|
||||
deferred.resolveWith(null, [result]);
|
||||
|
||||
return deferred.promise();
|
||||
var result = self.getPlayerStateInternal();
|
||||
resolve(result);
|
||||
});
|
||||
};
|
||||
|
||||
self.lastPlayerData = {};
|
||||
|
@ -833,9 +831,9 @@
|
|||
|
||||
self.tryPair = function (target) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
deferred.resolve();
|
||||
return deferred.promise();
|
||||
return new Promise(function (resolve, reject) {
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -854,9 +852,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
requirejs(["thirdparty/cast_sender"], function () {
|
||||
|
||||
initializeChromecast();
|
||||
});
|
||||
requirejs(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"], initializeChromecast);
|
||||
|
||||
})(window, window.chrome, console);
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
function loadPage(page, config) {
|
||||
|
||||
$('#chkMovies', page).checked(config.EnableIntrosForMovies).checkboxradio('refresh');
|
||||
$('#chkEpisodes', page).checked(config.EnableIntrosForEpisodes).checkboxradio('refresh');
|
||||
$('.chkMovies', page).checked(config.EnableIntrosForMovies);
|
||||
$('.chkEpisodes', page).checked(config.EnableIntrosForEpisodes);
|
||||
|
||||
$('#chkMyMovieTrailers', page).checked(config.EnableIntrosFromMoviesInLibrary).checkboxradio('refresh');
|
||||
$('.chkMyMovieTrailers', page).checked(config.EnableIntrosFromMoviesInLibrary);
|
||||
|
||||
$('#chkUpcomingTheaterTrailers', page).checked(config.EnableIntrosFromUpcomingTrailers).checkboxradio('refresh');
|
||||
$('#chkUpcomingDvdTrailers', page).checked(config.EnableIntrosFromUpcomingDvdMovies).checkboxradio('refresh');
|
||||
$('#chkUpcomingStreamingTrailers', page).checked(config.EnableIntrosFromUpcomingStreamingMovies).checkboxradio('refresh');
|
||||
$('#chkOtherTrailers', page).checked(config.EnableIntrosFromSimilarMovies).checkboxradio('refresh');
|
||||
$('.chkUpcomingTheaterTrailers', page).checked(config.EnableIntrosFromUpcomingTrailers);
|
||||
$('.chkUpcomingDvdTrailers', page).checked(config.EnableIntrosFromUpcomingDvdMovies);
|
||||
$('.chkUpcomingStreamingTrailers', page).checked(config.EnableIntrosFromUpcomingStreamingMovies);
|
||||
$('.chkOtherTrailers', page).checked(config.EnableIntrosFromSimilarMovies);
|
||||
|
||||
$('#chkUnwatchedOnly', page).checked(!config.EnableIntrosForWatchedContent).checkboxradio('refresh');
|
||||
$('#chkEnableParentalControl', page).checked(config.EnableIntrosParentalControl).checkboxradio('refresh');
|
||||
$('.chkUnwatchedOnly', page).checked(!config.EnableIntrosForWatchedContent);
|
||||
$('.chkEnableParentalControl', page).checked(config.EnableIntrosParentalControl);
|
||||
|
||||
$('#txtCustomIntrosPath', page).val(config.CustomIntroPath || '');
|
||||
$('#txtNumTrailers', page).val(config.TrailerLimit);
|
||||
|
@ -28,23 +28,23 @@
|
|||
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
||||
|
||||
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
|
||||
config.TrailerLimit = $('#txtNumTrailers', page).val();
|
||||
|
||||
config.EnableIntrosForMovies = $('#chkMovies', page).checked();
|
||||
config.EnableIntrosForEpisodes = $('#chkEpisodes', page).checked();
|
||||
config.EnableIntrosFromMoviesInLibrary = $('#chkMyMovieTrailers', page).checked();
|
||||
config.EnableIntrosForWatchedContent = !$('#chkUnwatchedOnly', page).checked();
|
||||
config.EnableIntrosParentalControl = $('#chkEnableParentalControl', page).checked();
|
||||
config.EnableIntrosForMovies = $('.chkMovies', page).checked();
|
||||
config.EnableIntrosForEpisodes = $('.chkEpisodes', page).checked();
|
||||
config.EnableIntrosFromMoviesInLibrary = $('.chkMyMovieTrailers', page).checked();
|
||||
config.EnableIntrosForWatchedContent = !$('.chkUnwatchedOnly', page).checked();
|
||||
config.EnableIntrosParentalControl = $('.chkEnableParentalControl', page).checked();
|
||||
|
||||
config.EnableIntrosFromUpcomingTrailers = $('#chkUpcomingTheaterTrailers', page).checked();
|
||||
config.EnableIntrosFromUpcomingDvdMovies = $('#chkUpcomingDvdTrailers', page).checked();
|
||||
config.EnableIntrosFromUpcomingStreamingMovies = $('#chkUpcomingStreamingTrailers', page).checked();
|
||||
config.EnableIntrosFromSimilarMovies = $('#chkOtherTrailers', page).checked();
|
||||
config.EnableIntrosFromUpcomingTrailers = $('.chkUpcomingTheaterTrailers', page).checked();
|
||||
config.EnableIntrosFromUpcomingDvdMovies = $('.chkUpcomingDvdTrailers', page).checked();
|
||||
config.EnableIntrosFromUpcomingStreamingMovies = $('.chkUpcomingStreamingTrailers', page).checked();
|
||||
config.EnableIntrosFromSimilarMovies = $('.chkOtherTrailers', page).checked();
|
||||
|
||||
ApiClient.updateNamedConfiguration("cinemamode", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("cinemamode", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -84,7 +84,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
ConnectionManager.loginToConnect(username, password).done(function () {
|
||||
ConnectionManager.loginToConnect(username, password).then(function () {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.navigate('selectserver.html');
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
ConnectionManager.connect().done(function (result) {
|
||||
ConnectionManager.connect().then(function (result) {
|
||||
|
||||
handleConnectionResult(page, result);
|
||||
|
||||
|
@ -150,7 +150,7 @@
|
|||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
ConnectionManager.signupForConnect($('#txtSignupEmail', page).val(), $('#txtSignupUsername', page).val(), $('#txtSignupPassword', page).val(), $('#txtSignupPasswordConfirm', page).val()).done(function () {
|
||||
ConnectionManager.signupForConnect($('#txtSignupEmail', page).val(), $('#txtSignupUsername', page).val(), $('#txtSignupPassword', page).val(), $('#txtSignupPasswordConfirm', page).val()).then(function () {
|
||||
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessageThankYouForConnectSignUp'),
|
||||
|
@ -159,7 +159,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
}).fail(function (result) {
|
||||
}, function (result) {
|
||||
|
||||
if (result.errorCode == 'passwordmatch') {
|
||||
Dashboard.alert({
|
||||
|
@ -187,12 +187,12 @@
|
|||
}
|
||||
|
||||
function requireCaptcha() {
|
||||
return !AppInfo.isNativeApp && getWindowUrl().toLowerCase().indexOf('https') == 0;
|
||||
return !AppInfo.isNativeApp && window.location.href.toLowerCase().indexOf('https') == 0;
|
||||
}
|
||||
|
||||
function supportInAppSignup() {
|
||||
return AppInfo.isNativeApp;
|
||||
return AppInfo.isNativeApp || getWindowUrl().toLowerCase().indexOf('https') == 0;
|
||||
return true;
|
||||
return AppInfo.isNativeApp || window.location.href.toLowerCase().indexOf('https') == 0;
|
||||
}
|
||||
|
||||
function initSignup(page) {
|
||||
|
@ -282,11 +282,11 @@
|
|||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
ConnectionManager.connectToAddress(host).done(function (result) {
|
||||
ConnectionManager.connectToAddress(host).then(function (result) {
|
||||
|
||||
handleConnectionResult(page, result);
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
handleConnectionResult(page, {
|
||||
State: MediaBrowser.ConnectionState.Unavailable
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
function refreshPageTitle(page) {
|
||||
|
||||
ApiClient.getSystemInfo().done(function (systemInfo) {
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
Dashboard.setPageTitle(systemInfo.ServerName);
|
||||
});
|
||||
|
@ -41,7 +41,7 @@
|
|||
var form = this;
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.ServerName = form.querySelector('#txtServerName').value;
|
||||
config.UICulture = $('#selectLocalizationLanguage', form).val();
|
||||
|
@ -52,18 +52,18 @@
|
|||
Dashboard.showDashboardRefreshNotification();
|
||||
}
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(function () {
|
||||
ApiClient.updateServerConfiguration(config).then(function () {
|
||||
|
||||
refreshPageTitle(page);
|
||||
|
||||
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (brandingConfig) {
|
||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (brandingConfig) {
|
||||
|
||||
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
||||
brandingConfig.CustomCss = form.querySelector('#txtCustomCss').value;
|
||||
|
||||
var cssChanged = currentBrandingOptions && brandingConfig.CustomCss != currentBrandingOptions.CustomCss;
|
||||
|
||||
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
|
||||
if (cssChanged) {
|
||||
Dashboard.showDashboardRefreshNotification();
|
||||
|
@ -116,13 +116,13 @@
|
|||
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Localization/Options"));
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadPage(page, response1[0], response2[0]);
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (config) {
|
||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (config) {
|
||||
|
||||
currentBrandingOptions = config;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.HttpServerPortNumber = $('#txtPortNumber', form).val();
|
||||
config.PublicPort = $('#txtPublicPort', form).val();
|
||||
|
@ -33,7 +33,7 @@
|
|||
config.WanDdns = $('#txtDdns', form).val();
|
||||
config.CertificatePath = $('#txtCertificatePath', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
DashboardPage.lastAppUpdateCheck = null;
|
||||
DashboardPage.lastPluginUpdateCheck = null;
|
||||
|
||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
||||
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||
|
||||
DashboardPage.renderSupporterIcon(page, pluginSecurityInfo);
|
||||
});
|
||||
|
@ -82,7 +82,7 @@
|
|||
|
||||
reloadSystemInfo: function (page) {
|
||||
|
||||
ApiClient.getSystemInfo().done(function (systemInfo) {
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
Dashboard.setPageTitle(systemInfo.ServerName);
|
||||
Dashboard.updateSystemInfo(systemInfo);
|
||||
|
@ -95,7 +95,11 @@
|
|||
$('#ports', page).html(Globalize.translate('LabelRunningOnPort', '<b>' + systemInfo.HttpServerPortNumber + '</b>'));
|
||||
}
|
||||
|
||||
$('.btnRestartContainer', page).visible(systemInfo.CanSelfRestart);
|
||||
if (systemInfo.CanSelfRestart) {
|
||||
$('.btnRestartContainer', page).removeClass('hide');
|
||||
} else {
|
||||
$('.btnRestartContainer', page).addClass('hide');
|
||||
}
|
||||
|
||||
DashboardPage.renderUrls(page, systemInfo);
|
||||
DashboardPage.renderPendingInstallations(page, systemInfo);
|
||||
|
@ -120,7 +124,7 @@
|
|||
Limit: 7
|
||||
};
|
||||
|
||||
ApiClient.getProductNews(query).done(function (result) {
|
||||
ApiClient.getProductNews(query).then(function (result) {
|
||||
|
||||
var html = result.Items.map(function (item) {
|
||||
|
||||
|
@ -242,11 +246,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
apiClient.getSessions().done(function (sessions) {
|
||||
apiClient.getSessions().then(function (sessions) {
|
||||
|
||||
DashboardPage.renderInfo(page, sessions, forceUpdate);
|
||||
});
|
||||
apiClient.getScheduledTasks().done(function (tasks) {
|
||||
apiClient.getScheduledTasks().then(function (tasks) {
|
||||
|
||||
DashboardPage.renderRunningTasks(page, tasks);
|
||||
});
|
||||
|
@ -641,15 +645,6 @@
|
|||
if (device.indexOf('chrome') != -1) {
|
||||
imgUrl = 'css/images/clients/chrome.png';
|
||||
}
|
||||
else if (device.indexOf('firefox') != -1) {
|
||||
imgUrl = 'css/images/clients/firefox.png';
|
||||
}
|
||||
else if (device.indexOf('internet explorer') != -1) {
|
||||
imgUrl = 'css/images/clients/ie.png';
|
||||
}
|
||||
else if (device.indexOf('safari') != -1) {
|
||||
imgUrl = 'css/images/clients/safari.png';
|
||||
}
|
||||
else {
|
||||
imgUrl = 'css/images/clients/html5.png';
|
||||
}
|
||||
|
@ -670,10 +665,6 @@
|
|||
|
||||
return "<img src='css/images/clients/roku.jpg' />";
|
||||
}
|
||||
if (clientLowered == "windows rt") {
|
||||
|
||||
return "<img src='css/images/clients/windowsrt.png' />";
|
||||
}
|
||||
if (clientLowered == "windows phone") {
|
||||
|
||||
return "<img src='css/images/clients/windowsphone.png' />";
|
||||
|
@ -788,6 +779,8 @@
|
|||
|
||||
var localAccessHtml = Globalize.translate('LabelLocalAccessUrl', '<a href="' + systemInfo.LocalAddress + '" target="_blank">' + systemInfo.LocalAddress + '</a>');
|
||||
|
||||
//localAccessHtml += '<a class="clearLink" href="https://github.com/MediaBrowser/Wiki/wiki/Connectivity" target="_blank"><paper-icon-button icon="info"></paper-icon-button></a>';
|
||||
|
||||
$('.localUrl', page).html(localAccessHtml).show().trigger('create');
|
||||
} else {
|
||||
$('.externalUrl', page).hide();
|
||||
|
@ -838,7 +831,7 @@
|
|||
|
||||
DashboardPage.lastAppUpdateCheck = new Date().getTime();
|
||||
|
||||
ApiClient.getAvailableApplicationUpdate().done(function (packageInfo) {
|
||||
ApiClient.getAvailableApplicationUpdate().then(function (packageInfo) {
|
||||
|
||||
var version = packageInfo[0];
|
||||
|
||||
|
@ -896,7 +889,7 @@
|
|||
|
||||
DashboardPage.lastPluginUpdateCheck = new Date().getTime();
|
||||
|
||||
ApiClient.getAvailablePluginUpdates().done(function (updates) {
|
||||
ApiClient.getAvailablePluginUpdates().then(function (updates) {
|
||||
|
||||
var elem = $('#pPluginUpdates', page);
|
||||
|
||||
|
@ -936,7 +929,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.installPlugin(name, guid, classification, version).done(function () {
|
||||
ApiClient.installPlugin(name, guid, classification, version).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
@ -949,14 +942,14 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getScheduledTasks().done(function (tasks) {
|
||||
ApiClient.getScheduledTasks().then(function (tasks) {
|
||||
|
||||
var task = tasks.filter(function (t) {
|
||||
|
||||
return t.Key == DashboardPage.systemUpdateTaskKey;
|
||||
})[0];
|
||||
|
||||
ApiClient.startScheduledTask(task.Id).done(function () {
|
||||
ApiClient.startScheduledTask(task.Id).then(function () {
|
||||
|
||||
DashboardPage.pollForInfo(page);
|
||||
|
||||
|
@ -969,7 +962,7 @@
|
|||
|
||||
var page = $.mobile.activePage;
|
||||
|
||||
ApiClient.stopScheduledTask(id).done(function () {
|
||||
ApiClient.stopScheduledTask(id).then(function () {
|
||||
|
||||
DashboardPage.pollForInfo(page);
|
||||
});
|
||||
|
@ -1180,7 +1173,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
|||
limit: limit,
|
||||
minDate: minDate.toISOString()
|
||||
|
||||
})).done(function (result) {
|
||||
})).then(function (result) {
|
||||
|
||||
elem.setAttribute('data-activitystartindex', startIndex);
|
||||
elem.setAttribute('data-activitylimit', limit);
|
||||
|
@ -1280,7 +1273,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
|||
|
||||
function dismissWelcome(page, userId) {
|
||||
|
||||
ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').then(function (result) {
|
||||
|
||||
result.CustomPrefs[welcomeTourKey] = welcomeDismissValue;
|
||||
ApiClient.updateDisplayPreferences('dashboard', result, userId, 'dashboard');
|
||||
|
@ -1293,7 +1286,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
apiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
apiClient.getDisplayPreferences('dashboard', userId, 'dashboard').then(function (result) {
|
||||
|
||||
if (result.CustomPrefs[welcomeTourKey] == welcomeDismissValue) {
|
||||
$('.welcomeMessage', page).hide();
|
||||
|
@ -1317,7 +1310,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
|||
|
||||
function takeTour(page, userId) {
|
||||
|
||||
Dashboard.loadSwipebox().done(function () {
|
||||
require(['swipebox'], function () {
|
||||
|
||||
$.swipebox([
|
||||
{ href: 'css/images/tour/dashboard/dashboard.png', title: Globalize.translate('DashboardTourDashboard') },
|
||||
|
@ -1370,13 +1363,16 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
|||
|
||||
var page = this;
|
||||
|
||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
||||
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||
|
||||
if (!$('.customSupporterPromotion', page).length) {
|
||||
$('.supporterPromotion', page).remove();
|
||||
|
||||
if (!pluginSecurityInfo.IsMBSupporter && AppInfo.enableSupporterMembership) {
|
||||
$('.content-primary', page).append('<div class="supporterPromotion"><a class="btn btnActionAccent" href="http://emby.media/premiere" target="_blank" style="font-size:14px;"><div>' + Globalize.translate('HeaderSupportTheTeam') + '</div><div style="font-weight:normal;font-size:90%;margin-top:5px;">' + Globalize.translate('TextEnjoyBonusFeatures') + '</div></a></div>');
|
||||
|
||||
var html = '<div class="supporterPromotion"><a class="clearLink" href="http://emby.media/premiere" target="_blank" style="font-size:14px;"><paper-button raised class="block" style="text-transform:none;background-color:#52B54B;color:#fff;"><div>' + Globalize.translate('HeaderSupportTheTeam') + '</div><div style="font-weight:normal;margin-top:5px;">' + Globalize.translate('TextEnjoyBonusFeatures') + '</div></paper-button></a></div>';
|
||||
|
||||
$('.content-primary', page).append(html);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', { Id: id }));
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Capabilities', { Id: id }));
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
load(page, response1[0], response2[0]);
|
||||
load(page, responses[0], responses[1]);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
@ -46,7 +46,7 @@
|
|||
}),
|
||||
contentType: "application/json"
|
||||
|
||||
}).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
}).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
Id: id
|
||||
})
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
loadData(page);
|
||||
});
|
||||
|
@ -86,9 +86,11 @@
|
|||
|
||||
SupportsPersistentIdentifier: true
|
||||
|
||||
})).done(function (result) {
|
||||
})).then(function (result) {
|
||||
|
||||
load(page, result.Items);
|
||||
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
|
||||
load(page, result.Items);
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
|
|
@ -74,10 +74,10 @@
|
|||
|
||||
}));
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
|
||||
load(page, response2[0].Items, response1[0]);
|
||||
load(page, responses[1].Items, responses[0]);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
function save(page) {
|
||||
|
||||
ApiClient.getNamedConfiguration("devices").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("devices").then(function (config) {
|
||||
|
||||
config.CameraUploadPath = $('#txtUploadPath', page).val();
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
config.EnableCameraUploadSubfolders = $('#chkSubfolder', page).checked();
|
||||
|
||||
ApiClient.updateNamedConfiguration("devices", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("devices", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
var promise1 = getProfile();
|
||||
var promise2 = ApiClient.getUsers();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
currentProfile = response1[0];
|
||||
currentProfile = responses[0];
|
||||
|
||||
renderProfile(page, currentProfile, response2[0]);
|
||||
renderProfile(page, currentProfile, responses[1]);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -864,7 +864,7 @@
|
|||
url: ApiClient.getUrl("Dlna/Profiles/" + id),
|
||||
data: JSON.stringify(profile),
|
||||
contentType: "application/json"
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.alert('Settings saved.');
|
||||
});
|
||||
|
@ -876,7 +876,7 @@
|
|||
url: ApiClient.getUrl("Dlna/Profiles"),
|
||||
data: JSON.stringify(profile),
|
||||
contentType: "application/json"
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.navigate('dlnaprofiles.html');
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
||||
|
||||
renderProfiles(page, result);
|
||||
|
||||
|
@ -92,7 +92,7 @@
|
|||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||
|
||||
config.EnableServer = $('#chkEnableServer', form).checked();
|
||||
config.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
config.EnableMovieFolders = $('#chkEnableMovieFolders', form).checked();
|
||||
|
||||
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("dlna", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -52,9 +52,9 @@
|
|||
var promise1 = ApiClient.getNamedConfiguration("dlna");
|
||||
var promise2 = ApiClient.getUsers();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadPage(page, response1[0], response2[0]);
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -15,13 +15,13 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||
|
||||
config.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
|
||||
config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
|
||||
config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
|
||||
|
||||
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("dlna", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
ApiClient.getJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) :
|
||||
{};
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var item = response1[0];
|
||||
metadataEditorInfo = response2[0];
|
||||
var item = responses[0];
|
||||
metadataEditorInfo = responses[1];
|
||||
|
||||
currentItem = item;
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
|||
|
||||
loadExternalIds(page, item, metadataEditorInfo.ExternalIdInfos);
|
||||
|
||||
Dashboard.populateLanguages($('#selectLanguage', page), languages);
|
||||
Dashboard.populateCountries($('#selectCountry', page), countries);
|
||||
populateLanguages(page.querySelector('#selectLanguage'), languages);
|
||||
populateCountries(page.querySelector('#selectCountry'), countries);
|
||||
|
||||
LibraryBrowser.renderName(item, $('.itemName', page), true);
|
||||
|
||||
|
@ -69,6 +69,38 @@
|
|||
});
|
||||
}
|
||||
|
||||
function populateCountries(select, allCountries) {
|
||||
|
||||
var html = "";
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
|
||||
var culture = allCountries[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
var html = "";
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
var culture = languages[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function renderContentTypeOptions(page, metadataInfo) {
|
||||
|
||||
if (metadataInfo.ContentTypeOptions.length) {
|
||||
|
@ -280,7 +312,7 @@
|
|||
$('#fldYear', page).show();
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (LibraryBrowser.getMoreCommands(item, user).indexOf('identify') != -1) {
|
||||
|
||||
|
@ -895,13 +927,13 @@
|
|||
|
||||
Dashboard.alert(Globalize.translate('MessageItemSaved'));
|
||||
|
||||
MetadataEditor.getItemPromise().done(function (i) {
|
||||
MetadataEditor.getItemPromise().then(function (i) {
|
||||
page.trigger('itemsaved', [i]);
|
||||
bindItemChanged(page);
|
||||
});
|
||||
}
|
||||
|
||||
ApiClient.updateItem(item).done(function () {
|
||||
ApiClient.updateItem(item).then(function () {
|
||||
|
||||
var newContentType = $('#selectContentType', form).val() || '';
|
||||
|
||||
|
@ -915,7 +947,7 @@
|
|||
|
||||
type: 'POST'
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
afterContentTypeUpdated();
|
||||
});
|
||||
|
||||
|
@ -1088,7 +1120,7 @@
|
|||
|
||||
function showMoreMenu(page, elem) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
var moreCommands = LibraryBrowser.getMoreCommands(currentItem, user);
|
||||
|
||||
|
|
|
@ -104,11 +104,7 @@
|
|||
|
||||
function loadChildrenOfRootNode(page, scope, callback) {
|
||||
|
||||
var promise2 = ApiClient.getLiveTvChannels({ limit: 0 });
|
||||
|
||||
$.when(promise2).done(function (response2) {
|
||||
|
||||
var result = response2;
|
||||
ApiClient.getLiveTvChannels({ limit: 0 }).then(function (result) {
|
||||
|
||||
var nodes = [];
|
||||
|
||||
|
@ -155,7 +151,7 @@
|
|||
|
||||
function loadLiveTvChannels(service, openItems, callback) {
|
||||
|
||||
ApiClient.getLiveTvChannels({ ServiceName: service, AddCurrentProgram: false }).done(function (result) {
|
||||
ApiClient.getLiveTvChannels({ ServiceName: service, AddCurrentProgram: false }).then(function (result) {
|
||||
|
||||
var nodes = result.Items.map(function (i) {
|
||||
|
||||
|
@ -173,7 +169,7 @@
|
|||
|
||||
function loadMediaFolders(page, scope, openItems, callback) {
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders")).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders")).then(function (result) {
|
||||
|
||||
var nodes = result.Items.map(function (n) {
|
||||
|
||||
|
@ -229,7 +225,7 @@
|
|||
query.SortBy = "SortName";
|
||||
}
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
var nodes = result.Items.map(function (n) {
|
||||
|
||||
|
@ -262,23 +258,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
function loadJsTree() {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
require([
|
||||
'bower_components/jstree/dist/jstree.min'
|
||||
], function () {
|
||||
|
||||
Dashboard.importCss('thirdparty/jstree/themes/default/style.min.css');
|
||||
deferred.resolve();
|
||||
});
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function initializeTree(page, currentUser, openItems, selectedId) {
|
||||
|
||||
loadJsTree().done(function () {
|
||||
require(['jstree'], function () {
|
||||
initializeTreeInternal(page, currentUser, openItems, selectedId);
|
||||
});
|
||||
}
|
||||
|
@ -422,13 +404,13 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
var id = getCurrentItemId();
|
||||
|
||||
if (id) {
|
||||
|
||||
ApiClient.getAncestorItems(id, user.Id).done(function (ancestors) {
|
||||
ApiClient.getAncestorItems(id, user.Id).then(function (ancestors) {
|
||||
|
||||
var ids = ancestors.map(function (i) {
|
||||
return i.Id;
|
||||
|
@ -453,7 +435,7 @@
|
|||
|
||||
function getCurrentItemId() {
|
||||
|
||||
var url = window.location.hash || getWindowUrl();
|
||||
var url = window.location.hash || window.location.href;
|
||||
|
||||
return getParameterByName('id', url);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("encoding").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||
|
||||
config.EnableDebugLogging = $('#chkEnableDebugEncodingLogging', form).checked();
|
||||
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
|
||||
|
@ -34,7 +34,7 @@
|
|||
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
||||
config.HardwareAccelerationType = $('#selectVideoDecoder', form).val();
|
||||
|
||||
ApiClient.updateNamedConfiguration("encoding", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("encoding", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("encoding").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
Dashboard.showLoadingMsg();
|
||||
|
||||
var query = getQuery();
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -1,286 +1,4 @@
|
|||
// Regular Expressions for parsing tags and attributes
|
||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
||||
// Match everything outside of normal chars and " (quote character)
|
||||
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
|
||||
|
||||
var hiddenPre = document.createElement("pre");
|
||||
/**
|
||||
* decodes all entities into regular string
|
||||
* @param value
|
||||
* @returns {string} A string with decoded entities.
|
||||
*/
|
||||
function htmlDecode(value) {
|
||||
if (!value) { return ''; }
|
||||
|
||||
hiddenPre.innerHTML = value.replace(/</g, "<");
|
||||
// innerText depends on styling as it doesn't display hidden elements.
|
||||
// Therefore, it's better to use textContent not to cause unnecessary reflows.
|
||||
return hiddenPre.textContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes all potentially dangerous characters, so that the
|
||||
* resulting string can be safely inserted into attribute or
|
||||
* element text.
|
||||
* @param value
|
||||
* @returns {string} escaped text
|
||||
*/
|
||||
function htmlEncode(value) {
|
||||
return value.
|
||||
replace(/&/g, '&').
|
||||
replace(SURROGATE_PAIR_REGEXP, function (value) {
|
||||
var hi = value.charCodeAt(0);
|
||||
var low = value.charCodeAt(1);
|
||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||
}).
|
||||
replace(NON_ALPHANUMERIC_REGEXP, function (value) {
|
||||
return '&#' + value.charCodeAt(0) + ';';
|
||||
}).
|
||||
replace(/</g, '<').
|
||||
replace(/>/g, '>');
|
||||
}
|
||||
|
||||
// Array Remove - By John Resig (MIT Licensed)
|
||||
Array.prototype.remove = function (from, to) {
|
||||
var rest = this.slice((to || from) + 1 || this.length);
|
||||
this.length = from < 0 ? this.length + from : from;
|
||||
return this.push.apply(this, rest);
|
||||
};
|
||||
|
||||
$.fn.checked = function (value) {
|
||||
if (value === true || value === false) {
|
||||
// Set the value of the checkbox
|
||||
return $(this).each(function () {
|
||||
this.checked = value;
|
||||
});
|
||||
} else {
|
||||
// Return check state
|
||||
return this.length && this[0].checked;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.buttonEnabled = function (enabled) {
|
||||
|
||||
return enabled ? this.attr('disabled', '').removeAttr('disabled') : this.attr('disabled', 'disabled');
|
||||
};
|
||||
|
||||
if (!Array.prototype.filter) {
|
||||
Array.prototype.filter = function (fun /*, thisp*/) {
|
||||
"use strict";
|
||||
|
||||
if (this == null)
|
||||
throw new TypeError();
|
||||
|
||||
var t = Object(this);
|
||||
var len = t.length >>> 0;
|
||||
if (typeof fun != "function")
|
||||
throw new TypeError();
|
||||
|
||||
var res = [];
|
||||
var thisp = arguments[1];
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (i in t) {
|
||||
var val = t[i]; // in case fun mutates this
|
||||
if (fun.call(thisp, val, i, t))
|
||||
res.push(val);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
||||
var WebNotifications = {
|
||||
|
||||
show: function (data) {
|
||||
|
||||
// Seeing crashes in android
|
||||
if (window.cordova && window.cordova.plugins && window.cordova.plugins.notification) {
|
||||
|
||||
if (!WebNotifications.lastId) {
|
||||
// Cordova plugin will crash on android with long. need an int
|
||||
WebNotifications.lastId = new Date().getDate() + new Date().getMilliseconds();
|
||||
}
|
||||
|
||||
WebNotifications.lastId++;
|
||||
|
||||
window.cordova.plugins.notification.local.schedule({
|
||||
|
||||
id: WebNotifications.lastId,
|
||||
|
||||
title: data.title,
|
||||
text: data.body,
|
||||
//firstAt: monday_9_am,
|
||||
//every: "week",
|
||||
//sound: "file://sounds/reminder.mp3",
|
||||
//data: { meetingId: "123#fg8" },
|
||||
icon: data.icon
|
||||
});
|
||||
}
|
||||
else if (window.Notification) {
|
||||
|
||||
var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
|
||||
|
||||
if (level === "granted") {
|
||||
var notif = new Notification(data.title, data);
|
||||
|
||||
if (notif.show) {
|
||||
notif.show();
|
||||
}
|
||||
|
||||
if (data.timeout) {
|
||||
setTimeout(function () {
|
||||
|
||||
if (notif.close) {
|
||||
notif.close();
|
||||
}
|
||||
else if (notif.cancel) {
|
||||
notif.cancel();
|
||||
}
|
||||
}, data.timeout);
|
||||
}
|
||||
|
||||
return notif;
|
||||
} else if (level === "default") {
|
||||
Notification.requestPermission(function () {
|
||||
return WebNotifications.show(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
else if (window.webkitNotifications) {
|
||||
if (!webkitNotifications.checkPermission()) {
|
||||
var notif = webkitNotifications.createNotification(data.icon, data.title, data.body);
|
||||
notif.show();
|
||||
|
||||
if (data.timeout) {
|
||||
setTimeout(function () {
|
||||
|
||||
if (notif.close) {
|
||||
notif.close();
|
||||
}
|
||||
else if (notif.cancel) {
|
||||
notif.cancel();
|
||||
}
|
||||
}, data.timeout);
|
||||
}
|
||||
|
||||
return notif;
|
||||
} else {
|
||||
webkitNotifications.requestPermission(function () {
|
||||
return WebNotifications.show(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
requestPermission: function () {
|
||||
if (window.webkitNotifications) {
|
||||
if (!webkitNotifications.checkPermission()) {
|
||||
} else {
|
||||
webkitNotifications.requestPermission(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (window.Notification) {
|
||||
|
||||
var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
|
||||
|
||||
if (level === "default") {
|
||||
Notification.requestPermission(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Javascript Humane Dates
|
||||
* Copyright (c) 2008 Dean Landolt (deanlandolt.com)
|
||||
* Re-write by Zach Leatherman (zachleat.com)
|
||||
*
|
||||
* Adopted from the John Resig's pretty.js
|
||||
* at http://ejohn.org/blog/javascript-pretty-date
|
||||
* and henrah's proposed modification
|
||||
* at http://ejohn.org/blog/javascript-pretty-date/#comment-297458
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
function humane_date(date_str) {
|
||||
var time_formats = [[90, 'a minute'], // 60*1.5
|
||||
[3600, 'minutes', 60], // 60*60, 60
|
||||
[5400, 'an hour'], // 60*60*1.5
|
||||
[86400, 'hours', 3600], // 60*60*24, 60*60
|
||||
[129600, 'a day'], // 60*60*24*1.5
|
||||
[604800, 'days', 86400], // 60*60*24*7, 60*60*24
|
||||
[907200, 'a week'], // 60*60*24*7*1.5
|
||||
[2628000, 'weeks', 604800], // 60*60*24*(365/12), 60*60*24*7
|
||||
[3942000, 'a month'], // 60*60*24*(365/12)*1.5
|
||||
[31536000, 'months', 2628000], // 60*60*24*365, 60*60*24*(365/12)
|
||||
[47304000, 'a year'], // 60*60*24*365*1.5
|
||||
[3153600000, 'years', 31536000] // 60*60*24*365*100, 60*60*24*365
|
||||
];
|
||||
|
||||
var dt = new Date;
|
||||
var date = parseISO8601Date(date_str, { toLocal: true });
|
||||
|
||||
var seconds = ((dt - date) / 1000);
|
||||
var token = ' ago';
|
||||
var i = 0;
|
||||
var format;
|
||||
|
||||
if (seconds < 0) {
|
||||
seconds = Math.abs(seconds);
|
||||
token = '';
|
||||
}
|
||||
|
||||
while (format = time_formats[i++]) {
|
||||
if (seconds < format[0]) {
|
||||
if (format.length == 2) {
|
||||
return format[1] + token;
|
||||
} else {
|
||||
return Math.round(seconds / format[2]) + ' ' + format[1] + token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// overflow for centuries
|
||||
if (seconds > 4730400000)
|
||||
return Math.round(seconds / 4730400000) + ' centuries' + token;
|
||||
|
||||
return date_str;
|
||||
}
|
||||
|
||||
function humane_elapsed(firstDateStr, secondDateStr) {
|
||||
var dt1 = new Date(firstDateStr);
|
||||
var dt2 = new Date(secondDateStr);
|
||||
var seconds = (dt2.getTime() - dt1.getTime()) / 1000;
|
||||
var numdays = Math.floor((seconds % 31536000) / 86400);
|
||||
var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);
|
||||
var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60);
|
||||
var numseconds = Math.round((((seconds % 31536000) % 86400) % 3600) % 60);
|
||||
|
||||
var elapsedStr = '';
|
||||
elapsedStr += numdays == 1 ? numdays + ' day ' : '';
|
||||
elapsedStr += numdays > 1 ? numdays + ' days ' : '';
|
||||
elapsedStr += numhours == 1 ? numhours + ' hour ' : '';
|
||||
elapsedStr += numhours > 1 ? numhours + ' hours ' : '';
|
||||
elapsedStr += numminutes == 1 ? numminutes + ' minute ' : '';
|
||||
elapsedStr += numminutes > 1 ? numminutes + ' minutes ' : '';
|
||||
elapsedStr += elapsedStr.length > 0 ? 'and ' : '';
|
||||
elapsedStr += numseconds == 1 ? numseconds + ' second' : '';
|
||||
elapsedStr += numseconds == 0 || numseconds > 1 ? numseconds + ' seconds' : '';
|
||||
|
||||
return elapsedStr;
|
||||
|
||||
}
|
||||
|
||||
function getWindowUrl(win) {
|
||||
return (win || window).location.href;
|
||||
}
|
||||
|
||||
function getWindowLocationSearch(win) {
|
||||
function getWindowLocationSearch(win) {
|
||||
|
||||
var search = (win || window).location.search;
|
||||
|
||||
|
@ -380,101 +98,4 @@ function parseISO8601Date(s, options) {
|
|||
}
|
||||
|
||||
return new Date(ms);
|
||||
}
|
||||
|
||||
|
||||
//convert Ticks to human hr:min:sec format
|
||||
function ticks_to_human(str) {
|
||||
|
||||
var in_seconds = (str / 10000000);
|
||||
var hours = Math.floor(in_seconds / 3600);
|
||||
var minutes = Math.floor((in_seconds - (hours * 3600)) / 60);
|
||||
var seconds = '0' + Math.round(in_seconds - (hours * 3600) - (minutes * 60));
|
||||
|
||||
var time = '';
|
||||
|
||||
if (hours > 0) time += hours + ":";
|
||||
if (minutes < 10 && hours == 0) time += minutes;
|
||||
else time += ('0' + minutes).substr(-2);
|
||||
time += ":" + seconds.substr(-2);
|
||||
|
||||
return time;
|
||||
};
|
||||
|
||||
(function () {
|
||||
var supportTouch = $.support.touch,
|
||||
scrollEvent = "touchmove scroll",
|
||||
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
|
||||
touchStopEvent = supportTouch ? "touchend" : "mouseup",
|
||||
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
|
||||
$.event.special.swipeupdown = {
|
||||
setup: function () {
|
||||
var thisObject = this;
|
||||
var $this = $(thisObject);
|
||||
$this.bind(touchStartEvent, function (event) {
|
||||
var data = event.originalEvent.touches ?
|
||||
event.originalEvent.touches[0] :
|
||||
event,
|
||||
start = {
|
||||
time: (new Date).getTime(),
|
||||
coords: [data.pageX, data.pageY],
|
||||
origin: $(event.target)
|
||||
},
|
||||
stop;
|
||||
|
||||
function moveHandler(event) {
|
||||
if (!start) {
|
||||
return;
|
||||
}
|
||||
var data = event.originalEvent.touches ?
|
||||
event.originalEvent.touches[0] :
|
||||
event;
|
||||
stop = {
|
||||
time: (new Date).getTime(),
|
||||
coords: [data.pageX, data.pageY]
|
||||
};
|
||||
|
||||
// prevent scrolling
|
||||
if (Math.abs(start.coords[1] - stop.coords[1]) > 10) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
$this
|
||||
.bind(touchMoveEvent, moveHandler)
|
||||
.one(touchStopEvent, function (event) {
|
||||
$this.unbind(touchMoveEvent, moveHandler);
|
||||
if (start && stop) {
|
||||
if (stop.time - start.time < 1000 &&
|
||||
Math.abs(start.coords[1] - stop.coords[1]) > 100 &&
|
||||
Math.abs(start.coords[0] - stop.coords[0]) < 75) {
|
||||
start.origin
|
||||
.trigger("swipeupdown")
|
||||
.trigger(start.coords[1] > stop.coords[1] ? "swipeup" : "swipedown");
|
||||
}
|
||||
}
|
||||
start = stop = undefined;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
$.each({
|
||||
swipedown: "swipeupdown",
|
||||
swipeup: "swipeupdown"
|
||||
}, function (event, sourceEvent) {
|
||||
$.event.special[event] = {
|
||||
setup: function () {
|
||||
$(this).bind(sourceEvent, $.noop);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
// This only exists because the polymer elements get distorted when using regular jquery show/hide
|
||||
$.fn.visible = function (visible) {
|
||||
|
||||
if (visible) {
|
||||
return this.removeClass('hide');
|
||||
}
|
||||
return this.addClass('hide');
|
||||
};
|
||||
}
|
|
@ -93,12 +93,53 @@
|
|||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoLevel',
|
||||
Value: '41'
|
||||
Value: '50'
|
||||
}]
|
||||
});
|
||||
|
||||
// Subtitle profiles
|
||||
profile.SubtitleProfiles = [];
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'srt',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'subrip',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'ass',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'ssa',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'pgs',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'pgssub',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'dvdsub',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'vtt',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'sub',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'idx',
|
||||
Method: 'Embed'
|
||||
});
|
||||
|
||||
profile.ResponseProfiles = [];
|
||||
|
||||
return profile;
|
||||
|
@ -126,7 +167,7 @@
|
|||
|
||||
function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, deferred) {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
currentItem = item;
|
||||
currentMediaSource = mediaSource;
|
||||
|
@ -137,7 +178,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
MediaPlayer.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
||||
MediaPlayer.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
||||
|
||||
var currentSrc = streamInfo.url;
|
||||
|
||||
|
@ -394,9 +435,9 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, itemId).done(function (item) {
|
||||
ApiClient.getItem(userId, itemId).then(function (item) {
|
||||
|
||||
getVideoStreamInfo(item).done(function (streamInfo) {
|
||||
getVideoStreamInfo(item).then(function (streamInfo) {
|
||||
|
||||
setTimeout(function () {
|
||||
ExternalPlayer.showPlayerSelectionMenu(item, streamInfo.url, streamInfo.mimeType);
|
||||
|
@ -419,7 +460,7 @@
|
|||
|
||||
function showPlayerSelectionMenu(item, url, mimeType) {
|
||||
|
||||
ExternalPlayer.getExternalPlayers(url, mimeType).done(function (players) {
|
||||
ExternalPlayer.getExternalPlayers(url, mimeType).then(function (players) {
|
||||
showMenuForItem(item, players);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function ($, document) {
|
||||
|
||||
function enableScrollX() {
|
||||
return $.browser.mobile && AppInfo.enableAppLayouts;
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
||||
}
|
||||
|
||||
function getThumbShape() {
|
||||
|
@ -23,11 +23,13 @@
|
|||
{ name: 'HeaderFavoriteShows', types: "Series", id: "favoriteShows", shape: getPosterShape(), showTitle: false },
|
||||
{ name: 'HeaderFavoriteEpisodes', types: "Episode", id: "favoriteEpisode", shape: getThumbShape(), preferThumb: false, showTitle: true, showParentTitle: true },
|
||||
{ name: 'HeaderFavoriteGames', types: "Game", id: "favoriteGames", shape: getSquareShape(), preferThumb: false, showTitle: true },
|
||||
{ name: 'HeaderFavoriteAlbums', types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayPlayButton: true }
|
||||
{ name: 'HeaderFavoriteArtists', types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'play' },
|
||||
{ name: 'HeaderFavoriteAlbums', types: "MusicAlbum", id: "favoriteAlbums", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'play' },
|
||||
{ name: 'HeaderFavoriteSongs', types: "Audio", id: "favoriteSongs", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'instantmix' }
|
||||
];
|
||||
}
|
||||
|
||||
function loadSection(elem, userId, section, isSingleSection) {
|
||||
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
||||
|
@ -35,20 +37,35 @@
|
|||
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: section.types,
|
||||
Filters: "IsFavorite",
|
||||
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6),
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SyncInfo",
|
||||
CollapseBoxSetItems: false,
|
||||
ExcludeLocationTypes: "Virtual"
|
||||
};
|
||||
|
||||
if (isSingleSection) {
|
||||
options.Limit = null;
|
||||
if (topParentId) {
|
||||
options.ParentId = topParentId;
|
||||
}
|
||||
|
||||
return ApiClient.getItems(userId, options).done(function (result) {
|
||||
if (!isSingleSection) {
|
||||
options.Limit = screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : 6);
|
||||
|
||||
if (enableScrollX()) {
|
||||
options.Limit = 12;
|
||||
}
|
||||
}
|
||||
|
||||
var promise;
|
||||
if (section.types == 'MusicArtist') {
|
||||
promise = ApiClient.getArtists(userId, options);
|
||||
} else {
|
||||
|
||||
options.IncludeItemTypes = section.types;
|
||||
promise = ApiClient.getItems(userId, options);
|
||||
}
|
||||
|
||||
return promise.then(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
@ -82,7 +99,9 @@
|
|||
showDetailsMenu: true,
|
||||
centerText: section.centerText,
|
||||
overlayPlayButton: section.overlayPlayButton,
|
||||
context: 'home-favorites'
|
||||
overlayMoreButton: section.overlayMoreButton,
|
||||
context: 'home-favorites',
|
||||
defaultAction: section.defaultAction
|
||||
});
|
||||
|
||||
html += '</div>';
|
||||
|
@ -94,7 +113,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function loadSections(page, userId) {
|
||||
function loadSections(page, userId, topParentId, types) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -109,9 +128,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (types) {
|
||||
sections = sections.filter(function (s) {
|
||||
|
||||
return types.indexOf(s.id) != -1;
|
||||
});
|
||||
}
|
||||
|
||||
var i, length;
|
||||
|
||||
var elem = page.querySelector('.sections');
|
||||
var elem = page.querySelector('.favoriteSections');
|
||||
|
||||
if (!elem.innerHTML) {
|
||||
var html = '';
|
||||
|
@ -131,10 +157,10 @@
|
|||
|
||||
elem = page.querySelector('.section' + section.id);
|
||||
|
||||
promises.push(loadSection(elem, userId, section, sections.length == 1));
|
||||
promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1));
|
||||
}
|
||||
|
||||
$.when(promises).done(function () {
|
||||
Promise.all(promises).then(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
LibraryBrowser.setLastRefreshed(page);
|
||||
|
@ -143,16 +169,20 @@
|
|||
|
||||
function initHomePage() {
|
||||
|
||||
window.HomePage.renderFavorites = function (page, tabContent) {
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
loadSections(tabContent, Dashboard.getCurrentUserId());
|
||||
}
|
||||
};
|
||||
if (window.HomePage) {
|
||||
window.HomePage.renderFavorites = function (page, tabContent) {
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
loadSections(tabContent, Dashboard.getCurrentUserId());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
initHomePage();
|
||||
|
||||
pageIdOn('pageshow', "favoritesPage", function () {
|
||||
pageIdOn('pageinit', "indexPage", initHomePage);
|
||||
|
||||
pageIdOn('pagebeforeshow', "favoritesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -161,4 +191,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
window.FavoriteItems = {
|
||||
render: loadSections
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -53,7 +53,7 @@
|
|||
EnteredUsername: $('#txtName', page).val()
|
||||
}
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
processForgotPasswordResult(page, result);
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
Pin: $('#txtPin', page).val()
|
||||
}
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
processForgotPasswordResult(page, result);
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getGameGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getGameGenres(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -254,7 +254,7 @@
|
|||
LibraryBrowser.loadSavedQueryValues(viewkey, query);
|
||||
QueryFilters.onPageShow(page, query);
|
||||
|
||||
LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) {
|
||||
LibraryBrowser.getSavedViewSetting(viewkey).then(function (val) {
|
||||
|
||||
if (val) {
|
||||
$('#selectView', page).val(val).trigger('change');
|
||||
|
|
|
@ -17,16 +17,18 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||
|
||||
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
var recentlyAddedItems = page.querySelector('#recentlyAddedItems');
|
||||
recentlyAddedItems.innerHTML = LibraryBrowser.getPosterViewHtml({
|
||||
items: items,
|
||||
transparent: true,
|
||||
borderless: true,
|
||||
shape: 'auto',
|
||||
lazy: true
|
||||
|
||||
})).lazyChildren();
|
||||
});
|
||||
ImageLoader.lazyChildren(recentlyAddedItems);
|
||||
|
||||
});
|
||||
|
||||
|
@ -44,7 +46,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getItems(userId, options).done(function (result) {
|
||||
ApiClient.getItems(userId, options).then(function (result) {
|
||||
|
||||
if (result.Items.length) {
|
||||
$('#recentlyPlayedSection', page).show();
|
||||
|
@ -52,15 +54,16 @@
|
|||
$('#recentlyPlayedSection', page).hide();
|
||||
}
|
||||
|
||||
$('#recentlyPlayedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
var recentlyPlayedItems = page.querySelector('#recentlyPlayedItems');
|
||||
recentlyPlayedItems.innerHTML = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
transparent: true,
|
||||
borderless: true,
|
||||
shape: 'auto',
|
||||
lazy: true
|
||||
|
||||
})).lazyChildren();
|
||||
|
||||
});
|
||||
ImageLoader.lazyChildren(recentlyPlayedItems);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -19,43 +19,65 @@
|
|||
|
||||
function loadDictionary(name, culture) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (getDictionary(name, culture)) {
|
||||
deferred.resolve();
|
||||
} else {
|
||||
if (getDictionary(name, culture)) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
var url = getUrl(name, culture);
|
||||
var requestUrl = url + "?v=" + window.dashboardVersion;
|
||||
|
||||
$.getJSON(requestUrl).done(function (dictionary) {
|
||||
var requestUrl = url + "?v=" + AppInfo.appVersion;
|
||||
|
||||
dictionaries[url] = dictionary;
|
||||
deferred.resolve();
|
||||
Logger.log('Requesting ' + requestUrl);
|
||||
|
||||
}).fail(function () {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', requestUrl, true);
|
||||
|
||||
// If there's no dictionary for that language, grab English
|
||||
$.getJSON(getUrl(name, 'en-US')).done(function (dictionary) {
|
||||
var onError = function () {
|
||||
|
||||
dictionaries[url] = dictionary;
|
||||
deferred.resolve();
|
||||
Logger.log('Dictionary not found. Reverting to english');
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
// Grab the english version
|
||||
var xhr2 = new XMLHttpRequest();
|
||||
xhr2.open('GET', getUrl(name, 'en-US'), true);
|
||||
|
||||
return deferred.promise();
|
||||
xhr2.onload = function (e) {
|
||||
dictionaries[url] = JSON.parse(this.response);
|
||||
resolve();
|
||||
};
|
||||
|
||||
xhr2.send();
|
||||
};
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
||||
Logger.log('Globalize response status: ' + this.status);
|
||||
|
||||
if (this.status < 400) {
|
||||
|
||||
dictionaries[url] = JSON.parse(this.response);
|
||||
resolve();
|
||||
|
||||
} else {
|
||||
onError();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = onError;
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
var currentCulture = 'en-US';
|
||||
function setCulture(value) {
|
||||
|
||||
Logger.log('Setting culture to ' + value);
|
||||
|
||||
currentCulture = value;
|
||||
|
||||
return $.when(loadDictionary('html', value), loadDictionary('javascript', value));
|
||||
return Promise.all([loadDictionary('html', value), loadDictionary('javascript', value)]);
|
||||
}
|
||||
|
||||
function normalizeLocaleName(culture) {
|
||||
|
@ -74,43 +96,25 @@
|
|||
}
|
||||
|
||||
function getDeviceCulture() {
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
var culture;
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (navigator.globalization && navigator.globalization.getLocaleName) {
|
||||
if (AppInfo.isNativeApp) {
|
||||
|
||||
Logger.log('Calling navigator.globalization.getLocaleName');
|
||||
resolve(navigator.language || navigator.userLanguage);
|
||||
|
||||
navigator.globalization.getLocaleName(function (locale) {
|
||||
} else if (AppInfo.supportsUserDisplayLanguageSetting) {
|
||||
|
||||
culture = normalizeLocaleName(locale.value || '');
|
||||
Logger.log('Device culture is ' + culture);
|
||||
deferred.resolveWith(null, [culture]);
|
||||
Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true');
|
||||
|
||||
}, function () {
|
||||
resolve(AppSettings.displayLanguage());
|
||||
|
||||
Logger.log('navigator.globalization.getLocaleName failed');
|
||||
} else {
|
||||
|
||||
deferred.resolveWith(null, [null]);
|
||||
});
|
||||
|
||||
} else if (AppInfo.supportsUserDisplayLanguageSetting) {
|
||||
|
||||
Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true');
|
||||
|
||||
culture = AppSettings.displayLanguage();
|
||||
deferred.resolveWith(null, [culture]);
|
||||
|
||||
} else {
|
||||
|
||||
Logger.log('Getting culture from document');
|
||||
|
||||
culture = document.documentElement.getAttribute('data-culture');
|
||||
deferred.resolveWith(null, [culture]);
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
Logger.log('Getting culture from document');
|
||||
resolve(document.documentElement.getAttribute('data-culture'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,20 +122,12 @@
|
|||
|
||||
Logger.log('Entering Globalize.ensure');
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return getDeviceCulture().then(function (culture) {
|
||||
|
||||
getDeviceCulture().done(function (culture) {
|
||||
culture = normalizeLocaleName(culture || 'en-US');
|
||||
|
||||
if (!culture) {
|
||||
culture = 'en-US';
|
||||
}
|
||||
|
||||
setCulture(culture).done(function () {
|
||||
deferred.resolve();
|
||||
});
|
||||
return setCulture(culture);
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function translateDocument(html, dictionaryName) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getNextUpEpisodes(query).done(function (result) {
|
||||
ApiClient.getNextUpEpisodes(query).then(function (result) {
|
||||
|
||||
if (result.Items.length) {
|
||||
page.querySelector('.noNextUpItems').classList.add('hide');
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
function loadUpcoming(page) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var limit = AppInfo.hasLowImageBandwidth ?
|
||||
var limit = AppInfo.hasLowImageBandwidth && !enableScrollX() ?
|
||||
24 :
|
||||
40;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
|
||||
|
||||
var items = result.Items;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return $.browser.mobile && AppInfo.enableAppLayouts;
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
||||
}
|
||||
|
||||
function getThumbShape() {
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
// Appending #t=xxx to the query string doesn't seem to work with HLS
|
||||
if (startPositionInSeekParam && src.indexOf('.m3u8') != -1) {
|
||||
|
||||
var delay = $.browser.safari ? 2500 : 0;
|
||||
var delay = browserInfo.safari ? 2500 : 0;
|
||||
var element = this;
|
||||
if (delay) {
|
||||
setTimeout(function () {
|
||||
|
@ -160,9 +160,9 @@
|
|||
var requiresControls = !MediaPlayer.canAutoPlayAudio();
|
||||
|
||||
if (requiresControls) {
|
||||
html += '<div class="mediaPlayerAudioContainer"><div class="mediaPlayerAudioContainerInner">';;
|
||||
html += '<div class="mediaPlayerAudioContainer" style="position: fixed;top: 40%;text-align: center;left: 0;right: 0;"><div class="mediaPlayerAudioContainerInner">';;
|
||||
} else {
|
||||
html += '<div class="mediaPlayerAudioContainer" style="display:none;"><div class="mediaPlayerAudioContainerInner">';;
|
||||
html += '<div class="mediaPlayerAudioContainer" style="display:none;padding: 1em;background: #222;"><div class="mediaPlayerAudioContainerInner">';;
|
||||
}
|
||||
|
||||
html += '<audio class="mediaPlayerAudio" crossorigin="anonymous" controls>';
|
||||
|
@ -202,10 +202,10 @@
|
|||
var requiresNativeControls = !self.enableCustomVideoControls();
|
||||
|
||||
// Safari often displays the poster under the video and it doesn't look good
|
||||
var poster = !$.browser.safari && options.poster ? (' poster="' + options.poster + '"') : '';
|
||||
var poster = !browserInfo.safari && options.poster ? (' poster="' + options.poster + '"') : '';
|
||||
|
||||
// Can't autoplay in these browsers so we need to use the full controls
|
||||
if (requiresNativeControls && AppInfo.isNativeApp && $.browser.android) {
|
||||
if (requiresNativeControls && AppInfo.isNativeApp && browserInfo.android) {
|
||||
html += '<video class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous"' + poster + ' webkit-playsinline>';
|
||||
}
|
||||
else if (requiresNativeControls) {
|
||||
|
@ -219,7 +219,7 @@
|
|||
|
||||
html += '</video>';
|
||||
|
||||
var elem = $('#videoElement', '#mediaPlayer').prepend(html);
|
||||
var elem = $('#videoElement', '#videoPlayer').prepend(html);
|
||||
|
||||
return $('.itemVideo', elem)
|
||||
.one('.loadedmetadata', onLoadedMetadata)
|
||||
|
@ -321,7 +321,7 @@
|
|||
elem.src = "";
|
||||
|
||||
// When the browser regains focus it may start auto-playing the last video
|
||||
if ($.browser.safari) {
|
||||
if (browserInfo.safari) {
|
||||
elem.src = 'files/dummy.mp4';
|
||||
elem.play();
|
||||
}
|
||||
|
@ -331,7 +331,7 @@
|
|||
|
||||
var val = streamInfo.url;
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.safari) {
|
||||
if (AppInfo.isNativeApp && browserInfo.safari) {
|
||||
val = val.replace('file://', '');
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@
|
|||
|
||||
var hls = new Hls();
|
||||
hls.loadSource(val);
|
||||
hls.attachVideo(elem);
|
||||
hls.attachMedia(elem);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
elem.play();
|
||||
});
|
||||
|
@ -558,7 +558,7 @@
|
|||
|
||||
self.enableCustomVideoControls = function () {
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.safari) {
|
||||
if (AppInfo.isNativeApp && browserInfo.safari) {
|
||||
|
||||
if (navigator.userAgent.toLowerCase().indexOf('iphone') != -1) {
|
||||
return true;
|
||||
|
@ -568,7 +568,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
return self.canAutoPlayVideo() && !$.browser.mobile;
|
||||
return self.canAutoPlayVideo() && !browserInfo.mobile;
|
||||
};
|
||||
|
||||
self.canAutoPlayVideo = function () {
|
||||
|
@ -577,7 +577,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($.browser.mobile) {
|
||||
if (browserInfo.mobile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -586,20 +586,16 @@
|
|||
|
||||
self.init = function () {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (options.type == 'video' && enableHlsPlayer()) {
|
||||
if (options.type == 'video' && enableHlsPlayer()) {
|
||||
|
||||
requireHlsPlayer(function () {
|
||||
requireHlsPlayer(resolve);
|
||||
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
} else {
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (options.type == 'audio') {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
function getDefaultSection(index) {
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.safari) {
|
||||
if (AppInfo.isNativeApp && browserInfo.safari) {
|
||||
|
||||
switch (index) {
|
||||
|
||||
|
@ -125,7 +125,7 @@
|
|||
promises.push(loadSection(page, user, displayPreferences, i));
|
||||
}
|
||||
|
||||
return $.when(promises);
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
var homePageDismissValue = '14';
|
||||
|
@ -133,7 +133,7 @@
|
|||
|
||||
function dismissWelcome(page, userId) {
|
||||
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
getDisplayPreferences('home', userId).then(function (result) {
|
||||
|
||||
result.CustomPrefs[homePageTourKey] = homePageDismissValue;
|
||||
ApiClient.updateDisplayPreferences('home', result, userId, AppSettings.displayPreferencesKey());
|
||||
|
@ -165,7 +165,7 @@
|
|||
|
||||
function takeTour(page, userId) {
|
||||
|
||||
Dashboard.loadSwipebox().done(function () {
|
||||
require(['swipebox'], function () {
|
||||
|
||||
$.swipebox([
|
||||
{ href: 'css/images/tour/web/tourcontent.jpg', title: Globalize.translate('WebClientTourContent') },
|
||||
|
@ -201,11 +201,11 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
getDisplayPreferences('home', userId).then(function (result) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
loadSections(tabContent, user, result).done(function () {
|
||||
loadSections(tabContent, user, result).then(function () {
|
||||
|
||||
if (!AppInfo.isNativeApp) {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
|
@ -266,11 +266,11 @@
|
|||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'index.html');
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
Events.on(page.querySelector('.btnTakeTour'), 'click', function () {
|
||||
page.querySelector('.btnTakeTour').addEventListener('click', function () {
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
|
@ -301,15 +301,13 @@
|
|||
var page = $($.mobile.activePage)[0];
|
||||
var pages = page.querySelector('neon-animated-pages');
|
||||
|
||||
$(pages).trigger('tabchange');
|
||||
pages.dispatchEvent(new CustomEvent("tabchange", {}));
|
||||
}
|
||||
}
|
||||
|
||||
function getDisplayPreferences(key, userId) {
|
||||
|
||||
return ApiClient.getDisplayPreferences(key, userId, AppSettings.displayPreferencesKey()).done(function (result) {
|
||||
|
||||
});
|
||||
return ApiClient.getDisplayPreferences(key, userId, AppSettings.displayPreferencesKey());
|
||||
}
|
||||
|
||||
window.HomePage = {
|
||||
|
|
|
@ -233,7 +233,7 @@
|
|||
|
||||
query = getQuery(query, item);
|
||||
|
||||
getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).done(function (result) {
|
||||
getItemsFunction(query, item)(query.StartIndex, query.Limit, query.Fields).then(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
getPromise().done(function (item) {
|
||||
getPromise().then(function (item) {
|
||||
|
||||
reloadFromItem(page, item);
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -61,7 +61,7 @@
|
|||
LibraryBrowser.renderParentName(item, $('.parentName', page), context);
|
||||
LibraryMenu.setTitle(item.SeriesName || item.Name);
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
renderImage(page, item, user);
|
||||
|
||||
|
@ -157,7 +157,11 @@
|
|||
$('.splitVersionContainer', page).hide();
|
||||
}
|
||||
|
||||
$('.btnMoreCommands', page).visible(LibraryBrowser.getMoreCommands(item, user).length > 0);
|
||||
if (LibraryBrowser.getMoreCommands(item, user).length > 0) {
|
||||
$('.btnMoreCommands', page).removeClass('hide');
|
||||
} else {
|
||||
$('.btnMoreCommands', page).addClass('hide');
|
||||
}
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
$('.chapterSettingsButton', page).show();
|
||||
|
@ -198,7 +202,7 @@
|
|||
|
||||
var gmap = '<a class="textlink" target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>';
|
||||
|
||||
$('#itemBirthLocation', page).show().html(Globalize.translate('BirthPlaceValue').replace('{0}', gmap)).trigger('create');
|
||||
$('#itemBirthLocation', page).show().html(Globalize.translate('BirthPlaceValue').replace('{0}', gmap));
|
||||
} else {
|
||||
$('#itemBirthLocation', page).hide();
|
||||
}
|
||||
|
@ -234,11 +238,13 @@
|
|||
|
||||
setPeopleHeader(page, item);
|
||||
|
||||
$(page).trigger('displayingitem', [{
|
||||
|
||||
item: item,
|
||||
context: context
|
||||
}]);
|
||||
page.dispatchEvent(new CustomEvent("displayingitem", {
|
||||
detail: {
|
||||
item: item,
|
||||
context: context
|
||||
},
|
||||
bubbles: true
|
||||
}));
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
@ -273,7 +279,7 @@
|
|||
|
||||
currentItem.UserData = userData;
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
refreshImage(page, currentItem, user);
|
||||
});
|
||||
|
@ -391,7 +397,12 @@
|
|||
}
|
||||
|
||||
renderThemeMedia(page, item, user);
|
||||
renderCriticReviews(page, item, 1);
|
||||
|
||||
if (enableScrollX()) {
|
||||
renderCriticReviews(page, item);
|
||||
} else {
|
||||
renderCriticReviews(page, item, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function renderDetails(page, item, context, isStatic) {
|
||||
|
@ -410,7 +421,7 @@
|
|||
|
||||
var seasonOnBottom = screen.availHeight < 800 || screen.availWidth < 600;
|
||||
|
||||
if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom) || (item.Type == 'Series' && seasonOnBottom)) {
|
||||
if (item.Type == 'MusicAlbum' || item.Type == 'MusicArtist' || (item.Type == 'Season' && seasonOnBottom)) {
|
||||
LibraryBrowser.renderOverview([bottomOverview], item);
|
||||
topOverview.classList.add('hide');
|
||||
bottomOverview.classList.remove('hide');
|
||||
|
@ -452,7 +463,7 @@
|
|||
}
|
||||
|
||||
if (item.ArtistItems && item.ArtistItems.length && item.Type != "MusicAlbum") {
|
||||
$('.artist', page).show().html(getArtistLinksHtml(item.ArtistItems, context)).trigger('create');
|
||||
$('.artist', page).show().html(getArtistLinksHtml(item.ArtistItems, context));
|
||||
} else {
|
||||
$('.artist', page).hide();
|
||||
}
|
||||
|
@ -532,7 +543,7 @@
|
|||
|
||||
html += attributes.join('<br/>');
|
||||
|
||||
$('.photoInfoContent', page).html(html).trigger('create');
|
||||
$('.photoInfoContent', page).html(html);
|
||||
}
|
||||
|
||||
function renderTabButtons(page, item) {
|
||||
|
@ -611,7 +622,7 @@
|
|||
|
||||
context = context || '';
|
||||
|
||||
promise.done(function (result) {
|
||||
promise.then(function (result) {
|
||||
|
||||
var foundExisting = false;
|
||||
|
||||
|
@ -635,7 +646,7 @@
|
|||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return $.browser.mobile && AppInfo.enableAppLayouts;
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts && screen.availWidth <= 1000;
|
||||
}
|
||||
|
||||
function getPortraitShape() {
|
||||
|
@ -678,7 +689,7 @@
|
|||
options.limit = 12;
|
||||
}
|
||||
|
||||
ApiClient.getSimilarItems(item.Id, options).done(function (result) {
|
||||
ApiClient.getSimilarItems(item.Id, options).then(function (result) {
|
||||
|
||||
if (!result.Items.length) {
|
||||
|
||||
|
@ -716,6 +727,14 @@
|
|||
});
|
||||
}
|
||||
|
||||
$.fn.lazyChildren = function () {
|
||||
|
||||
for (var i = 0, length = this.length; i < length; i++) {
|
||||
ImageLoader.lazyChildren(this[i]);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function renderSeriesAirTime(page, item, isStatic) {
|
||||
|
||||
if (item.Type != "Series") {
|
||||
|
@ -748,7 +767,7 @@
|
|||
if (html) {
|
||||
html = (item.Status == 'Ended' ? 'Aired ' : 'Airs ') + html;
|
||||
|
||||
$('#seriesAirTime', page).show().html(html).trigger('create');
|
||||
$('#seriesAirTime', page).show().html(html);
|
||||
} else {
|
||||
$('#seriesAirTime', page).hide();
|
||||
}
|
||||
|
@ -855,10 +874,12 @@
|
|||
|
||||
promise = promise || ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
|
||||
promise.done(function (result) {
|
||||
promise.then(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var scrollX = false;
|
||||
|
||||
if (item.Type == "MusicAlbum") {
|
||||
|
||||
html = LibraryBrowser.getListViewHtml({
|
||||
|
@ -874,12 +895,14 @@
|
|||
|
||||
}
|
||||
else if (item.Type == "Series") {
|
||||
|
||||
scrollX = enableScrollX();
|
||||
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "detailPagePortrait",
|
||||
showTitle: false,
|
||||
shape: getPortraitShape(),
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
context: context,
|
||||
lazy: true
|
||||
});
|
||||
}
|
||||
|
@ -893,7 +916,7 @@
|
|||
overlayText: true,
|
||||
lazy: true,
|
||||
showDetailsMenu: true,
|
||||
overlayPlayButton: AppInfo.enableAppLayouts
|
||||
overlayMoreButton: AppInfo.enableAppLayouts
|
||||
});
|
||||
}
|
||||
else if (item.Type == "GameSystem") {
|
||||
|
@ -911,6 +934,14 @@
|
|||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
|
||||
if (scrollX) {
|
||||
elem.classList.add('hiddenScrollX');
|
||||
} else {
|
||||
elem.classList.remove('hiddenScrollX');
|
||||
}
|
||||
|
||||
$(elem).createCardMenus();
|
||||
|
||||
if (item.Type == "BoxSet") {
|
||||
|
||||
var collectionItemTypes = [
|
||||
|
@ -1072,7 +1103,7 @@
|
|||
type: "DELETE",
|
||||
url: url
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
renderChildren(page, parentItem, user, context);
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
@ -1097,7 +1128,7 @@
|
|||
options.limit = limit;
|
||||
}
|
||||
|
||||
ApiClient.getCriticReviews(item.Id, options).done(function (result) {
|
||||
ApiClient.getCriticReviews(item.Id, options).then(function (result) {
|
||||
|
||||
if (result.TotalRecordCount || item.CriticRatingSummary || item.AwardSummary) {
|
||||
$('#criticReviewsCollapsible', page).show();
|
||||
|
@ -1114,14 +1145,11 @@
|
|||
|
||||
var reviews = result.Items;
|
||||
|
||||
if (reviews.length) {
|
||||
html += '<div class="paperList">';
|
||||
}
|
||||
|
||||
for (var i = 0, length = reviews.length; i < length; i++) {
|
||||
|
||||
var review = reviews[i];
|
||||
|
||||
html += '<div class="paperList criticReviewPaperList">';
|
||||
html += '<paper-icon-item style="padding-top:.5em;padding-bottom:.5em;">';
|
||||
|
||||
if (review.Score != null) {
|
||||
|
@ -1172,8 +1200,6 @@
|
|||
html += '</paper-item-body>';
|
||||
|
||||
html += '</paper-icon-item>';
|
||||
}
|
||||
if (reviews.length) {
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
|
@ -1183,11 +1209,17 @@
|
|||
|
||||
var criticReviewsContent = page.querySelector('#criticReviewsContent');
|
||||
criticReviewsContent.innerHTML = html;
|
||||
|
||||
if (enableScrollX()) {
|
||||
criticReviewsContent.classList.add('hiddenScrollX');
|
||||
} else {
|
||||
criticReviewsContent.classList.remove('hiddenScrollX');
|
||||
}
|
||||
}
|
||||
|
||||
function renderThemeMedia(page, item) {
|
||||
|
||||
ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).done(function (result) {
|
||||
ApiClient.getThemeMedia(Dashboard.getCurrentUserId(), item.Id, true).then(function (result) {
|
||||
|
||||
var themeSongs = result.ThemeSongsResult.OwnerId == item.Id ?
|
||||
result.ThemeSongsResult.Items :
|
||||
|
@ -1200,7 +1232,13 @@
|
|||
renderThemeSongs(page, themeSongs);
|
||||
renderThemeVideos(page, themeVideos);
|
||||
|
||||
$(page).trigger('thememediadownload', [result]);
|
||||
page.dispatchEvent(new CustomEvent("thememediadownload", {
|
||||
detail: {
|
||||
themeMediaResult: result
|
||||
},
|
||||
bubbles: true
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -1245,7 +1283,7 @@
|
|||
Fields: "DateCreated,SyncInfo",
|
||||
Albums: item.Name
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
if (result.Items.length) {
|
||||
|
||||
$('#musicVideosCollapsible', page).show();
|
||||
|
@ -1260,7 +1298,7 @@
|
|||
|
||||
function renderAdditionalParts(page, item, user) {
|
||||
|
||||
ApiClient.getAdditionalVideoParts(user.Id, item.Id).done(function (result) {
|
||||
ApiClient.getAdditionalVideoParts(user.Id, item.Id).then(function (result) {
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
|
@ -1298,7 +1336,7 @@
|
|||
|
||||
var onclick = item.PlayAccess == 'Full' && !isStatic ? ' onclick="ItemDetailPage.play(' + chapter.StartPositionTicks + ');"' : '';
|
||||
|
||||
html += '<a class="card '+getThumbShape()+'Card" href="#play-Chapter-' + i + '"' + onclick + '>';
|
||||
html += '<a class="card ' + getThumbShape() + 'Card" href="#play-Chapter-' + i + '"' + onclick + '>';
|
||||
|
||||
html += '<div class="cardBox">';
|
||||
html += '<div class="cardScalable">';
|
||||
|
@ -1402,6 +1440,10 @@
|
|||
attributes.push(createAttribute(Globalize.translate('MediaInfoCodec'), stream.Codec.toUpperCase()));
|
||||
}
|
||||
|
||||
if (stream.CodecTag) {
|
||||
attributes.push(createAttribute(Globalize.translate('MediaInfoCodecTag'), stream.CodecTag));
|
||||
}
|
||||
|
||||
if (stream.Profile) {
|
||||
attributes.push(createAttribute(Globalize.translate('MediaInfoProfile'), stream.Profile));
|
||||
}
|
||||
|
@ -1589,7 +1631,7 @@
|
|||
|
||||
function renderSpecials(page, item, user, limit) {
|
||||
|
||||
ApiClient.getSpecialFeatures(user.Id, item.Id).done(function (specials) {
|
||||
ApiClient.getSpecialFeatures(user.Id, item.Id).then(function (specials) {
|
||||
|
||||
var specialsContent = page.querySelector('#specialsContent');
|
||||
specialsContent.innerHTML = getVideosHtml(specials, user, limit, "moreSpecials");
|
||||
|
@ -1625,7 +1667,7 @@
|
|||
if (cast.PrimaryImageTag) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(cast.Id, {
|
||||
width: 100,
|
||||
maxWidth: 100,
|
||||
tag: cast.PrimaryImageTag,
|
||||
type: "primary",
|
||||
minScale: 2
|
||||
|
@ -1694,6 +1736,10 @@
|
|||
return c.PrimaryImageTag;
|
||||
});
|
||||
|
||||
if (!casts.length) {
|
||||
casts = item.People || [];
|
||||
}
|
||||
|
||||
for (var i = 0, length = casts.length; i < length; i++) {
|
||||
|
||||
var cast = casts[i];
|
||||
|
@ -1710,7 +1756,7 @@
|
|||
if (cast.PrimaryImageTag) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(cast.Id, {
|
||||
width: 100,
|
||||
maxWidth: 100,
|
||||
tag: cast.PrimaryImageTag,
|
||||
type: "primary",
|
||||
minScale: 2
|
||||
|
@ -1728,7 +1774,7 @@
|
|||
if (lazy) {
|
||||
html += '<div class="cardImage coveredCardImage lazy" data-src="' + imgUrl + '"></div>';
|
||||
} else {
|
||||
html += '<div class="cardImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
|
||||
html += '<div class="cardImage coveredCardImage" style="background-image:url(\'' + imgUrl + '\');"></div>';
|
||||
}
|
||||
|
||||
//cardFooter
|
||||
|
@ -1846,7 +1892,7 @@
|
|||
type: "DELETE",
|
||||
url: ApiClient.getUrl("Videos/" + id + "/AlternateSources")
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -1858,7 +1904,7 @@
|
|||
|
||||
function playTrailer(page) {
|
||||
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).done(function (trailers) {
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), currentItem.Id).then(function (trailers) {
|
||||
|
||||
MediaController.play({ items: trailers });
|
||||
|
||||
|
@ -1880,7 +1926,7 @@
|
|||
|
||||
if (currentItem.Type == 'Program') {
|
||||
|
||||
ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).done(function (channel) {
|
||||
ApiClient.getLiveTvChannel(currentItem.ChannelId, Dashboard.getCurrentUserId()).then(function (channel) {
|
||||
|
||||
LibraryBrowser.showPlayMenu(null, channel.Id, channel.Type, false, channel.MediaType, (channel.UserData || {}).PlaybackPositionTicks);
|
||||
});
|
||||
|
@ -1907,7 +1953,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
||||
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||
|
||||
|
@ -1918,7 +1964,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#itemDetailPage", function () {
|
||||
pageIdOn('pageinit', "itemDetailPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1959,7 +2005,7 @@
|
|||
|
||||
var button = this;
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
|
||||
});
|
||||
|
@ -1977,7 +2023,7 @@
|
|||
|
||||
$(page).on("click", ".moreScenes", function () {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
renderScenes(page, currentItem, user);
|
||||
});
|
||||
|
||||
|
@ -1987,7 +2033,7 @@
|
|||
|
||||
}).on("click", ".moreSpecials", function () {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
renderSpecials(page, currentItem, user);
|
||||
});
|
||||
|
||||
|
@ -2001,7 +2047,9 @@
|
|||
// btnMore[i].icon = AppInfo.moreIcon;
|
||||
//}
|
||||
|
||||
}).on('pagebeforeshow', "#itemDetailPage", function () {
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforeshow', "itemDetailPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -2011,7 +2059,10 @@
|
|||
|
||||
Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted);
|
||||
|
||||
}).on('pagebeforehide', "#itemDetailPage", function () {
|
||||
});
|
||||
|
||||
|
||||
pageIdOn('pagebeforehide', "itemDetailPage", function () {
|
||||
|
||||
Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted);
|
||||
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
|
||||
var itemsPromise = ApiClient.getItems(userId, query);
|
||||
|
||||
$.when(parentItemPromise, itemsPromise).done(function (r1, r2) {
|
||||
Promise.all([parentItemPromise, itemsPromise]).then(function (responses) {
|
||||
|
||||
var item = r1[0];
|
||||
var item = responses[0];
|
||||
currentItem = item;
|
||||
var result = r2[0];
|
||||
var result = responses[1];
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -75,7 +75,7 @@
|
|||
currentLayout: view,
|
||||
viewIcon: 'filter-list',
|
||||
sortButton: true,
|
||||
layouts: 'Poster,PosterCard'
|
||||
layouts: 'Poster,PosterCard,Thumb'
|
||||
});
|
||||
|
||||
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
|
||||
|
@ -88,7 +88,8 @@
|
|||
items: result.Items,
|
||||
shape: "auto",
|
||||
centerText: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
coverImage: item.Type == 'PhotoAlbum'
|
||||
};
|
||||
|
||||
if (view == "Backdrop") {
|
||||
|
@ -195,10 +196,12 @@
|
|||
|
||||
LibraryMenu.setTitle(name);
|
||||
|
||||
$(page).trigger('displayingitem', [{
|
||||
|
||||
item: item
|
||||
}]);
|
||||
page.dispatchEvent(new CustomEvent("displayingitem", {
|
||||
detail: {
|
||||
item: item
|
||||
},
|
||||
bubbles: true
|
||||
}));
|
||||
|
||||
LibraryBrowser.setLastRefreshed(page);
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
@ -235,7 +238,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#itemListPage", function () {
|
||||
pageIdOn('pageinit', "itemListPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -275,7 +278,9 @@
|
|||
|
||||
$(page).on('click', '.mediaItem', onListItemClick);
|
||||
|
||||
}).on('pagebeforeshow', "#itemListPage", function () {
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforeshow', "itemListPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -283,7 +288,9 @@
|
|||
updateFilterControls(page);
|
||||
LibraryMenu.setBackButtonVisible(getParameterByName('context'));
|
||||
|
||||
}).on('pagebeforehide', "#itemListPage", function () {
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforehide', "itemListPage", function () {
|
||||
|
||||
currentItem = null;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
$('.itemsContainer', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
var LibraryBrowser = (function (window, document, $, screen) {
|
||||
var LibraryBrowser = (function (window, document, screen) {
|
||||
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
||||
// Match everything outside of normal chars and " (quote character)
|
||||
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
|
||||
|
||||
/**
|
||||
* Escapes all potentially dangerous characters, so that the
|
||||
* resulting string can be safely inserted into attribute or
|
||||
* element text.
|
||||
* @param value
|
||||
* @returns {string} escaped text
|
||||
*/
|
||||
function htmlEncode(value) {
|
||||
return value.
|
||||
replace(/&/g, '&').
|
||||
replace(SURROGATE_PAIR_REGEXP, function (value) {
|
||||
var hi = value.charCodeAt(0);
|
||||
var low = value.charCodeAt(1);
|
||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||
}).
|
||||
replace(NON_ALPHANUMERIC_REGEXP, function (value) {
|
||||
return '&#' + value.charCodeAt(0) + ';';
|
||||
}).
|
||||
replace(/</g, '<').
|
||||
replace(/>/g, '>');
|
||||
}
|
||||
|
||||
var pageSizeKey = 'pagesize_v4';
|
||||
|
||||
|
@ -21,13 +48,13 @@
|
|||
|
||||
getDefaultItemsView: function (view, mobileView) {
|
||||
|
||||
return $.browser.mobile ? mobileView : view;
|
||||
return browserInfo.mobile ? mobileView : view;
|
||||
|
||||
},
|
||||
|
||||
getSavedQueryKey: function (modifier) {
|
||||
|
||||
return getWindowUrl().split('#')[0] + (modifier || '');
|
||||
return window.location.href.split('#')[0] + (modifier || '');
|
||||
},
|
||||
|
||||
loadSavedQueryValues: function (key, query) {
|
||||
|
@ -105,10 +132,10 @@
|
|||
|
||||
if (AppInfo.isNativeApp) {
|
||||
cacheDuration = 300000;
|
||||
} else if ($.browser.ipad || $.browser.iphone || $.browser.android) {
|
||||
} else if (browserInfo.ipad || browserInfo.iphone || browserInfo.android) {
|
||||
cacheDuration = 10000;
|
||||
} else {
|
||||
cacheDuration = 60000;
|
||||
cacheDuration = 30000;
|
||||
}
|
||||
|
||||
if ((now - last) < cacheDuration) {
|
||||
|
@ -126,6 +153,11 @@
|
|||
},
|
||||
|
||||
enableFullPaperTabs: function () {
|
||||
|
||||
if (browserInfo.animate && !browserInfo.mobile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return AppInfo.isNativeApp;
|
||||
},
|
||||
|
||||
|
@ -135,17 +167,15 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($.browser.safari) {
|
||||
if (!browserInfo.animate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof ($.browser.androidVersion) == 'number' && !isNaN($.browser.androidVersion)) {
|
||||
if ($.browser.androidVersion < 5) {
|
||||
return false;
|
||||
}
|
||||
if (browserInfo.mobile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
},
|
||||
|
||||
allowSwipe: function (target) {
|
||||
|
@ -174,12 +204,45 @@
|
|||
return true;
|
||||
},
|
||||
|
||||
getTabsAnimationConfig: function (elem, reverse) {
|
||||
|
||||
if (browserInfo.mobile) {
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
// scale up
|
||||
'entry': {
|
||||
name: 'fade-in-animation',
|
||||
node: elem,
|
||||
timing: { duration: 160, easing: 'ease-out' }
|
||||
},
|
||||
// fade out
|
||||
'exit': {
|
||||
name: 'fade-out-animation',
|
||||
node: elem,
|
||||
timing: { duration: 200, easing: 'ease-out' }
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
|
||||
configureSwipeTabs: function (ownerpage, tabs, pages) {
|
||||
|
||||
if (LibraryBrowser.animatePaperTabs()) {
|
||||
// Safari doesn't handle the horizontal swiping very well
|
||||
pages.entryAnimation = 'slide-from-right-animation';
|
||||
pages.exitAnimation = 'slide-left-animation';
|
||||
if (browserInfo.mobile) {
|
||||
|
||||
require(['slide-left-animation', 'slide-from-right-animation'], function () {
|
||||
pages.entryAnimation = 'slide-from-right-animation';
|
||||
pages.exitAnimation = 'slide-left-animation';
|
||||
});
|
||||
} else {
|
||||
|
||||
require(['fade-in-animation', 'fade-out-animation'], function () {
|
||||
pages.entryAnimation = 'fade-in-animation';
|
||||
pages.exitAnimation = 'fade-out-animation';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var pageCount = pages.querySelectorAll('neon-animatable').length;
|
||||
|
@ -221,16 +284,16 @@
|
|||
return !LibraryBrowser.enableFullPaperTabs();
|
||||
},
|
||||
|
||||
configurePaperLibraryTabs: function (ownerpage, tabs, pages, baseUrl) {
|
||||
configurePaperLibraryTabs: function (ownerpage, tabs, pages) {
|
||||
|
||||
// Causing iron-select to not fire in IE and safari
|
||||
if ($.browser.chrome) {
|
||||
if (browserInfo.chrome) {
|
||||
tabs.noink = true;
|
||||
}
|
||||
|
||||
if (LibraryBrowser.enableFullPaperTabs()) {
|
||||
|
||||
if ($.browser.safari) {
|
||||
if (browserInfo.safari) {
|
||||
tabs.noSlide = true;
|
||||
tabs.noBar = true;
|
||||
} else {
|
||||
|
@ -246,9 +309,9 @@
|
|||
|
||||
var legacyTabs = $('.legacyTabs', ownerpage);
|
||||
|
||||
$(pages).on('iron-select', function (e) {
|
||||
pages.addEventListener('iron-select', function (e) {
|
||||
|
||||
var selected = this.selected;
|
||||
var selected = pages.selected;
|
||||
$('a', legacyTabs).removeClass('ui-btn-active')[selected].classList.add('ui-btn-active');
|
||||
});
|
||||
|
||||
|
@ -261,24 +324,25 @@
|
|||
// When transition animations are used, add a content loading delay to allow the animations to finish
|
||||
// Otherwise with both operations happening at the same time, it can cause the animation to not run at full speed.
|
||||
var pgs = this;
|
||||
var delay = LibraryBrowser.animatePaperTabs() || !tabs.noSlide ? 500 : 0;
|
||||
var delay = LibraryBrowser.animatePaperTabs() || !tabs.noSlide ? 300 : 0;
|
||||
|
||||
setTimeout(function () {
|
||||
$(pgs).trigger('tabchange');
|
||||
pgs.dispatchEvent(new CustomEvent("tabchange", {}));
|
||||
}, delay);
|
||||
});
|
||||
|
||||
function fadeOutLeft(elem, iterations) {
|
||||
var keyframes = [{ opacity: '1', transform: 'none', offset: 0 },
|
||||
{ opacity: '0', transform: 'translate3d(-100%, 0, 0)', offset: 1 }];
|
||||
var timing = { duration: 400, iterations: iterations };
|
||||
var timing = { duration: 300, iterations: iterations };
|
||||
return elem.animate(keyframes, timing);
|
||||
}
|
||||
if (!LibraryBrowser.navigateOnLibraryTabSelect()) {
|
||||
tabs.addEventListener('iron-select', function () {
|
||||
|
||||
var animateTab = !$.browser.safari;
|
||||
var animateTab = !browserInfo.safari;
|
||||
animateTab = false;
|
||||
|
||||
var selected = pages.selected;
|
||||
if (selected != null && animateTab) {
|
||||
var newValue = this.selected;
|
||||
|
@ -361,7 +425,7 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
Events.trigger(pages, 'tabchange');
|
||||
pages.dispatchEvent(new CustomEvent("tabchange", {}));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -377,7 +441,7 @@
|
|||
}
|
||||
|
||||
var afterNavigate = function () {
|
||||
if (getWindowUrl().toLowerCase().indexOf(url.toLowerCase()) != -1) {
|
||||
if (window.location.href.toLowerCase().indexOf(url.toLowerCase()) != -1) {
|
||||
|
||||
var pages = this.querySelector('neon-animated-pages');
|
||||
|
||||
|
@ -391,7 +455,7 @@
|
|||
var tabs = this.querySelector('paper-tabs');
|
||||
|
||||
// For some reason the live tv page will not switch tabs in IE and safari
|
||||
var delay = $.browser.chrome ? 0 : 100;
|
||||
var delay = browserInfo.chrome ? 0 : 100;
|
||||
|
||||
setTimeout(function () {
|
||||
var noSlide = tabs.noSlide;
|
||||
|
@ -407,7 +471,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
if (getWindowUrl().toLowerCase().indexOf(url.toLowerCase()) != -1) {
|
||||
if (window.location.href.toLowerCase().indexOf(url.toLowerCase()) != -1) {
|
||||
|
||||
afterNavigate.call($($.mobile.activePage)[0]);
|
||||
} else {
|
||||
|
@ -434,7 +498,7 @@
|
|||
|
||||
playAllFromHere: function (fn, index) {
|
||||
|
||||
fn(index, 100, "MediaSources,Chapters").done(function (result) {
|
||||
fn(index, 100, "MediaSources,Chapters").then(function (result) {
|
||||
|
||||
MediaController.play({
|
||||
items: result.Items
|
||||
|
@ -444,7 +508,7 @@
|
|||
|
||||
queueAllFromHere: function (query, index) {
|
||||
|
||||
fn(index, 100, "MediaSources,Chapters").done(function (result) {
|
||||
fn(index, 100, "MediaSources,Chapters").then(function (result) {
|
||||
|
||||
MediaController.queue({
|
||||
items: result.Items
|
||||
|
@ -576,14 +640,14 @@
|
|||
|
||||
playInExternalPlayer: function (id) {
|
||||
|
||||
Dashboard.loadExternalPlayer().done(function () {
|
||||
Dashboard.loadExternalPlayer().then(function () {
|
||||
ExternalPlayer.showMenu(id);
|
||||
});
|
||||
},
|
||||
|
||||
showPlayMenu: function (positionTo, itemId, itemType, isFolder, mediaType, resumePositionTicks) {
|
||||
|
||||
var externalPlayers = AppSettings.enableExternalPlayers();
|
||||
var externalPlayers = AppInfo.supportsExternalPlayers && AppSettings.enableExternalPlayers();
|
||||
|
||||
if (!resumePositionTicks && mediaType != "Audio" && !isFolder) {
|
||||
|
||||
|
@ -727,7 +791,9 @@
|
|||
}
|
||||
|
||||
if (item.CanDownload) {
|
||||
commands.push('download');
|
||||
if (AppInfo.supportsDownloading) {
|
||||
commands.push('download');
|
||||
}
|
||||
}
|
||||
|
||||
if (LibraryBrowser.canShare(item, user)) {
|
||||
|
@ -787,7 +853,7 @@
|
|||
|
||||
editImages: function (itemId) {
|
||||
|
||||
require(['components/imageeditor/imageeditor'], function () {
|
||||
require(['components/imageeditor/imageeditor'], function (ImageEditor) {
|
||||
|
||||
ImageEditor.show(itemId);
|
||||
});
|
||||
|
@ -795,7 +861,7 @@
|
|||
|
||||
editSubtitles: function (itemId) {
|
||||
|
||||
require(['components/subtitleeditor/subtitleeditor'], function () {
|
||||
require(['components/subtitleeditor/subtitleeditor'], function (SubtitleEditor) {
|
||||
|
||||
SubtitleEditor.show(itemId);
|
||||
});
|
||||
|
@ -1203,6 +1269,8 @@
|
|||
|
||||
getListViewHtml: function (options) {
|
||||
|
||||
require(['paper-icon-item', 'paper-item-body']);
|
||||
|
||||
var outerHtml = "";
|
||||
|
||||
if (options.title) {
|
||||
|
@ -1624,7 +1692,7 @@
|
|||
|
||||
var shapeWidth = screenWidth / imagesPerRow[currentShape];
|
||||
|
||||
if (!$.browser.mobile) {
|
||||
if (!browserInfo.mobile) {
|
||||
|
||||
shapeWidth = Math.round(shapeWidth / roundTo) * roundTo;
|
||||
}
|
||||
|
@ -1775,7 +1843,7 @@
|
|||
var showTitle = options.showTitle == 'auto' ? true : options.showTitle;
|
||||
var coverImage = options.coverImage;
|
||||
|
||||
if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.5) {
|
||||
if (options.autoThumb && item.ImageTags && item.ImageTags.Primary && item.PrimaryImageAspectRatio && item.PrimaryImageAspectRatio >= 1.34) {
|
||||
|
||||
width = posterWidth;
|
||||
height = primaryImageAspectRatio ? Math.round(posterWidth / primaryImageAspectRatio) : null;
|
||||
|
@ -2055,8 +2123,6 @@
|
|||
}
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="cardOverlayTarget"></div>';
|
||||
|
||||
if (item.LocationType == "Virtual" || item.LocationType == "Offline") {
|
||||
if (options.showLocationTypeIndicator !== false) {
|
||||
html += LibraryBrowser.getOfflineIndicatorHtml(item);
|
||||
|
@ -2125,8 +2191,6 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="' + footerClass + '">';
|
||||
|
||||
if (options.cardLayout) {
|
||||
html += '<div class="cardButtonContainer">';
|
||||
html += '<paper-icon-button icon="' + AppInfo.moreIcon + '" class="listviewMenuButton btnCardOptions"></paper-icon-button>';
|
||||
|
@ -2239,8 +2303,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
//cardFooter
|
||||
html += "</div>";
|
||||
if (html) {
|
||||
html = '<div class="' + footerClass + '">' + html;
|
||||
|
||||
//cardFooter
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
|
@ -2549,7 +2617,7 @@
|
|||
Dashboard.setPageTitle(name);
|
||||
|
||||
if (linkToElement) {
|
||||
nameElem.html('<a class="detailPageParentLink" href="' + LibraryBrowser.getHref(item, context) + '">' + name + '</a>').trigger('create');
|
||||
nameElem.html('<a class="detailPageParentLink" href="' + LibraryBrowser.getHref(item, context) + '">' + name + '</a>');
|
||||
} else {
|
||||
nameElem.html(name);
|
||||
}
|
||||
|
@ -2591,7 +2659,7 @@
|
|||
}
|
||||
|
||||
if (html.length) {
|
||||
parentNameElem.show().html(html.join(' - ')).trigger('create');
|
||||
parentNameElem.show().html(html.join(' - '));
|
||||
} else {
|
||||
parentNameElem.hide();
|
||||
}
|
||||
|
@ -2622,7 +2690,7 @@
|
|||
html = Globalize.translate('ValueLinks', html);
|
||||
|
||||
linksElem.innerHTML = html;
|
||||
$(linksElem).trigger('create');
|
||||
$(linksElem);
|
||||
$(linksElem).show();
|
||||
|
||||
} else {
|
||||
|
@ -2761,83 +2829,92 @@
|
|||
|
||||
showSortMenu: function (options) {
|
||||
|
||||
var dlg = document.createElement('paper-dialog');
|
||||
require(['components/paperdialoghelper', 'paper-dialog', 'paper-radio-button', 'paper-radio-group', 'scale-up-animation', 'fade-in-animation', 'fade-out-animation'], function (paperDialogHelper) {
|
||||
|
||||
dlg.setAttribute('with-backdrop', 'with-backdrop');
|
||||
dlg.setAttribute('role', 'alertdialog');
|
||||
var dlg = paperDialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
theme: 'a',
|
||||
size: 'auto',
|
||||
modal: false
|
||||
});
|
||||
|
||||
dlg.entryAnimation = 'fade-in-animation';
|
||||
dlg.exitAnimation = 'fade-out-animation';
|
||||
var html = '';
|
||||
|
||||
var html = '';
|
||||
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height
|
||||
// Have to disable this right now because it's causing the radio buttons to not function properly in other browsers besides chrome
|
||||
var isScrollable = false;
|
||||
if (browserInfo.android) {
|
||||
isScrollable = true;
|
||||
}
|
||||
|
||||
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height
|
||||
// Have to disable this right now because it's causing the radio buttons to not function properly in other browsers besides chrome
|
||||
var isScrollable = false;
|
||||
if ($.browser.android) {
|
||||
isScrollable = true;
|
||||
}
|
||||
html += '<h2>';
|
||||
html += Globalize.translate('HeaderSortBy');
|
||||
html += '</h2>';
|
||||
|
||||
html += '<h2>';
|
||||
html += Globalize.translate('HeaderSortBy');
|
||||
html += '</h2>';
|
||||
if (isScrollable) {
|
||||
html += '<paper-dialog-scrollable>';
|
||||
}
|
||||
|
||||
if (isScrollable) {
|
||||
html += '<paper-dialog-scrollable>';
|
||||
}
|
||||
html += '<paper-radio-group class="groupSortBy" selected="' + (options.query.SortBy || '').replace(',', '_') + '">';
|
||||
for (var i = 0, length = options.items.length; i < length; i++) {
|
||||
|
||||
html += '<paper-radio-group class="groupSortBy" selected="' + (options.query.SortBy || '').replace(',', '_') + '">';
|
||||
for (var i = 0, length = options.items.length; i < length; i++) {
|
||||
var option = options.items[i];
|
||||
|
||||
var option = options.items[i];
|
||||
html += '<paper-radio-button class="menuSortBy block" data-id="' + option.id + '" name="' + option.id.replace(',', '_') + '">' + option.name + '</paper-radio-button>';
|
||||
}
|
||||
html += '</paper-radio-group>';
|
||||
|
||||
html += '<paper-radio-button class="menuSortBy block" data-id="' + option.id + '" name="' + option.id.replace(',', '_') + '">' + option.name + '</paper-radio-button>';
|
||||
}
|
||||
html += '</paper-radio-group>';
|
||||
html += '<p style="margin: 1em 0;padding: 0 0 0 1.5em;">';
|
||||
html += Globalize.translate('HeaderSortOrder');
|
||||
html += '</p>';
|
||||
html += '<paper-radio-group class="groupSortOrder" selected="' + (options.query.SortOrder || 'Ascending') + '">';
|
||||
html += '<paper-radio-button name="Ascending" class="menuSortOrder block">' + Globalize.translate('OptionAscending') + '</paper-radio-button>';
|
||||
html += '<paper-radio-button name="Descending" class="menuSortOrder block">' + Globalize.translate('OptionDescending') + '</paper-radio-button>';
|
||||
html += '</paper-radio-group>';
|
||||
|
||||
html += '<p>';
|
||||
html += Globalize.translate('HeaderSortOrder');
|
||||
html += '</p>';
|
||||
html += '<paper-radio-group class="groupSortOrder" selected="' + (options.query.SortOrder || 'Ascending') + '">';
|
||||
html += '<paper-radio-button name="Ascending" class="menuSortOrder block">' + Globalize.translate('OptionAscending') + '</paper-radio-button>';
|
||||
html += '<paper-radio-button name="Descending" class="menuSortOrder block">' + Globalize.translate('OptionDescending') + '</paper-radio-button>';
|
||||
html += '</paper-radio-group>';
|
||||
if (isScrollable) {
|
||||
html += '</paper-dialog-scrollable>';
|
||||
}
|
||||
|
||||
if (isScrollable) {
|
||||
html += '</paper-dialog-scrollable>';
|
||||
}
|
||||
html += '<div class="buttons">';
|
||||
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonClose') + '</paper-button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="buttons">';
|
||||
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonClose') + '</paper-button>';
|
||||
html += '</div>';
|
||||
dlg.innerHTML = html;
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
dlg.innerHTML = html;
|
||||
document.body.appendChild(dlg);
|
||||
var fireCallbackOnClose = false;
|
||||
|
||||
$(dlg).on('iron-overlay-closed', function () {
|
||||
$(this).remove();
|
||||
});
|
||||
paperDialogHelper.open(dlg).then(function() {
|
||||
|
||||
require(['components/paperdialoghelper'], function () {
|
||||
|
||||
PaperDialogHelper.openWithHash(dlg, 'sortmenu');
|
||||
if (options.callback && fireCallbackOnClose) {
|
||||
options.callback();
|
||||
}
|
||||
});
|
||||
|
||||
$('.groupSortBy', dlg).on('iron-select', function () {
|
||||
options.query.SortBy = this.selected.replace('_', ',');
|
||||
|
||||
var newValue = this.selected.replace('_', ',');
|
||||
var changed = options.query.SortBy != newValue;
|
||||
|
||||
options.query.SortBy = newValue;
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
if (options.callback) {
|
||||
options.callback();
|
||||
if (options.callback && changed) {
|
||||
fireCallbackOnClose = true;
|
||||
}
|
||||
});
|
||||
|
||||
$('.groupSortOrder', dlg).on('iron-select', function () {
|
||||
|
||||
options.query.SortOrder = this.selected;
|
||||
var newValue = this.selected;
|
||||
var changed = options.query.SortOrder != newValue;
|
||||
|
||||
options.query.SortOrder = newValue;
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
if (options.callback) {
|
||||
options.callback();
|
||||
if (options.callback && changed) {
|
||||
fireCallbackOnClose = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3175,7 +3252,13 @@
|
|||
elem.classList.remove('squareDetailImageContainer');
|
||||
}
|
||||
|
||||
ImageLoader.lazyImage(elem.querySelector('img'), url);
|
||||
var img = elem.querySelector('img');
|
||||
img.onload = function () {
|
||||
if (img.src.indexOf('empty.png') == -1) {
|
||||
img.classList.add('loaded');
|
||||
}
|
||||
};
|
||||
ImageLoader.lazyImage(img, url);
|
||||
},
|
||||
|
||||
refreshDetailImageUserData: function (elem, item) {
|
||||
|
@ -3515,26 +3598,6 @@
|
|||
}
|
||||
},
|
||||
|
||||
renderBudget: function (elem, item) {
|
||||
|
||||
if (item.Budget) {
|
||||
|
||||
elem.show().html(Globalize.translate('ValueBudget', '$' + item.Budget));
|
||||
} else {
|
||||
elem.hide();
|
||||
}
|
||||
},
|
||||
|
||||
renderRevenue: function (elem, item) {
|
||||
|
||||
if (item.Revenue) {
|
||||
|
||||
elem.show().html(Globalize.translate('ValueRevenue', '$' + item.Revenue));
|
||||
} else {
|
||||
elem.hide();
|
||||
}
|
||||
},
|
||||
|
||||
renderAwardSummary: function (elem, item) {
|
||||
if (item.AwardSummary) {
|
||||
elem.show().html(Globalize.translate('ValueAwards', item.AwardSummary));
|
||||
|
@ -3591,4 +3654,4 @@
|
|||
|
||||
return libraryBrowser;
|
||||
|
||||
})(window, document, jQuery, screen);
|
||||
})(window, document, screen);
|
|
@ -2,28 +2,63 @@
|
|||
|
||||
var showOverlayTimeout;
|
||||
|
||||
function onHoverOut() {
|
||||
function onHoverOut(e) {
|
||||
|
||||
var elem = e.target;
|
||||
|
||||
if (!elem.classList.contains('card')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (showOverlayTimeout) {
|
||||
clearTimeout(showOverlayTimeout);
|
||||
showOverlayTimeout = null;
|
||||
}
|
||||
|
||||
var elem = this.querySelector('.cardOverlayTarget');
|
||||
elem = elem.querySelector('.cardOverlayTarget');
|
||||
|
||||
if ($(elem).is(':visible')) {
|
||||
require(["jquery", "velocity"], function ($, Velocity) {
|
||||
|
||||
Velocity.animate(elem, { "height": "0" },
|
||||
{
|
||||
complete: function () {
|
||||
$(elem).hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
if (elem) {
|
||||
slideDownToHide(elem);
|
||||
}
|
||||
}
|
||||
|
||||
function slideDownToHide(elem) {
|
||||
|
||||
if (elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
var keyframes = [
|
||||
{ height: '100%', offset: 0 },
|
||||
{ height: '0', offset: 1 }];
|
||||
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
|
||||
|
||||
elem.animate(keyframes, timing).onfinish = function () {
|
||||
elem.classList.add('hide');
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function slideUpToShow(elem) {
|
||||
|
||||
if (!elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
elem.classList.remove('hide');
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
elem.style.display = 'block';
|
||||
|
||||
var keyframes = [
|
||||
{ height: '0', offset: 0 },
|
||||
{ height: '100%', offset: 1 }];
|
||||
var timing = { duration: 300, iterations: 1, fill: 'forwards', easing: 'ease-out' };
|
||||
elem.animate(keyframes, timing);
|
||||
});
|
||||
}
|
||||
|
||||
function getOverlayHtml(item, currentUser, card, commands) {
|
||||
|
||||
var html = '';
|
||||
|
@ -42,13 +77,12 @@
|
|||
|
||||
html += '<div style="margin-bottom:1em;">';
|
||||
var logoHeight = isSmallItem || isMiniItem ? 20 : 26;
|
||||
var maxLogoWidth = isPortrait ? 100 : 200;
|
||||
var imgUrl;
|
||||
|
||||
if (parentName && item.ParentLogoItemId) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(item.ParentLogoItemId, {
|
||||
height: logoHeight,
|
||||
maxHeight: logoHeight,
|
||||
type: 'logo',
|
||||
tag: item.ParentLogoImageTag
|
||||
});
|
||||
|
@ -59,7 +93,7 @@
|
|||
else if (item.ImageTags.Logo) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(item.Id, {
|
||||
height: logoHeight,
|
||||
maxHeight: logoHeight,
|
||||
type: 'logo',
|
||||
tag: item.ImageTags.Logo
|
||||
});
|
||||
|
@ -138,7 +172,7 @@
|
|||
|
||||
var id = this.getAttribute('data-itemid');
|
||||
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), id).done(function (trailers) {
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), id).then(function (trailers) {
|
||||
MediaController.play({ items: trailers });
|
||||
});
|
||||
|
||||
|
@ -206,7 +240,7 @@
|
|||
var albumid = card.getAttribute('data-albumid');
|
||||
var artistid = card.getAttribute('data-artistid');
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
var items = [];
|
||||
|
||||
|
@ -290,7 +324,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (mediaType == 'Video' && AppSettings.enableExternalPlayers()) {
|
||||
if (mediaType == 'Video' && AppInfo.supportsExternalPlayers && AppSettings.enableExternalPlayers()) {
|
||||
items.push({
|
||||
name: Globalize.translate('ButtonPlayExternalPlayer'),
|
||||
id: 'externalplayer',
|
||||
|
@ -475,7 +509,7 @@
|
|||
MediaController.queue(itemId);
|
||||
break;
|
||||
case 'trailer':
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), itemId).done(function (trailers) {
|
||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), itemId).then(function (trailers) {
|
||||
MediaController.play({ items: trailers });
|
||||
});
|
||||
break;
|
||||
|
@ -620,15 +654,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
var buttonParents = $(target).parents('a:not(.card,.cardContent),button:not(.card,.cardContent)');
|
||||
if (buttonParents.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||
|
||||
if (items.length == 1) {
|
||||
|
||||
Dashboard.navigate(LibraryBrowser.getHref(items[0], context));
|
||||
return;
|
||||
}
|
||||
|
@ -637,236 +665,15 @@
|
|||
if (context) {
|
||||
url += '&context=' + context;
|
||||
}
|
||||
|
||||
Dashboard.navigate(url);
|
||||
return;
|
||||
|
||||
var ids = items.map(function (i) {
|
||||
return i.Id;
|
||||
});
|
||||
|
||||
showItemsOverlay({
|
||||
ids: ids,
|
||||
context: context
|
||||
});
|
||||
});
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function getItemsOverlay(ids, context) {
|
||||
|
||||
$('.detailsMenu').remove();
|
||||
|
||||
var html = '<div data-role="popup" class="detailsMenu" style="border:0;padding:0;" data-ids="' + ids.join(',') + '" data-context="' + (context || '') + '">';
|
||||
|
||||
html += '<div style="padding:1em 1em;background:rgba(20,20,20,1);margin:0;text-align:center;" class="detailsMenuHeader">';
|
||||
html += '<paper-icon-button icon="keyboard-arrow-left" class="detailsMenuLeftButton"></paper-icon-button>';
|
||||
html += '<h3 style="font-weight:400;margin:.5em 0;"></h3>';
|
||||
html += '<paper-icon-button icon="keyboard-arrow-right" class="detailsMenuRightButton"></paper-icon-button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="detailsMenuContent" style="background-position:center center;background-repeat:no-repeat;background-size:cover;">';
|
||||
html += '<div style="padding:.5em 1em 1em;background:rgba(10,10,10,.80);" class="detailsMenuContentInner">';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</div>';
|
||||
|
||||
$($.mobile.activePage).append(html);
|
||||
|
||||
var elem = $('.detailsMenu').popup().trigger('create').popup("open").on("popupafterclose", function () {
|
||||
|
||||
$(this).off("popupafterclose").remove();
|
||||
})[0];
|
||||
|
||||
$('.detailsMenuLeftButton', elem).on('click', function () {
|
||||
|
||||
var overlay = $(this).parents('.detailsMenu')[0];
|
||||
setItemIntoOverlay(overlay, parseInt(overlay.getAttribute('data-index') || '0') - 1, context);
|
||||
});
|
||||
|
||||
$('.detailsMenuRightButton', elem).on('click', function () {
|
||||
|
||||
var overlay = $(this).parents('.detailsMenu')[0];
|
||||
setItemIntoOverlay(overlay, parseInt(overlay.getAttribute('data-index') || '0') + 1, context);
|
||||
});
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function setItemIntoOverlay(elem, index) {
|
||||
|
||||
var ids = elem.getAttribute('data-ids').split(',');
|
||||
var itemId = ids[index];
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
var context = elem.getAttribute('data-context');
|
||||
|
||||
elem.setAttribute('data-index', index);
|
||||
|
||||
if (index > 0) {
|
||||
$('.detailsMenuLeftButton', elem).show();
|
||||
} else {
|
||||
$('.detailsMenuLeftButton', elem).hide();
|
||||
}
|
||||
|
||||
if (index < ids.length - 1) {
|
||||
$('.detailsMenuRightButton', elem).show();
|
||||
} else {
|
||||
$('.detailsMenuRightButton', elem).hide();
|
||||
}
|
||||
|
||||
var promise1 = ApiClient.getItem(userId, itemId);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
|
||||
var item = response1[0];
|
||||
var user = response2[0];
|
||||
|
||||
var background = 'none';
|
||||
|
||||
if (AppInfo.enableDetailsMenuImages) {
|
||||
var backdropUrl;
|
||||
var screenWidth = $(window).width();
|
||||
var backdropWidth = Math.min(screenWidth, 800);
|
||||
|
||||
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
backdropUrl = ApiClient.getScaledImageUrl(item.Id, {
|
||||
type: "Backdrop",
|
||||
index: 0,
|
||||
maxWidth: backdropWidth,
|
||||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
}
|
||||
else if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||
|
||||
backdropUrl = ApiClient.getScaledImageUrl(item.ParentBackdropItemId, {
|
||||
type: 'Backdrop',
|
||||
index: 0,
|
||||
tag: item.ParentBackdropImageTags[0],
|
||||
maxWidth: backdropWidth
|
||||
});
|
||||
}
|
||||
|
||||
if (backdropUrl) {
|
||||
background = 'url(' + backdropUrl + ')';
|
||||
}
|
||||
}
|
||||
|
||||
$('.detailsMenuContent', elem).css('backgroundImage', background);
|
||||
|
||||
var headerHtml = LibraryBrowser.getPosterViewDisplayName(item);
|
||||
$('.detailsMenuHeader', elem).removeClass('detailsMenuHeaderWithLogo');
|
||||
if (AppInfo.enableDetailsMenuImages) {
|
||||
|
||||
var logoUrl;
|
||||
|
||||
var logoHeight = 30;
|
||||
if (item.ImageTags && item.ImageTags.Logo) {
|
||||
|
||||
logoUrl = ApiClient.getScaledImageUrl(item.Id, {
|
||||
type: "Logo",
|
||||
index: 0,
|
||||
height: logoHeight,
|
||||
tag: item.ImageTags.Logo
|
||||
});
|
||||
}
|
||||
|
||||
if (logoUrl) {
|
||||
headerHtml = '<img src="' + logoUrl + '" style="height:' + logoHeight + 'px;" />';
|
||||
$('.detailsMenuHeader', elem).addClass('detailsMenuHeaderWithLogo');
|
||||
}
|
||||
}
|
||||
|
||||
$('h3', elem).html(headerHtml);
|
||||
|
||||
var contentHtml = '';
|
||||
|
||||
var miscInfo = LibraryBrowser.getMiscInfoHtml(item);
|
||||
if (miscInfo) {
|
||||
|
||||
contentHtml += '<p>' + miscInfo + '</p>';
|
||||
}
|
||||
|
||||
var userData = LibraryBrowser.getUserDataIconsHtml(item);
|
||||
if (userData) {
|
||||
|
||||
contentHtml += '<p class="detailsMenuUserData">' + userData + '</p>';
|
||||
}
|
||||
|
||||
var ratingHtml = LibraryBrowser.getRatingHtml(item);
|
||||
if (ratingHtml) {
|
||||
|
||||
contentHtml += '<p>' + ratingHtml + '</p>';
|
||||
}
|
||||
|
||||
if (item.Overview) {
|
||||
contentHtml += '<p class="detailsMenuOverview">' + item.Overview + '</p>';
|
||||
}
|
||||
|
||||
contentHtml += '<div class="detailsMenuButtons">';
|
||||
|
||||
if (MediaController.canPlay(item)) {
|
||||
if (item.MediaType == 'Video' && !item.IsFolder && item.UserData && item.UserData.PlaybackPositionTicks) {
|
||||
contentHtml += '<paper-button raised class="secondary btnResume" style="background-color:#ff8f00;"><iron-icon icon="play-arrow"></iron-icon><span>' + Globalize.translate('ButtonResume') + '</span></paper-button>';
|
||||
}
|
||||
|
||||
contentHtml += '<paper-button raised class="secondary btnPlay"><iron-icon icon="play-arrow"></iron-icon><span>' + Globalize.translate('ButtonPlay') + '</span></paper-button>';
|
||||
}
|
||||
|
||||
contentHtml += '<paper-button data-href="' + LibraryBrowser.getHref(item, context) + '" raised class="submit" style="background-color: #673AB7;" onclick="Dashboard.navigate(this.getAttribute(\'data-href\'));"><iron-icon icon="folder-open"></iron-icon><span>' + Globalize.translate('ButtonOpen') + '</span></paper-button>';
|
||||
|
||||
if (SyncManager.isAvailable(item, user)) {
|
||||
contentHtml += '<paper-button raised class="submit btnSync"><iron-icon icon="sync"></iron-icon><span>' + Globalize.translate('ButtonSync') + '</span></paper-button>';
|
||||
}
|
||||
|
||||
contentHtml += '</div>';
|
||||
|
||||
$('.detailsMenuContentInner', elem).html(contentHtml).trigger('create');
|
||||
|
||||
$('.btnSync', elem).on('click', function () {
|
||||
|
||||
$(elem).popup('close');
|
||||
|
||||
SyncManager.showMenu({
|
||||
items: [item]
|
||||
});
|
||||
});
|
||||
|
||||
$('.btnPlay', elem).on('click', function () {
|
||||
|
||||
$(elem).popup('close');
|
||||
|
||||
MediaController.play({
|
||||
items: [item]
|
||||
});
|
||||
});
|
||||
|
||||
$('.btnResume', elem).on('click', function () {
|
||||
|
||||
$(elem).popup('close');
|
||||
|
||||
MediaController.play({
|
||||
items: [item],
|
||||
startPositionTicks: item.UserData.PlaybackPositionTicks
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showItemsOverlay(options) {
|
||||
|
||||
var context = options.context;
|
||||
|
||||
require(['jqmpopup'], function () {
|
||||
var elem = getItemsOverlay(options.ids, context);
|
||||
|
||||
setItemIntoOverlay(elem, 0);
|
||||
});
|
||||
}
|
||||
|
||||
function parentWithClass(elem, className) {
|
||||
|
||||
while (!elem.classList || !elem.classList.contains(className)) {
|
||||
|
@ -894,6 +701,13 @@
|
|||
|
||||
var innerElem = elem.querySelector('.cardOverlayTarget');
|
||||
|
||||
if (!innerElem) {
|
||||
innerElem = document.createElement('div');
|
||||
innerElem.classList.add('hide');
|
||||
innerElem.classList.add('cardOverlayTarget');
|
||||
parentWithClass(elem, 'cardContent').appendChild(innerElem);
|
||||
}
|
||||
|
||||
var dataElement = elem;
|
||||
while (dataElement && !dataElement.getAttribute('data-itemid')) {
|
||||
dataElement = dataElement.parentNode;
|
||||
|
@ -905,10 +719,10 @@
|
|||
var promise1 = ApiClient.getItem(Dashboard.getCurrentUserId(), id);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var item = response1[0];
|
||||
var user = response2[0];
|
||||
var item = responses[0];
|
||||
var user = responses[1];
|
||||
|
||||
var card = elem;
|
||||
|
||||
|
@ -924,16 +738,18 @@
|
|||
});
|
||||
|
||||
$(innerElem).show();
|
||||
innerElem.style.height = '0';
|
||||
|
||||
require(["jquery", "velocity"], function ($, Velocity) {
|
||||
|
||||
Velocity.animate(innerElem, { "height": "100%" }, "fast");
|
||||
});
|
||||
slideUpToShow(innerElem);
|
||||
}
|
||||
|
||||
function onHoverIn(e) {
|
||||
|
||||
var elem = e.target;
|
||||
|
||||
if (!elem.classList.contains('cardImage')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (preventHover === true) {
|
||||
preventHover = false;
|
||||
return;
|
||||
|
@ -944,14 +760,11 @@
|
|||
showOverlayTimeout = null;
|
||||
}
|
||||
|
||||
var elem = this;
|
||||
|
||||
while (!elem.classList.contains('card')) {
|
||||
elem = elem.parentNode;
|
||||
}
|
||||
|
||||
showOverlayTimeout = setTimeout(function () {
|
||||
|
||||
onShowTimerExpired(elem);
|
||||
|
||||
}, 1000);
|
||||
|
@ -961,31 +774,32 @@
|
|||
preventHover = true;
|
||||
}
|
||||
|
||||
this.off('click', onCardClick);
|
||||
this.on('click', onCardClick);
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
this.off('contextmenu', disableEvent);
|
||||
this.on('contextmenu', disableEvent);
|
||||
//this.off('contextmenu', onContextMenu);
|
||||
//this.on('contextmenu', onContextMenu);
|
||||
}
|
||||
else {
|
||||
this.off('contextmenu', onContextMenu);
|
||||
this.on('contextmenu', onContextMenu);
|
||||
|
||||
this.off('mouseenter', '.card:not(.bannerCard) .cardContent', onHoverIn);
|
||||
this.on('mouseenter', '.card:not(.bannerCard) .cardContent', onHoverIn);
|
||||
|
||||
this.off('mouseleave', '.card:not(.bannerCard) .cardContent', onHoverOut);
|
||||
this.on('mouseleave', '.card:not(.bannerCard) .cardContent', onHoverOut);
|
||||
|
||||
this.off("touchstart", '.card:not(.bannerCard) .cardContent', preventTouchHover);
|
||||
this.on("touchstart", '.card:not(.bannerCard) .cardContent', preventTouchHover);
|
||||
}
|
||||
|
||||
for (var i = 0, length = this.length; i < length; i++) {
|
||||
initTapHoldMenus(this[i]);
|
||||
|
||||
var curr = this[i];
|
||||
curr.removeEventListener('click', onCardClick);
|
||||
curr.addEventListener('click', onCardClick);
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
|
||||
curr.removeEventListener('contextmenu', disableEvent);
|
||||
curr.addEventListener('contextmenu', disableEvent);
|
||||
}
|
||||
else {
|
||||
curr.removeEventListener('contextmenu', onContextMenu);
|
||||
curr.addEventListener('contextmenu', onContextMenu);
|
||||
|
||||
curr.removeEventListener('mouseenter', onHoverIn);
|
||||
curr.addEventListener('mouseenter', onHoverIn, true);
|
||||
|
||||
curr.removeEventListener('mouseleave', onHoverOut);
|
||||
curr.addEventListener('mouseleave', onHoverOut, true);
|
||||
|
||||
curr.removeEventListener("touchstart", preventTouchHover);
|
||||
curr.addEventListener("touchstart", preventTouchHover);
|
||||
}
|
||||
|
||||
initTapHoldMenus(curr);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@ -1011,13 +825,19 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (element.classList.contains('hasTapHold')) {
|
||||
return;
|
||||
}
|
||||
|
||||
require(['hammer'], function (Hammer) {
|
||||
|
||||
var hammertime = new Hammer(element);
|
||||
element.classList.add('hasTapHold');
|
||||
|
||||
hammertime.on('press', onTapHold);
|
||||
hammertime.on('pressup', onTapHoldUp);
|
||||
});
|
||||
|
||||
showTapHoldHelp(element);
|
||||
}
|
||||
|
||||
|
@ -1049,6 +869,7 @@
|
|||
|
||||
function disableEvent(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1060,9 +881,16 @@
|
|||
|
||||
showSelections(card);
|
||||
|
||||
if (s.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
||||
function onTapHoldUp(e) {
|
||||
|
@ -1077,6 +905,8 @@
|
|||
chkItemSelect.checked = !chkItemSelect.checked;
|
||||
}
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1094,6 +924,7 @@
|
|||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1107,17 +938,19 @@
|
|||
|
||||
if (!itemSelectionPanel) {
|
||||
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
require(['paper-checkbox'], function () {
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
|
||||
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
|
||||
item.querySelector('.cardContent').appendChild(itemSelectionPanel);
|
||||
|
||||
var chkItemSelect = document.createElement('paper-checkbox');
|
||||
chkItemSelect.classList.add('chkItemSelect');
|
||||
var chkItemSelect = document.createElement('paper-checkbox');
|
||||
chkItemSelect.classList.add('chkItemSelect');
|
||||
|
||||
$(chkItemSelect).on('change', onSelectionChange);
|
||||
$(chkItemSelect).on('change', onSelectionChange);
|
||||
|
||||
itemSelectionPanel.appendChild(chkItemSelect);
|
||||
itemSelectionPanel.appendChild(chkItemSelect);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1139,7 +972,7 @@
|
|||
html += '<span class="itemSelectionCount"></span>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<paper-icon-button class="btnSelectionPanelOptions" icon="more-vert" style="float:right;"></paper-icon-button>';
|
||||
html += '<paper-icon-button class="btnSelectionPanelOptions" icon="more-vert" style="margin-left:auto;"></paper-icon-button>';
|
||||
|
||||
selectionCommandsPanel.innerHTML = html;
|
||||
|
||||
|
@ -1149,7 +982,7 @@
|
|||
|
||||
$(btnSelectionPanelOptions).on('click', showMenuForSelectedItems);
|
||||
|
||||
if (!$.browser.mobile) {
|
||||
if (!browserInfo.mobile) {
|
||||
shake(btnSelectionPanelOptions, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1232,7 +1065,7 @@
|
|||
|
||||
function showMenuForSelectedItems(e) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
var items = [];
|
||||
|
||||
|
@ -1352,7 +1185,7 @@
|
|||
type: "POST",
|
||||
url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
hideSelections();
|
||||
|
@ -1364,7 +1197,11 @@
|
|||
|
||||
function onItemWithActionClick(e) {
|
||||
|
||||
var elem = this;
|
||||
var elem = parentWithClass(e.target, 'itemWithAction');
|
||||
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
|
||||
var action = elem.getAttribute('data-action');
|
||||
var elemWithAttributes = elem;
|
||||
|
@ -1396,6 +1233,8 @@
|
|||
MediaController.instantMix(itemId);
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1420,7 +1259,7 @@
|
|||
Fields: 'MediaSources,Chapters',
|
||||
Limit: 100
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
MediaController[method]({
|
||||
items: result.Items
|
||||
|
@ -1432,7 +1271,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
$(page).on('click', '.itemWithAction', onItemWithActionClick);
|
||||
page.addEventListener('click', onItemWithActionClick);
|
||||
|
||||
var itemsContainers = page.querySelectorAll('.itemsContainer:not(.noautoinit)');
|
||||
for (var i = 0, length = itemsContainers.length; i < length; i++) {
|
||||
|
@ -1452,19 +1291,27 @@
|
|||
|
||||
if (userData.Played) {
|
||||
|
||||
if (!$('.playedIndicator', card).length) {
|
||||
var playedIndicator = card.querySelector('.playedIndicator');
|
||||
|
||||
$('<div class="playedIndicator"></div>').insertAfter($('.cardOverlayTarget', card));
|
||||
if (!playedIndicator) {
|
||||
|
||||
playedIndicator = document.createElement('div');
|
||||
playedIndicator.classList.add('playedIndicator');
|
||||
card.querySelector('.cardContent').appendChild(playedIndicator);
|
||||
}
|
||||
$('.playedIndicator', card).html('<iron-icon icon="check"></iron-icon>');
|
||||
playedIndicator.innerHTML = '<iron-icon icon="check"></iron-icon>';
|
||||
}
|
||||
else if (userData.UnplayedItemCount) {
|
||||
|
||||
if (!$('.playedIndicator', card).length) {
|
||||
var playedIndicator = card.querySelector('.playedIndicator');
|
||||
|
||||
$('<div class="playedIndicator"></div>').insertAfter($('.cardOverlayTarget', card));
|
||||
if (!playedIndicator) {
|
||||
|
||||
playedIndicator = document.createElement('div');
|
||||
playedIndicator.classList.add('playedIndicator');
|
||||
card.querySelector('.cardContent').appendChild(playedIndicator);
|
||||
}
|
||||
$('.playedIndicator', card).html(userData.UnplayedItemCount);
|
||||
playedIndicator.innerHTML = userData.UnplayedItemCount;
|
||||
}
|
||||
|
||||
var progressHtml = LibraryBrowser.getItemProgressBarHtml(userData);
|
||||
|
@ -1526,18 +1373,15 @@
|
|||
$('.hasrefreshtime').removeClass('hasrefreshtime').removeAttr('data-lastrefresh');
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes);
|
||||
Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes);
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', clearRefreshTimes);
|
||||
Events.on(ConnectionManager, 'localusersignedout', clearRefreshTimes);
|
||||
|
||||
})(jQuery, document, window);
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
var html = '';
|
||||
|
||||
var backIcon = $.browser.safari ? 'chevron-left' : 'arrow-back';
|
||||
var backIcon = browserInfo.safari ? 'chevron-left' : 'arrow-back';
|
||||
|
||||
html += '<paper-icon-button icon="' + backIcon + '" class="headerButton headerButtonLeft headerBackButton hide"></paper-icon-button>';
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
|||
html += '<div class="viewMenuSearch hide">';
|
||||
html += '<form class="viewMenuSearchForm">';
|
||||
html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />';
|
||||
html += '<iron-icon class="searchInputIcon" icon="search"></iron-icon>';
|
||||
html += '<paper-icon-button icon="close" class="btnCloseSearch"></paper-icon-button>';
|
||||
html += '</form>';
|
||||
html += '</div>';
|
||||
|
@ -38,7 +37,7 @@
|
|||
html += '<paper-icon-button icon="person" class="headerButton headerButtonRight headerUserButton" onclick="return Dashboard.showUserFlyout(this);"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (!$.browser.mobile && !Dashboard.isConnectMode()) {
|
||||
if (!browserInfo.mobile && !Dashboard.isConnectMode()) {
|
||||
html += '<paper-icon-button icon="settings" class="headerButton headerButtonRight dashboardEntryHeaderButton" onclick="return LibraryMenu.onSettingsClicked(event);"></paper-icon-button>';
|
||||
}
|
||||
|
||||
|
@ -53,7 +52,7 @@
|
|||
|
||||
ImageLoader.lazyChildren(document.querySelector('.viewMenuBar'));
|
||||
|
||||
Events.trigger(document, 'headercreated');
|
||||
document.dispatchEvent(new CustomEvent("headercreated", {}));
|
||||
bindMenuEvents();
|
||||
}
|
||||
|
||||
|
@ -71,43 +70,6 @@
|
|||
|
||||
var header = document.querySelector('.viewMenuBar');
|
||||
|
||||
var headerSearchButton = document.querySelector('.headerSearchButton');
|
||||
|
||||
if (user.localUser) {
|
||||
$('.btnCast', header).visible(true);
|
||||
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.remove('hide');
|
||||
}
|
||||
|
||||
requirejs(['voice/voice'], function () {
|
||||
|
||||
if (VoiceInputManager.isSupported()) {
|
||||
document.querySelector('.headerVoiceButton').classList.remove('hide');
|
||||
} else {
|
||||
document.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
$('.btnCast', header).visible(false);
|
||||
document.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
var dashboardEntryHeaderButton = document.querySelector('.dashboardEntryHeaderButton');
|
||||
|
||||
if (dashboardEntryHeaderButton) {
|
||||
if (user.canManageServer) {
|
||||
dashboardEntryHeaderButton.classList.remove('hide');
|
||||
} else {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (user.name) {
|
||||
if (user.imageUrl && AppInfo.enableUserImage) {
|
||||
|
||||
|
@ -127,6 +89,60 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateLocalUser(user.localUser);
|
||||
requiresUserRefresh = false;
|
||||
}
|
||||
|
||||
function updateLocalUser(user) {
|
||||
|
||||
var header = document.querySelector('.viewMenuBar');
|
||||
|
||||
var headerSearchButton = header.querySelector('.headerSearchButton');
|
||||
var btnCast = header.querySelector('.btnCast');
|
||||
var dashboardEntryHeaderButton = header.querySelector('.dashboardEntryHeaderButton');
|
||||
|
||||
if (user) {
|
||||
btnCast.classList.remove('hide');
|
||||
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.remove('hide');
|
||||
}
|
||||
|
||||
if (dashboardEntryHeaderButton) {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
dashboardEntryHeaderButton.classList.remove('hide');
|
||||
} else {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
requirejs(['voice/voice'], function () {
|
||||
|
||||
if (VoiceInputManager.isSupported()) {
|
||||
header.querySelector('.headerVoiceButton').classList.remove('hide');
|
||||
} else {
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
btnCast.classList.add('hide');
|
||||
header.querySelector('.headerVoiceButton').classList.add('hide');
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.classList.add('hide');
|
||||
}
|
||||
|
||||
if (dashboardEntryHeaderButton) {
|
||||
dashboardEntryHeaderButton.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeUserFromHeader() {
|
||||
|
||||
updateLocalUser(null);
|
||||
}
|
||||
|
||||
function bindMenuEvents() {
|
||||
|
@ -134,40 +150,20 @@
|
|||
var mainDrawerButton = document.querySelector('.mainDrawerButton');
|
||||
|
||||
if (mainDrawerButton) {
|
||||
if (AppInfo.isTouchPreferred || $.browser.mobile) {
|
||||
|
||||
Events.on(mainDrawerButton, 'click', openMainDrawer);
|
||||
|
||||
} else {
|
||||
$(mainDrawerButton).createHoverTouch().on('hovertouch', openMainDrawer);
|
||||
}
|
||||
mainDrawerButton.addEventListener('click', openMainDrawer);
|
||||
}
|
||||
|
||||
var headerBackButton = document.querySelector('.headerBackButton');
|
||||
if (headerBackButton) {
|
||||
Events.on(headerBackButton, 'click', onBackClick);
|
||||
headerBackButton.addEventListener('click', onBackClick);
|
||||
}
|
||||
|
||||
var viewMenuBar = document.querySelector(".viewMenuBar");
|
||||
initHeadRoom(viewMenuBar);
|
||||
}
|
||||
|
||||
function updateViewMenuBarHeadroom(page, viewMenuBar) {
|
||||
|
||||
//if (page.classList.contains('libraryPage')) {
|
||||
// // Don't like this timeout at all but if headroom is activated during the page events it will jump and flicker on us
|
||||
// setTimeout(reEnableHeadroom, 700);
|
||||
//} else {
|
||||
// viewMenuBar.classList.add('headroomDisabled');
|
||||
//}
|
||||
}
|
||||
|
||||
function reEnableHeadroom() {
|
||||
|
||||
//var headroomDisabled = document.querySelectorAll('.headroomDisabled');
|
||||
//for (var i = 0, length = headroomDisabled.length; i < length; i++) {
|
||||
// headroomDisabled[i].classList.remove('headroomDisabled');
|
||||
//}
|
||||
viewMenuBar.querySelector('.btnNotifications').addEventListener('click', function () {
|
||||
Dashboard.navigate('notificationlist.html');
|
||||
});
|
||||
}
|
||||
|
||||
function getItemHref(item, context) {
|
||||
|
@ -177,6 +173,7 @@
|
|||
|
||||
var requiresDrawerRefresh = true;
|
||||
var requiresDashboardDrawerRefresh = true;
|
||||
var requiresUserRefresh = true;
|
||||
var lastOpenTime = new Date().getTime();
|
||||
|
||||
function openMainDrawer() {
|
||||
|
@ -185,9 +182,10 @@
|
|||
drawerPanel.openDrawer();
|
||||
lastOpenTime = new Date().getTime();
|
||||
}
|
||||
|
||||
function onMainDrawerOpened() {
|
||||
|
||||
if ($.browser.mobile) {
|
||||
if (browserInfo.mobile) {
|
||||
document.body.classList.add('bodyWithPopupOpen');
|
||||
}
|
||||
|
||||
|
@ -195,7 +193,7 @@
|
|||
|
||||
if (requiresDrawerRefresh || requiresDashboardDrawerRefresh) {
|
||||
|
||||
ConnectionManager.user(window.ApiClient).done(function (user) {
|
||||
ConnectionManager.user(window.ApiClient).then(function (user) {
|
||||
|
||||
var drawer = document.querySelector('.mainDrawerPanel .mainDrawer');
|
||||
|
||||
|
@ -223,15 +221,21 @@
|
|||
|
||||
document.querySelector('.mainDrawerPanel #drawer').classList.add('verticalScrollingDrawer');
|
||||
}
|
||||
function onMainDrawerClosed() {
|
||||
|
||||
document.body.classList.remove('bodyWithPopupOpen');
|
||||
document.querySelector('.mainDrawerPanel #drawer').classList.remove('verticalScrollingDrawer');
|
||||
}
|
||||
function closeMainDrawer() {
|
||||
|
||||
document.querySelector('.mainDrawerPanel').closeDrawer();
|
||||
}
|
||||
function onMainDrawerSelect(e) {
|
||||
|
||||
var drawer = e.target;
|
||||
|
||||
if (drawer.selected != 'drawer') {
|
||||
document.body.classList.remove('bodyWithPopupOpen');
|
||||
document.querySelector('.mainDrawerPanel #drawer').classList.remove('verticalScrollingDrawer');
|
||||
} else {
|
||||
onMainDrawerOpened();
|
||||
}
|
||||
}
|
||||
|
||||
function ensureDrawerStructure(drawer) {
|
||||
|
||||
|
@ -261,7 +265,7 @@
|
|||
|
||||
var userAtTop = showUserAtTop();
|
||||
|
||||
var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html';
|
||||
var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html?showuser=1';
|
||||
|
||||
var hasUserImage = user.imageUrl && AppInfo.enableUserImage;
|
||||
|
||||
|
@ -307,7 +311,6 @@
|
|||
var userHeader = drawer.querySelector('.userheader');
|
||||
|
||||
userHeader.innerHTML = html;
|
||||
|
||||
ImageLoader.fillImages(userHeader.getElementsByClassName('lazy'));
|
||||
}
|
||||
|
||||
|
@ -336,10 +339,6 @@
|
|||
drawer.querySelector('.dashboardDrawerContent').innerHTML = html;
|
||||
}
|
||||
|
||||
function replaceAll(string, find, replace) {
|
||||
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
|
||||
}
|
||||
|
||||
function refreshBottomUserInfoInDrawer(user, drawer) {
|
||||
|
||||
var html = '';
|
||||
|
@ -354,7 +353,7 @@
|
|||
html += '<a class="sidebarLink lnkMediaFolder lnkManageServer" data-itemid="dashboard" href="#"><iron-icon icon="dashboard" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonManageServer') + '</span></a>';
|
||||
html += '<a class="sidebarLink lnkMediaFolder editorViewMenu" data-itemid="editor" onclick="return LibraryMenu.onLinkClicked(event, this);" href="edititemmetadata.html"><iron-icon icon="mode-edit" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonMetadataManager') + '</span></a>';
|
||||
|
||||
if (!$.browser.mobile) {
|
||||
if (!browserInfo.mobile) {
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="reports" onclick="return LibraryMenu.onLinkClicked(event, this);" href="reports.html"><iron-icon icon="insert-chart" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonReports') + '</span></a>';
|
||||
}
|
||||
html += '</div>';
|
||||
|
@ -370,7 +369,7 @@
|
|||
html += '<a class="sidebarLink lnkMediaFolder lnkMySync" data-itemid="mysync" onclick="return LibraryMenu.onLinkClicked(event, this);" href="mysync.html"><iron-icon icon="sync" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSync') + '</span></a>';
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="selectserver" onclick="return LibraryMenu.onLinkClicked(event, this);" href="selectserver.html"><iron-icon icon="wifi" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="selectserver" onclick="return LibraryMenu.onLinkClicked(event, this);" href="selectserver.html?showuser=1"><iron-icon icon="wifi" class="sidebarLinkIcon"></iron-icon><span class="sidebarLinkText">' + Globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
}
|
||||
|
||||
if (showUserAtTop()) {
|
||||
|
@ -381,7 +380,7 @@
|
|||
|
||||
drawer.querySelector('.userFooter').innerHTML = html;
|
||||
|
||||
Events.on(drawer.querySelector('.lnkManageServer'), 'click', onManageServerClicked);
|
||||
drawer.querySelector('.lnkManageServer').addEventListener('click', onManageServerClicked);
|
||||
}
|
||||
|
||||
function onSidebarLinkClick() {
|
||||
|
@ -395,7 +394,7 @@
|
|||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
apiClient.getUserViews({}, userId).done(function (result) {
|
||||
apiClient.getUserViews({}, userId).then(function (result) {
|
||||
|
||||
var items = result.Items;
|
||||
|
||||
|
@ -441,9 +440,9 @@
|
|||
|
||||
if (!user) {
|
||||
|
||||
$('.adminMenuOptions').visible(false);
|
||||
$('.lnkMySync').visible(false);
|
||||
$('.userMenuOptions').visible(false);
|
||||
$('.adminMenuOptions').addClass('hide');
|
||||
$('.lnkMySync').addClass('hide');
|
||||
$('.userMenuOptions').addClass('hide');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -451,7 +450,7 @@
|
|||
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
getUserViews(apiClient, userId).done(function (result) {
|
||||
getUserViews(apiClient, userId).then(function (result) {
|
||||
|
||||
var items = result;
|
||||
|
||||
|
@ -525,24 +524,23 @@
|
|||
});
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
$('.adminMenuOptions').visible(true);
|
||||
$('.adminMenuOptions').removeClass('hide');
|
||||
} else {
|
||||
$('.adminMenuOptions').visible(false);
|
||||
$('.adminMenuOptions').addClass('hide');
|
||||
}
|
||||
|
||||
if (user.Policy.EnableSync) {
|
||||
$('.lnkMySync').visible(true);
|
||||
$('.lnkMySync').removeClass('hide');
|
||||
} else {
|
||||
$('.lnkMySync').visible(false);
|
||||
$('.lnkMySync').addClass('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function showUserAtTop() {
|
||||
return Dashboard.isConnectMode() || $.browser.mobile;
|
||||
return Dashboard.isConnectMode() || browserInfo.mobile;
|
||||
}
|
||||
|
||||
var requiresLibraryMenuRefresh = false;
|
||||
var requiresViewMenuRefresh = false;
|
||||
|
||||
function onManageServerClicked() {
|
||||
|
||||
|
@ -571,16 +569,22 @@
|
|||
setTimeout(function () {
|
||||
closeMainDrawer();
|
||||
|
||||
// On mobile devices don't navigate until after the closing animation has completed or it may stutter
|
||||
var delay = browserInfo.mobile ? 350 : 150;
|
||||
|
||||
setTimeout(function () {
|
||||
if (action) {
|
||||
action();
|
||||
} else {
|
||||
Dashboard.navigate(link.href);
|
||||
}
|
||||
}, 400);
|
||||
}, delay);
|
||||
|
||||
}, 50);
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return false;
|
||||
},
|
||||
|
||||
|
@ -590,9 +594,12 @@
|
|||
|
||||
closeMainDrawer();
|
||||
|
||||
// On mobile devices don't navigate until after the closing animation has completed or it may stutter
|
||||
var delay = browserInfo.mobile ? 350 : 150;
|
||||
|
||||
setTimeout(function () {
|
||||
Dashboard.logout();
|
||||
}, 400);
|
||||
}, delay);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -635,7 +642,7 @@
|
|||
var mainDrawerButton = document.querySelector('.mainDrawerButton');
|
||||
|
||||
if (mainDrawerButton) {
|
||||
if (!visible && $.browser.mobile) {
|
||||
if (!visible && browserInfo.mobile) {
|
||||
mainDrawerButton.classList.remove('hide');
|
||||
} else {
|
||||
mainDrawerButton.classList.remove('hide');
|
||||
|
@ -722,7 +729,6 @@
|
|||
}
|
||||
|
||||
function updateTabLinks(page) {
|
||||
var context = getParameterByName('context');
|
||||
|
||||
var elems = page.querySelectorAll('.scopedLibraryViewNav a');
|
||||
|
||||
|
@ -767,36 +773,13 @@
|
|||
var viewMenuBar = document.querySelector('.viewMenuBar');
|
||||
|
||||
if (page.classList.contains('standalonePage')) {
|
||||
if (viewMenuBar) {
|
||||
viewMenuBar.classList.add('hide');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (requiresViewMenuRefresh) {
|
||||
if (viewMenuBar) {
|
||||
viewMenuBar.parentNode.removeChild(viewMenuBar);
|
||||
viewMenuBar = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!viewMenuBar) {
|
||||
|
||||
renderHeader();
|
||||
updateViewMenuBarHeadroom(page, document.querySelector('.viewMenuBar'));
|
||||
|
||||
updateCastIcon();
|
||||
|
||||
updateLibraryNavLinks(page);
|
||||
requiresViewMenuRefresh = false;
|
||||
|
||||
ConnectionManager.user(window.ApiClient).done(addUserToHeader);
|
||||
|
||||
viewMenuBar.classList.add('hide');
|
||||
} else {
|
||||
viewMenuBar.classList.remove('hide');
|
||||
updateLibraryNavLinks(page);
|
||||
updateViewMenuBarHeadroom(page, viewMenuBar);
|
||||
requiresViewMenuRefresh = false;
|
||||
}
|
||||
|
||||
if (requiresUserRefresh) {
|
||||
ConnectionManager.user(window.ApiClient).then(addUserToHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,63 +791,23 @@
|
|||
requiresDashboardDrawerRefresh = true;
|
||||
}
|
||||
|
||||
onPageBeforeShowDocumentReady(page);
|
||||
|
||||
buildViewMenuBar(page);
|
||||
updateTabLinks(page);
|
||||
});
|
||||
|
||||
pageClassOn('pageshow', 'page', function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
onPageShowDocumentReady(page);
|
||||
if (!NavHelper.isBack()) {
|
||||
// Scroll back up so in case vertical scroll was messed with
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//pageClassOn('pagebeforehide', 'page', function () {
|
||||
|
||||
// var headroomEnabled = document.querySelectorAll('.headroomEnabled');
|
||||
// for (var i = 0, length = headroomEnabled.length; i < length; i++) {
|
||||
// headroomEnabled[i].classList.add('headroomDisabled');
|
||||
// }
|
||||
|
||||
//});
|
||||
|
||||
function onPageBeforeShowDocumentReady(page) {
|
||||
|
||||
buildViewMenuBar(page);
|
||||
updateTitle(page);
|
||||
updateBackButton(page);
|
||||
|
||||
var isLibraryPage = page.classList.contains('libraryPage');
|
||||
var darkDrawer = false;
|
||||
|
||||
var title = page.getAttribute('data-title') || page.getAttribute('data-contextname');
|
||||
|
||||
if (!title) {
|
||||
var titleKey = getParameterByName('titlekey');
|
||||
|
||||
if (titleKey) {
|
||||
title = Globalize.translate(titleKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (!title) {
|
||||
if (page.classList.contains('type-interior')) {
|
||||
title = Globalize.translate('ButtonHome');
|
||||
}
|
||||
}
|
||||
|
||||
if (title) {
|
||||
LibraryMenu.setTitle(title);
|
||||
}
|
||||
|
||||
var mainDrawerButton = document.querySelector('.mainDrawerButton');
|
||||
|
||||
if (mainDrawerButton) {
|
||||
if (page.getAttribute('data-menubutton') == 'false' && $.browser.mobile) {
|
||||
mainDrawerButton.classList.remove('hide');
|
||||
} else {
|
||||
mainDrawerButton.classList.remove('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (isLibraryPage) {
|
||||
|
||||
|
@ -890,7 +833,9 @@
|
|||
document.body.classList.add('hideMainDrawer');
|
||||
}
|
||||
|
||||
if (!Dashboard.isConnectMode() && !$.browser.mobile) {
|
||||
// Set drawer background color
|
||||
var darkDrawer = false;
|
||||
if (!Dashboard.isConnectMode() && !browserInfo.mobile) {
|
||||
darkDrawer = true;
|
||||
}
|
||||
|
||||
|
@ -902,8 +847,28 @@
|
|||
drawer.classList.remove('darkDrawer');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
updateBackButton(page);
|
||||
function updateTitle(page) {
|
||||
var title = page.getAttribute('data-title') || page.getAttribute('data-contextname');
|
||||
|
||||
if (!title) {
|
||||
var titleKey = getParameterByName('titlekey');
|
||||
|
||||
if (titleKey) {
|
||||
title = Globalize.translate(titleKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (!title) {
|
||||
if (page.classList.contains('type-interior')) {
|
||||
title = Globalize.translate('ButtonHome');
|
||||
}
|
||||
}
|
||||
|
||||
if (title) {
|
||||
LibraryMenu.setTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
function updateBackButton(page) {
|
||||
|
@ -927,22 +892,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onPageShowDocumentReady(page) {
|
||||
|
||||
if (!NavHelper.isBack()) {
|
||||
// Scroll back up so in case vertical scroll was messed with
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
updateTabLinks(page);
|
||||
}
|
||||
|
||||
function initHeadRoom(elem) {
|
||||
|
||||
if (!AppInfo.enableHeadRoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
requirejs(["thirdparty/headroom"], function () {
|
||||
requirejs(["headroom"], function () {
|
||||
|
||||
// construct an instance of Headroom, passing the element
|
||||
var headroom = new Headroom(elem, {
|
||||
|
@ -966,100 +922,47 @@
|
|||
Events.on(apiClient, 'websocketmessage', onWebSocketMessage);
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
var mainDrawerPanel = document.querySelector('.mainDrawerPanel');
|
||||
mainDrawerPanel.addEventListener('iron-select', onMainDrawerSelect);
|
||||
|
||||
Events.on(ConnectionManager, 'apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
renderHeader();
|
||||
|
||||
});
|
||||
Events.on(ConnectionManager, 'apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', function () {
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresViewMenuRefresh = true;
|
||||
requiresDrawerRefresh = true;
|
||||
});
|
||||
Events.on(ConnectionManager, 'localusersignedin', function (e, user) {
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresDrawerRefresh = true;
|
||||
ConnectionManager.user(ConnectionManager.getApiClient(user.ServerId)).then(addUserToHeader);
|
||||
});
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedout', function () {
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresViewMenuRefresh = true;
|
||||
requiresDrawerRefresh = true;
|
||||
});
|
||||
Events.on(ConnectionManager, 'localusersignedout', function () {
|
||||
requiresLibraryMenuRefresh = true;
|
||||
requiresDrawerRefresh = true;
|
||||
removeUserFromHeader();
|
||||
});
|
||||
|
||||
Events.on(MediaController, 'playerchange', function () {
|
||||
updateCastIcon();
|
||||
});
|
||||
|
||||
var mainDrawerPanel = document.querySelector('.mainDrawerPanel');
|
||||
Events.on(mainDrawerPanel, 'paper-drawer-panel-open', onMainDrawerOpened);
|
||||
Events.on(mainDrawerPanel, 'paper-drawer-panel-close', onMainDrawerClosed);
|
||||
Events.on(MediaController, 'playerchange', function () {
|
||||
updateCastIcon();
|
||||
});
|
||||
|
||||
})(window, document, jQuery, window.devicePixelRatio);
|
||||
|
||||
$.fn.createHoverTouch = function () {
|
||||
|
||||
var preventHover = false;
|
||||
var timerId;
|
||||
|
||||
function startTimer(elem) {
|
||||
|
||||
stopTimer();
|
||||
|
||||
timerId = setTimeout(function () {
|
||||
|
||||
Events.trigger(elem, 'hovertouch');
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function stopTimer(elem) {
|
||||
|
||||
if (timerId) {
|
||||
clearTimeout(timerId);
|
||||
timerId = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $(this).on('mouseenter', function () {
|
||||
|
||||
if (preventHover === true) {
|
||||
preventHover = false;
|
||||
return;
|
||||
}
|
||||
|
||||
startTimer(this);
|
||||
|
||||
}).on('mouseleave', function () {
|
||||
|
||||
stopTimer(this);
|
||||
|
||||
}).on('touchstart', function () {
|
||||
|
||||
preventHover = true;
|
||||
|
||||
}).on('click', function () {
|
||||
|
||||
preventHover = true;
|
||||
|
||||
if (preventHover) {
|
||||
Events.trigger(this, 'hovertouch');
|
||||
stopTimer(this);
|
||||
preventHover = false;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
(function () {
|
||||
|
||||
var isCurrentNavBack = false;
|
||||
|
||||
$(window).on("navigate", function (e, data) {
|
||||
data = data.state || {};
|
||||
isCurrentNavBack = data.direction == 'back';
|
||||
window.addEventListener("navigate", function (e) {
|
||||
|
||||
var data = e.detail.state || {};
|
||||
var direction = data.direction;
|
||||
|
||||
isCurrentNavBack = direction == 'back';
|
||||
});
|
||||
|
||||
function isBack() {
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
if (result) {
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.PathSubstitutions.splice(index, 1);
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(function () {
|
||||
ApiClient.updateServerConfiguration(config).then(function () {
|
||||
|
||||
reload(page);
|
||||
});
|
||||
|
@ -87,7 +87,7 @@
|
|||
$('#txtFrom', page).val('');
|
||||
$('#txtTo', page).val('');
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
@ -100,10 +100,10 @@
|
|||
var form = this;
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
addSubstitution(page, config);
|
||||
ApiClient.updateServerConfiguration(config).done(function () {
|
||||
ApiClient.updateServerConfiguration(config).then(function () {
|
||||
|
||||
reload(page);
|
||||
});
|
||||
|
@ -123,7 +123,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
|||
config.EnableAudioArchiveFiles = $('#chkEnableAudioArchiveFiles', form).checked();
|
||||
config.EnableVideoArchiveFiles = $('#chkEnableVideoArchiveFiles', form).checked();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
ApiClient.getSystemInfo().done(function (systemInfo) {
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
|
||||
if (systemInfo.SupportsLibraryMonitor) {
|
||||
page.querySelector('.fldLibraryMonitor').classList.remove('hide');
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
HasAired: false,
|
||||
SortBy: "StartDate"
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
renderPrograms(page, result);
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
query.UserId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getLiveTvChannels(query).done(function (result) {
|
||||
ApiClient.getLiveTvChannels(query).then(function (result) {
|
||||
|
||||
renderChannels(page, viewPanel, result);
|
||||
|
||||
|
|
|
@ -1,96 +1,102 @@
|
|||
(function () {
|
||||
|
||||
function getTimersHtml(timers) {
|
||||
var html = '';
|
||||
|
||||
var index = '';
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
for (var i = 0, length = timers.length; i < length; i++) {
|
||||
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
|
||||
var html = '';
|
||||
|
||||
var timer = timers[i];
|
||||
var index = '';
|
||||
|
||||
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
|
||||
for (var i = 0, length = timers.length; i < length; i++) {
|
||||
|
||||
if (startDateText != index) {
|
||||
var timer = timers[i];
|
||||
|
||||
if (index) {
|
||||
var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true }));
|
||||
|
||||
if (startDateText != index) {
|
||||
|
||||
if (index) {
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '<div class="homePageSection">';
|
||||
html += '<h1>' + startDateText + '</h1>';
|
||||
html += '<div class="paperList">';
|
||||
index = startDateText;
|
||||
}
|
||||
|
||||
html += '<paper-icon-item>';
|
||||
|
||||
var program = timer.ProgramInfo || {};
|
||||
var imgUrl;
|
||||
|
||||
if (program.ImageTags && program.ImageTags.Primary) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
|
||||
height: 80,
|
||||
tag: program.ImageTags.Primary,
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<paper-fab mini class="blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsKids) {
|
||||
html += '<paper-fab mini style="background:#2196F3;" icon="person" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsSports) {
|
||||
html += '<paper-fab mini style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsMovie) {
|
||||
html += '<paper-fab mini icon="movie" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsNews) {
|
||||
html += '<paper-fab mini style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
|
||||
}
|
||||
else {
|
||||
html += '<paper-fab mini class="blue" icon="live-tv" item-icon></paper-fab>';
|
||||
}
|
||||
|
||||
html += '<paper-item-body two-line>';
|
||||
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
|
||||
|
||||
html += '<div>';
|
||||
html += timer.Name;
|
||||
html += '</div>';
|
||||
|
||||
html += '<div secondary>';
|
||||
html += LibraryBrowser.getDisplayTime(timer.StartDate);
|
||||
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
|
||||
html += '</div>';
|
||||
|
||||
html += '</a>';
|
||||
html += '</paper-item-body>';
|
||||
|
||||
if (timer.SeriesTimerId) {
|
||||
html += '<div class="ui-li-aside" style="right:0;">';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
|
||||
|
||||
html += '</paper-icon-item>';
|
||||
}
|
||||
|
||||
if (timers.length) {
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '<div class="homePageSection">';
|
||||
html += '<h1>' + startDateText + '</h1>';
|
||||
html += '<div class="paperList">';
|
||||
index = startDateText;
|
||||
}
|
||||
|
||||
html += '<paper-icon-item>';
|
||||
|
||||
var program = timer.ProgramInfo || {};
|
||||
var imgUrl;
|
||||
|
||||
if (program.ImageTags && program.ImageTags.Primary) {
|
||||
|
||||
imgUrl = ApiClient.getScaledImageUrl(program.Id, {
|
||||
height: 80,
|
||||
tag: program.ImageTags.Primary,
|
||||
type: "Primary"
|
||||
});
|
||||
}
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<paper-fab mini class="blue" style="background-image:url(\'' + imgUrl + '\');background-repeat:no-repeat;background-position:center center;background-size: cover;" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsKids) {
|
||||
html += '<paper-fab mini style="background:#2196F3;" icon="person" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsSports) {
|
||||
html += '<paper-fab mini style="background:#8BC34A;" icon="person" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsMovie) {
|
||||
html += '<paper-fab mini icon="movie" item-icon></paper-fab>';
|
||||
}
|
||||
else if (program.IsNews) {
|
||||
html += '<paper-fab mini style="background:#673AB7;" icon="new-releases" item-icon></paper-fab>';
|
||||
}
|
||||
else {
|
||||
html += '<paper-fab mini class="blue" icon="live-tv" item-icon></paper-fab>';
|
||||
}
|
||||
|
||||
html += '<paper-item-body two-line>';
|
||||
html += '<a class="clearLink" href="livetvtimer.html?id=' + timer.Id + '">';
|
||||
|
||||
html += '<div>';
|
||||
html += timer.Name;
|
||||
html += '</div>';
|
||||
|
||||
html += '<div secondary>';
|
||||
html += LibraryBrowser.getDisplayTime(timer.StartDate);
|
||||
html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate);
|
||||
html += '</div>';
|
||||
|
||||
html += '</a>';
|
||||
html += '</paper-item-body>';
|
||||
|
||||
if (timer.SeriesTimerId) {
|
||||
html += '<div class="ui-li-aside" style="right:0;">';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '<div class="timerCircle seriesTimerCircle"></div>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '<paper-icon-button icon="cancel" data-timerid="' + timer.Id + '" title="' + Globalize.translate('ButonCancelRecording') + '" class="btnDeleteTimer"></paper-icon-button>';
|
||||
|
||||
html += '</paper-icon-item>';
|
||||
}
|
||||
|
||||
if (timers.length) {
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
return html;
|
||||
resolve(html);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
window.LiveTvHelpers = {
|
||||
|
@ -244,7 +250,7 @@
|
|||
|
||||
function showOverlay(elem, item) {
|
||||
|
||||
require(['components/paperdialoghelper'], function () {
|
||||
require(['components/paperdialoghelper', 'scale-up-animation', 'fade-out-animation'], function () {
|
||||
|
||||
var dlg = document.createElement('paper-dialog');
|
||||
|
||||
|
@ -342,7 +348,7 @@
|
|||
|
||||
var id = elem.getAttribute('data-programid');
|
||||
|
||||
ApiClient.getLiveTvProgram(id, Dashboard.getCurrentUserId()).done(function (item) {
|
||||
ApiClient.getLiveTvProgram(id, Dashboard.getCurrentUserId()).then(function (item) {
|
||||
|
||||
showOverlay(elem, item);
|
||||
|
||||
|
|
|
@ -15,19 +15,20 @@
|
|||
|
||||
function loadTemplate(page, type, providerId) {
|
||||
|
||||
HttpClient.send({
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/tvproviders/' + type + '.template.html', true);
|
||||
|
||||
type: 'GET',
|
||||
url: 'components/tvproviders/' + type + '.template.html'
|
||||
|
||||
}).done(function (html) {
|
||||
xhr.onload = function (e) {
|
||||
|
||||
var html = this.response;
|
||||
var elem = page.querySelector('.providerTemplate');
|
||||
elem.innerHTML = Globalize.translateDocument(html);
|
||||
$(elem).trigger('create');
|
||||
|
||||
init(page, type, providerId);
|
||||
});
|
||||
}
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#liveTvGuideProviderPage", function () {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getLiveTvPrograms(query).done(function (result) {
|
||||
ApiClient.getLiveTvPrograms(query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -85,7 +85,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#liveTvItemsPage", function () {
|
||||
pageIdOn('pagebeforeshow', "liveTvItemsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
|
||||
ProgramId: programId,
|
||||
Feature: 'seriesrecordings'
|
||||
})).done(function (result) {
|
||||
})).then(function (result) {
|
||||
|
||||
lastRegId = programId;
|
||||
registrationInfo = result;
|
||||
deferred.resolveWith(null, [registrationInfo]);
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
|
||||
deferred.resolveWith(null, [
|
||||
{
|
||||
|
@ -84,10 +84,10 @@
|
|||
var promise1 = ApiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
||||
var promise2 = ApiClient.getLiveTvProgram(programId, Dashboard.getCurrentUserId());
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var defaults = response1[0];
|
||||
var program = response2[0];
|
||||
var defaults = responses[0];
|
||||
var program = responses[1];
|
||||
|
||||
renderRecording(page, defaults, program);
|
||||
});
|
||||
|
@ -142,7 +142,7 @@
|
|||
|
||||
var programId = getParameterByName('programid');
|
||||
|
||||
ApiClient.getNewLiveTvTimerDefaults({ programId: programId }).done(function (item) {
|
||||
ApiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (item) {
|
||||
|
||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||
|
@ -155,7 +155,7 @@
|
|||
|
||||
if ($('#chkRecordSeries', form).checked()) {
|
||||
|
||||
ApiClient.createLiveTvSeriesTimer(item).done(function () {
|
||||
ApiClient.createLiveTvSeriesTimer(item).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.navigate('livetv.html');
|
||||
|
@ -163,7 +163,7 @@
|
|||
});
|
||||
|
||||
} else {
|
||||
ApiClient.createLiveTvTimer(item).done(function () {
|
||||
ApiClient.createLiveTvTimer(item).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.navigate('livetv.html');
|
||||
|
@ -187,7 +187,7 @@
|
|||
$('#seriesFields', page).show();
|
||||
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
||||
|
||||
getRegistration(getParameterByName('programid')).done(function (regInfo) {
|
||||
getRegistration(getParameterByName('programid')).then(function (regInfo) {
|
||||
|
||||
if (regInfo.IsValid) {
|
||||
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getLiveTvRecordings(query).done(function (result) {
|
||||
ApiClient.getLiveTvRecordings(query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -107,7 +107,7 @@
|
|||
|
||||
if (query.GroupId) {
|
||||
|
||||
ApiClient.getLiveTvRecordingGroup(query.GroupId).done(function (group) {
|
||||
ApiClient.getLiveTvRecordingGroup(query.GroupId).then(function (group) {
|
||||
$('.listName', page).html(group.Name);
|
||||
});
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
IsInProgress: true
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
renderRecordings(page.querySelector('#activeRecordings'), result.Items);
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
limit: 12,
|
||||
IsInProgress: false
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
renderRecordings(page.querySelector('#latestRecordings'), result.Items);
|
||||
});
|
||||
|
@ -107,10 +107,11 @@
|
|||
|
||||
userId: Dashboard.getCurrentUserId()
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
renderRecordingGroups(page, result.Items);
|
||||
}).then(function (result) {
|
||||
|
||||
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
|
||||
renderRecordingGroups(page, result.Items);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
||||
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getLiveTvSeriesTimer(currentItem.Id).done(function (item) {
|
||||
ApiClient.getLiveTvSeriesTimer(currentItem.Id).then(function (item) {
|
||||
|
||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||
|
@ -114,7 +114,7 @@
|
|||
|
||||
item.Days = getDays(form);
|
||||
|
||||
ApiClient.updateLiveTvSeriesTimer(item).done(function () {
|
||||
ApiClient.updateLiveTvSeriesTimer(item).then(function () {
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
||||
});
|
||||
});
|
||||
|
@ -141,15 +141,15 @@
|
|||
|
||||
var timers = result.Items;
|
||||
|
||||
var html = LiveTvHelpers.getTimersHtml(timers);
|
||||
LiveTvHelpers.getTimersHtml(timers).then(function(html) {
|
||||
var elem = $('.scheduleTab', page).html(html);
|
||||
|
||||
var elem = $('.scheduleTab', page).html(html);
|
||||
$('.btnDeleteTimer', elem).on('click', function () {
|
||||
|
||||
$('.btnDeleteTimer', elem).on('click', function () {
|
||||
var id = this.getAttribute('data-timerid');
|
||||
|
||||
var id = this.getAttribute('data-timerid');
|
||||
|
||||
deleteTimer(page, id);
|
||||
deleteTimer(page, id);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@
|
|||
|
||||
var id = getParameterByName('id');
|
||||
|
||||
ApiClient.getLiveTvSeriesTimer(id).done(function (result) {
|
||||
ApiClient.getLiveTvSeriesTimer(id).then(function (result) {
|
||||
|
||||
renderTimer(page, result);
|
||||
|
||||
|
@ -170,7 +170,7 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
seriesTimerId: id
|
||||
|
||||
}).done(function (recordingResult) {
|
||||
}).then(function (recordingResult) {
|
||||
|
||||
renderRecordings(page, recordingResult);
|
||||
|
||||
|
@ -180,7 +180,7 @@
|
|||
|
||||
seriesTimerId: id
|
||||
|
||||
}).done(function (timerResult) {
|
||||
}).then(function (timerResult) {
|
||||
|
||||
renderSchedule(page, timerResult);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.cancelLiveTvSeriesTimer(id).done(function () {
|
||||
ApiClient.cancelLiveTvSeriesTimer(id).then(function () {
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageSeriesCancelled'));
|
||||
|
||||
|
@ -102,9 +102,11 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getLiveTvSeriesTimers(query).done(function (result) {
|
||||
ApiClient.getLiveTvSeriesTimers(query).then(function (result) {
|
||||
|
||||
renderTimers(page, result.Items);
|
||||
require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () {
|
||||
renderTimers(page, result.Items);
|
||||
});
|
||||
|
||||
LibraryBrowser.setLastRefreshed(page);
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
config.GuideDays = $('#selectGuideDays', form).val() || null;
|
||||
config.EnableMovieProviders = $('#chkMovies', form).checked();
|
||||
|
@ -34,7 +34,7 @@
|
|||
config.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||
config.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||
|
||||
ApiClient.updateNamedConfiguration("livetv", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("livetv", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
loadPage(page, config);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.resetLiveTvTuner(id).done(function () {
|
||||
ApiClient.resetLiveTvTuner(id).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -172,7 +172,7 @@
|
|||
|
||||
renderTuners(page, tuners);
|
||||
|
||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
renderDevices(page, config.TunerHosts);
|
||||
renderProviders(page, config.ListingProviders);
|
||||
|
@ -243,7 +243,7 @@
|
|||
Id: id
|
||||
})
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
reload(page);
|
||||
});
|
||||
|
@ -255,7 +255,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getLiveTvInfo().done(function (liveTvInfo) {
|
||||
ApiClient.getLiveTvInfo().then(function (liveTvInfo) {
|
||||
|
||||
loadPage(page, liveTvInfo);
|
||||
|
||||
|
@ -276,11 +276,11 @@
|
|||
}),
|
||||
contentType: "application/json"
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
reload(page);
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorAddingTunerDevice')
|
||||
});
|
||||
|
@ -345,7 +345,11 @@
|
|||
Id: id
|
||||
})
|
||||
|
||||
}).always(function () {
|
||||
}).then(function () {
|
||||
|
||||
reload(page);
|
||||
|
||||
}, function () {
|
||||
|
||||
reload(page);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
(function ($, document) {
|
||||
|
||||
function enableScrollX() {
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
||||
}
|
||||
|
||||
function getPortraitShape() {
|
||||
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||
}
|
||||
|
||||
function getThumbShape() {
|
||||
return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
|
||||
}
|
||||
|
||||
function getSquareShape() {
|
||||
return enableScrollX() ? 'overflowSquare' : 'square';
|
||||
}
|
||||
|
||||
function getLimit() {
|
||||
|
||||
return enableScrollX() ? 12 : 8;
|
||||
}
|
||||
|
||||
function loadRecommendedPrograms(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
@ -8,30 +29,15 @@
|
|||
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: true,
|
||||
limit: 16,
|
||||
limit: getLimit() * 2,
|
||||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: "Primary"
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "auto",
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
lazy: true,
|
||||
overlayPlayButton: true
|
||||
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.activeProgramItems');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
Dashboard.hideLoadingMsg();
|
||||
}).then(function (result) {
|
||||
|
||||
renderItems(page, result.Items, 'activeProgramItems', 'play');
|
||||
LibraryBrowser.setLastRefreshed(page);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,30 +50,15 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: false,
|
||||
HasAired: false,
|
||||
limit: 8,
|
||||
limit: getLimit(),
|
||||
IsMovie: false,
|
||||
IsSports: false,
|
||||
IsKids: false,
|
||||
IsSeries: true
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
|
||||
items: result.Items,
|
||||
shape: "auto",
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
lazy: true,
|
||||
overlayMoreButton: true
|
||||
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.upcomingProgramItems');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
renderItems(page, result.Items, 'upcomingProgramItems');
|
||||
});
|
||||
|
||||
ApiClient.getLiveTvRecommendedPrograms({
|
||||
|
@ -75,25 +66,12 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: false,
|
||||
HasAired: false,
|
||||
limit: 8,
|
||||
limit: getLimit(),
|
||||
IsMovie: true
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "portrait",
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
overlayMoreButton: true
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.upcomingTvMovieItems');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
renderItems(page, result.Items, 'upcomingTvMovieItems', null, getPortraitShape());
|
||||
});
|
||||
|
||||
ApiClient.getLiveTvRecommendedPrograms({
|
||||
|
@ -101,25 +79,12 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: false,
|
||||
HasAired: false,
|
||||
limit: 8,
|
||||
limit: getLimit(),
|
||||
IsSports: true
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "auto",
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
overlayMoreButton: true
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.upcomingSportsItems');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
renderItems(page, result.Items, 'upcomingSportsItems');
|
||||
});
|
||||
|
||||
ApiClient.getLiveTvRecommendedPrograms({
|
||||
|
@ -127,28 +92,44 @@
|
|||
userId: Dashboard.getCurrentUserId(),
|
||||
IsAiring: false,
|
||||
HasAired: false,
|
||||
limit: 8,
|
||||
limit: getLimit(),
|
||||
IsKids: true
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "auto",
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
overlayMoreButton: true
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.upcomingKidsItems');
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
renderItems(page, result.Items, 'upcomingKidsItems');
|
||||
});
|
||||
}
|
||||
|
||||
function renderItems(page, items, sectionClass, overlayButton, shape) {
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
items: items,
|
||||
shape: shape || (enableScrollX() ? getSquareShape() : 'auto'),
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
coverImage: true,
|
||||
overlayText: false,
|
||||
lazy: true,
|
||||
overlayMoreButton: overlayButton != 'play',
|
||||
overlayPlayButton: overlayButton == 'play'
|
||||
});
|
||||
|
||||
var elem = page.querySelector('.' + sectionClass);
|
||||
|
||||
elem.innerHTML = html;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
}
|
||||
|
||||
function initSuggestedTab(page, tabContent) {
|
||||
|
||||
if (enableScrollX()) {
|
||||
$('.itemsContainer', tabContent).addClass('hiddenScrollX').createCardMenus();
|
||||
} else {
|
||||
$('.itemsContainer', tabContent).removeClass('hiddenScrollX').createCardMenus();
|
||||
}
|
||||
}
|
||||
|
||||
function renderSuggestedTab(page, tabContent) {
|
||||
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
|
@ -168,9 +149,10 @@
|
|||
|
||||
case 0:
|
||||
renderMethod = 'renderSuggestedTab';
|
||||
initMethod = 'initSuggestedTab';
|
||||
break;
|
||||
case 1:
|
||||
depends.push('scripts/registrationservices');
|
||||
depends.push('registrationservices');
|
||||
depends.push('scripts/livetvguide');
|
||||
renderMethod = 'renderGuideTab';
|
||||
initMethod = 'initGuideTab';
|
||||
|
@ -209,7 +191,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#liveTvSuggestedPage", function () {
|
||||
pageIdOn('pageinit', "liveTvSuggestedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -218,14 +200,15 @@
|
|||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'livetv.html');
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
window.LiveTvPage = {
|
||||
renderSuggestedTab: renderSuggestedTab
|
||||
renderSuggestedTab: renderSuggestedTab,
|
||||
initSuggestedTab: initSuggestedTab
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
||||
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||
|
||||
|
@ -72,12 +72,12 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getLiveTvTimer(currentItem.Id).done(function (item) {
|
||||
ApiClient.getLiveTvTimer(currentItem.Id).then(function (item) {
|
||||
|
||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||
|
||||
ApiClient.updateLiveTvTimer(item).done(function () {
|
||||
ApiClient.updateLiveTvTimer(item).then(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
||||
});
|
||||
|
@ -94,7 +94,7 @@
|
|||
|
||||
var id = getParameterByName('id');
|
||||
|
||||
ApiClient.getLiveTvTimer(id).done(function (result) {
|
||||
ApiClient.getLiveTvTimer(id).then(function (result) {
|
||||
|
||||
renderTimer(page, result);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
||||
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||
|
||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||
|
||||
|
@ -21,25 +21,25 @@
|
|||
|
||||
function renderTimers(page, timers) {
|
||||
|
||||
var html = LiveTvHelpers.getTimersHtml(timers);
|
||||
LiveTvHelpers.getTimersHtml(timers).then(function (html) {
|
||||
var elem = $('#items', page).html(html);
|
||||
|
||||
var elem = $('#items', page).html(html);
|
||||
$('.btnDeleteTimer', elem).on('click', function () {
|
||||
|
||||
$('.btnDeleteTimer', elem).on('click', function () {
|
||||
var id = this.getAttribute('data-timerid');
|
||||
|
||||
var id = this.getAttribute('data-timerid');
|
||||
deleteTimer(page, id);
|
||||
});
|
||||
|
||||
deleteTimer(page, id);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function reload(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getLiveTvTimers().done(function (result) {
|
||||
ApiClient.getLiveTvTimers().then(function (result) {
|
||||
|
||||
renderTimers(page, result.Items);
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
page.querySelector('.chkFavorite').checked = false;
|
||||
|
||||
if (providerId) {
|
||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
var info = config.TunerHosts.filter(function (i) {
|
||||
return i.Id == providerId;
|
||||
|
@ -45,12 +45,12 @@
|
|||
data: JSON.stringify(info),
|
||||
contentType: "application/json"
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
Dashboard.navigate('livetvstatus.html');
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorSavingTvProvider')
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
page.querySelector('.txtDevicePath').value = '';
|
||||
|
||||
if (providerId) {
|
||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||
|
||||
var info = config.TunerHosts.filter(function (i) {
|
||||
return i.Id == providerId;
|
||||
|
@ -37,12 +37,12 @@
|
|||
data: JSON.stringify(info),
|
||||
contentType: "application/json"
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
Dashboard.navigate('livetvstatus.html');
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('ErrorSavingTvProvider')
|
||||
|
|
|
@ -14,28 +14,28 @@
|
|||
return syncPromise.promise();
|
||||
}
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['multiserversync'], function () {
|
||||
require(['multiserversync'], function () {
|
||||
|
||||
options = options || {};
|
||||
options = options || {};
|
||||
|
||||
LocalSync.normalizeSyncOptions(options);
|
||||
LocalSync.normalizeSyncOptions(options);
|
||||
|
||||
options.cameraUploadServers = AppSettings.cameraUploadServers();
|
||||
options.cameraUploadServers = AppSettings.cameraUploadServers();
|
||||
|
||||
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).done(function () {
|
||||
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).then(function () {
|
||||
|
||||
syncPromise = null;
|
||||
deferred.resolve();
|
||||
syncPromise = null;
|
||||
resolve();
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
|
||||
syncPromise = null;
|
||||
syncPromise = null;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
});
|
||||
},
|
||||
|
||||
normalizeSyncOptions: function (options) {
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
getApiClient: function () {
|
||||
|
||||
var serverId = getParameterByName('serverid');
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
if (serverId) {
|
||||
deferred.resolveWith(null, [ConnectionManager.getOrCreateApiClient(serverId)]);
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
} else {
|
||||
deferred.resolveWith(null, [ApiClient]);
|
||||
}
|
||||
if (serverId) {
|
||||
resolve(ConnectionManager.getOrCreateApiClient(serverId));
|
||||
|
||||
return deferred.promise();
|
||||
} else {
|
||||
resolve(ApiClient);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onPageShow: function () {
|
||||
|
@ -21,9 +21,9 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
LoginPage.getApiClient().done(function (apiClient) {
|
||||
LoginPage.getApiClient().then(function (apiClient) {
|
||||
|
||||
apiClient.getPublicUsers().done(function (users) {
|
||||
apiClient.getPublicUsers().then(function (users) {
|
||||
|
||||
var showManualForm = !users.length;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).done(function (options) {
|
||||
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
||||
|
||||
$('.disclaimer', page).html(options.LoginDisclaimer || '');
|
||||
});
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
apiClient.authenticateUserByName(username, password).done(function (result) {
|
||||
apiClient.authenticateUserByName(username, password).then(function (result) {
|
||||
|
||||
var user = result.User;
|
||||
|
||||
|
@ -112,7 +112,7 @@
|
|||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||
Dashboard.navigate(newUrl);
|
||||
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
|
||||
$('#pw', page).val('');
|
||||
$('#txtManualName', page).val('');
|
||||
|
@ -121,7 +121,7 @@
|
|||
Dashboard.hideLoadingMsg();
|
||||
|
||||
setTimeout(function () {
|
||||
Dashboard.showError(Globalize.translate('MessageInvalidUser'));
|
||||
Dashboard.alert(Globalize.translate('MessageInvalidUser'));
|
||||
}, 300);
|
||||
});
|
||||
|
||||
|
@ -207,7 +207,7 @@
|
|||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
LoginPage.getApiClient().done(function (apiClient) {
|
||||
LoginPage.getApiClient().then(function (apiClient) {
|
||||
LoginPage.authenticateUserByName(page, apiClient, $('#txtManualName', page).val(), $('#txtManualPassword', page).val());
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl('System/Logs')).done(function (logs) {
|
||||
apiClient.getJSON(apiClient.getUrl('System/Logs')).then(function (logs) {
|
||||
|
||||
var html = '';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function ($, window) {
|
||||
(function (window) {
|
||||
|
||||
var currentDisplayInfo;
|
||||
function mirrorItem(info) {
|
||||
|
@ -14,9 +14,9 @@
|
|||
});
|
||||
}
|
||||
|
||||
function mirrorIfEnabled() {
|
||||
function mirrorIfEnabled(info) {
|
||||
|
||||
var info = currentDisplayInfo;
|
||||
info = info || currentDisplayInfo;
|
||||
|
||||
if (info && MediaController.enableDisplayMirroring()) {
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showPlayerSelection() {
|
||||
function showPlayerSelection(button) {
|
||||
|
||||
var playerInfo = MediaController.getPlayerInfo();
|
||||
|
||||
|
@ -73,9 +73,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
MediaController.getTargets().done(function (targets) {
|
||||
MediaController.getTargets().then(function (targets) {
|
||||
|
||||
var menuItems = targets.map(function (t) {
|
||||
|
||||
|
@ -95,11 +95,12 @@
|
|||
|
||||
require(['actionsheet'], function () {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
ActionSheetElement.show({
|
||||
title: Globalize.translate('HeaderSelectPlayer'),
|
||||
items: menuItems,
|
||||
positionTo: button,
|
||||
callback: function (id) {
|
||||
|
||||
var target = targets.filter(function (t) {
|
||||
|
@ -117,6 +118,13 @@
|
|||
|
||||
function showActivePlayerMenu(playerInfo) {
|
||||
|
||||
require(['paper-checkbox', 'fade-in-animation', 'fade-out-animation', 'paper-dialog'], function () {
|
||||
showActivePlayerMenuInternal(playerInfo);
|
||||
});
|
||||
}
|
||||
|
||||
function showActivePlayerMenuInternal(playerInfo) {
|
||||
|
||||
var id = 'dlg' + new Date().getTime();
|
||||
var html = '';
|
||||
|
||||
|
@ -207,7 +215,7 @@
|
|||
|
||||
var player = controller.getCurrentPlayer();
|
||||
|
||||
player.getPlayerState().done(function (result) {
|
||||
player.getPlayerState().then(function (result) {
|
||||
|
||||
var state = result;
|
||||
|
||||
|
@ -238,7 +246,9 @@
|
|||
|
||||
var keys = new bindKeys(self);
|
||||
|
||||
$(window).on("keydown", keys.keyBinding).on("keypress", keys.keyPrevent).on("keyup", keys.keyPrevent);
|
||||
window.addEventListener('keydown', keys.keyBinding);
|
||||
window.addEventListener('keypress', keys.keyPrevent);
|
||||
window.addEventListener('keyup', keys.keyPrevent);
|
||||
|
||||
self.registerPlayer = function (player) {
|
||||
|
||||
|
@ -253,15 +263,11 @@
|
|||
};
|
||||
|
||||
function onBeforePlaybackStart(e, state) {
|
||||
$(self).trigger('beforeplaybackstart', [state, this]);
|
||||
}
|
||||
|
||||
function onPlaybackStart(e, state) {
|
||||
$(self).trigger('playbackstart', [state, this]);
|
||||
Events.trigger(self, 'beforeplaybackstart', [state, this]);
|
||||
}
|
||||
|
||||
function onPlaybackStop(e, state) {
|
||||
$(self).trigger('playbackstop', [state, this]);
|
||||
Events.trigger(self, 'playbackstop', [state, this]);
|
||||
}
|
||||
|
||||
self.getPlayerInfo = function () {
|
||||
|
@ -282,7 +288,7 @@
|
|||
|
||||
function triggerPlayerChange(newPlayer, newTarget) {
|
||||
|
||||
$(self).trigger('playerchange', [newPlayer, newTarget]);
|
||||
Events.trigger(self, 'playerchange', [newPlayer, newTarget]);
|
||||
}
|
||||
|
||||
self.setActivePlayer = function (player, targetInfo) {
|
||||
|
@ -325,7 +331,7 @@
|
|||
|
||||
currentPairingId = targetInfo.id;
|
||||
|
||||
player.tryPair(targetInfo).done(function () {
|
||||
player.tryPair(targetInfo).then(function () {
|
||||
|
||||
currentPlayer = player;
|
||||
currentTargetInfo = targetInfo;
|
||||
|
@ -344,7 +350,7 @@
|
|||
|
||||
name = normalizeName(name);
|
||||
|
||||
self.getTargets().done(function (result) {
|
||||
self.getTargets().then(function (result) {
|
||||
|
||||
var target = result.filter(function (p) {
|
||||
return normalizeName(p.name) == name;
|
||||
|
@ -386,23 +392,46 @@
|
|||
|
||||
if (playerInfo.supportedCommands.indexOf('EndSession') != -1) {
|
||||
|
||||
var options = {
|
||||
callback: function (result) {
|
||||
var menuItems = [];
|
||||
|
||||
if (result == 0) {
|
||||
MediaController.getCurrentPlayer().endSession();
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonYes'),
|
||||
id: 'yes'
|
||||
});
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonNo'),
|
||||
id: 'no'
|
||||
});
|
||||
menuItems.push({
|
||||
name: Globalize.translate('ButtonCancel'),
|
||||
id: 'cancel'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function () {
|
||||
|
||||
ActionSheetElement.show({
|
||||
items: menuItems,
|
||||
//positionTo: positionTo,
|
||||
title: Globalize.translate('ConfirmEndPlayerSession'),
|
||||
callback: function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
||||
case 'yes':
|
||||
MediaController.getCurrentPlayer().endSession();
|
||||
self.setDefaultPlayerActive();
|
||||
break;
|
||||
case 'no':
|
||||
self.setDefaultPlayerActive();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (result != 2) {
|
||||
self.setDefaultPlayerActive();
|
||||
}
|
||||
},
|
||||
message: Globalize.translate('ConfirmEndPlayerSession'),
|
||||
title: Globalize.translate('HeaderDisconnectFromPlayer'),
|
||||
buttons: [Globalize.translate('ButtonYes'), Globalize.translate('ButtonNo'), Globalize.translate('ButtonCancel')]
|
||||
};
|
||||
});
|
||||
|
||||
Dashboard.dialog(options);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -422,13 +451,13 @@
|
|||
return p.getTargets();
|
||||
});
|
||||
|
||||
$.when.apply($, promises).done(function () {
|
||||
Promise.all(promises).then(function (responses) {
|
||||
|
||||
var targets = [];
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
for (var i = 0; i < responses.length; i++) {
|
||||
|
||||
var subTargets = arguments[i];
|
||||
var subTargets = responses[i];
|
||||
|
||||
for (var j = 0; j < subTargets.length; j++) {
|
||||
|
||||
|
@ -461,11 +490,40 @@
|
|||
return;
|
||||
}
|
||||
|
||||
requirejs(["scripts/registrationservices"], function () {
|
||||
RegistrationServices.validateFeature('playback').done(fn);
|
||||
requirejs(["registrationservices"], function () {
|
||||
|
||||
self.playbackTimeLimitMs = null;
|
||||
|
||||
RegistrationServices.validateFeature('playback').then(fn, function () {
|
||||
|
||||
self.playbackTimeLimitMs = lockedTimeLimitMs;
|
||||
startAutoStopTimer();
|
||||
fn();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var autoStopTimeout;
|
||||
var lockedTimeLimitMs = 60000;
|
||||
function startAutoStopTimer() {
|
||||
stopAutoStopTimer();
|
||||
autoStopTimeout = setTimeout(onAutoStopTimeout, lockedTimeLimitMs);
|
||||
}
|
||||
|
||||
function onAutoStopTimeout() {
|
||||
stopAutoStopTimer();
|
||||
MediaController.stop();
|
||||
}
|
||||
|
||||
function stopAutoStopTimer() {
|
||||
|
||||
var timeout = autoStopTimeout;
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
autoStopTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
self.toggleDisplayMirroring = function () {
|
||||
self.enableDisplayMirroring(!self.enableDisplayMirroring());
|
||||
};
|
||||
|
@ -776,7 +834,7 @@
|
|||
var serverInfo = ApiClient.serverInfo();
|
||||
|
||||
if (serverInfo.Id) {
|
||||
LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId).done(function (localMediaSource) {
|
||||
LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId).then(function (localMediaSource) {
|
||||
// Use the local media source if a specific one wasn't requested, or the smae one was requested
|
||||
if (localMediaSource && (!mediaSource || mediaSource.Id == localMediaSource.Id)) {
|
||||
|
||||
|
@ -798,9 +856,9 @@
|
|||
}
|
||||
|
||||
function getPlaybackInfoWithoutLocalMediaSource(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId, deferred) {
|
||||
self.getPlaybackInfoInternal(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).done(function (result) {
|
||||
self.getPlaybackInfoInternal(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
|
||||
deferred.resolveWith(null, [result]);
|
||||
}).fail(function () {
|
||||
}, function () {
|
||||
deferred.reject();
|
||||
});
|
||||
}
|
||||
|
@ -891,7 +949,7 @@
|
|||
|
||||
require(['localassetmanager'], function () {
|
||||
|
||||
LocalAssetManager.fileExists(mediaSource.Path).done(function (exists) {
|
||||
LocalAssetManager.fileExists(mediaSource.Path).then(function (exists) {
|
||||
Logger.log('LocalAssetManager.fileExists: path: ' + mediaSource.Path + ' result: ' + exists);
|
||||
deferred.resolveWith(null, [exists]);
|
||||
});
|
||||
|
@ -971,8 +1029,7 @@
|
|||
$(apiClient).off("websocketmessage", onWebSocketMessageReceived).on("websocketmessage", onWebSocketMessageReceived);
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
|
||||
MediaController.init = function () {
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
@ -980,28 +1037,29 @@
|
|||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function onCastButtonClicked() {
|
||||
|
||||
showPlayerSelection();
|
||||
showPlayerSelection(this);
|
||||
}
|
||||
|
||||
$(document).on('headercreated', function () {
|
||||
document.addEventListener('headercreated', function () {
|
||||
|
||||
$('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
pageClassOn('pagebeforeshow', "page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
currentDisplayInfo = null;
|
||||
});
|
||||
|
||||
}).on('displayingitem', ".libraryPage", function (e, info) {
|
||||
|
||||
currentDisplayInfo = info;
|
||||
pageClassOn('displayingitem', "libraryPage", function (e) {
|
||||
|
||||
var info = e.detail;
|
||||
mirrorIfEnabled(info);
|
||||
});
|
||||
|
||||
})(jQuery, window);
|
||||
})(this);
|
|
@ -17,7 +17,7 @@
|
|||
collectionTypeOptions: getCollectionTypeOptions(),
|
||||
refresh: shouldRefreshLibraryAfterChanges(page)
|
||||
|
||||
}).done(function (hasChanges) {
|
||||
}).then(function (hasChanges) {
|
||||
|
||||
if (hasChanges) {
|
||||
reloadLibrary(page);
|
||||
|
@ -35,7 +35,7 @@
|
|||
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||
library: virtualFolder
|
||||
|
||||
}).done(function (hasChanges) {
|
||||
}).then(function (hasChanges) {
|
||||
|
||||
if (hasChanges) {
|
||||
reloadLibrary(page);
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
|
||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).done(function () {
|
||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
|||
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
|
||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).done(function () {
|
||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
}
|
||||
|
@ -156,7 +156,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getVirtualFolders().done(function (result) {
|
||||
ApiClient.getVirtualFolders().then(function (result) {
|
||||
reloadVirtualFolders(page, result);
|
||||
});
|
||||
}
|
||||
|
@ -207,11 +207,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
require(['components/imageeditor/imageeditor'], function () {
|
||||
require(['components/imageeditor/imageeditor'], function (ImageEditor) {
|
||||
|
||||
ImageEditor.show(virtualFolder.ItemId, {
|
||||
theme: 'a'
|
||||
}).done(function (hasChanged) {
|
||||
}).then(function (hasChanged) {
|
||||
if (hasChanged) {
|
||||
reloadLibrary(page);
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ var WizardLibraryPage = {
|
|||
type: "POST",
|
||||
url: apiClient.getUrl('System/Configuration/MetadataPlugins/Autoset')
|
||||
|
||||
}).done(function () {
|
||||
}).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.navigate('wizardsettings.html');
|
||||
|
|
|
@ -34,7 +34,15 @@
|
|||
|
||||
self.resetEnhancements = function () {
|
||||
|
||||
fadeOut(document.querySelector('#mediaPlayer'));
|
||||
if (!initComplete) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.isFullScreen()) {
|
||||
self.exitFullScreen();
|
||||
}
|
||||
|
||||
fadeOut(document.querySelector('#videoPlayer'));
|
||||
$('#videoPlayer').removeClass('fullscreenVideo').removeClass('idlePlayer');
|
||||
$('.hiddenOnIdle').removeClass("inactive");
|
||||
$("video").remove();
|
||||
|
@ -44,18 +52,6 @@
|
|||
document.querySelector('.videoControls').classList.add('hiddenOnIdle');
|
||||
};
|
||||
|
||||
function fadeOut(elem) {
|
||||
$(elem).hide();
|
||||
return;
|
||||
var keyframes = [
|
||||
{ opacity: '1', offset: 0 },
|
||||
{ opacity: '0', offset: 1 }];
|
||||
var timing = { duration: 300, iterations: 1 };
|
||||
elem.animate(keyframes, timing).onfinish = function () {
|
||||
$(elem).hide();
|
||||
};
|
||||
}
|
||||
|
||||
self.exitFullScreen = function () {
|
||||
|
||||
if (document.exitFullscreen) {
|
||||
|
@ -420,6 +416,14 @@
|
|||
});
|
||||
};
|
||||
|
||||
$.fn.lazyChildren = function () {
|
||||
|
||||
for (var i = 0, length = this.length; i < length; i++) {
|
||||
ImageLoader.lazyChildren(this[i]);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
function getNowPlayingTabsHtml(item) {
|
||||
|
||||
var html = '';
|
||||
|
@ -674,10 +678,9 @@
|
|||
|
||||
function ensureVideoPlayerElements() {
|
||||
|
||||
var html = '<div id="mediaPlayer" style="display: none;">';
|
||||
var html = '';
|
||||
|
||||
html += '<div class="videoBackdrop">';
|
||||
html += '<div id="videoPlayer">';
|
||||
html += '<div id="videoPlayer" class="hide">';
|
||||
|
||||
html += '<div id="videoElement">';
|
||||
html += '<div id="play" class="status"></div>';
|
||||
|
@ -722,14 +725,14 @@
|
|||
|
||||
html += '<paper-icon-button icon="skip-next" class="nextTrackButton mediaButton videoTrackControl hide" onclick="MediaPlayer.nextTrack();"></paper-icon-button>';
|
||||
|
||||
html += '<paper-slider pin step=".1" min="0" max="100" value="0" class="videoPositionSlider"></paper-slider>';
|
||||
html += '<paper-slider pin step=".1" min="0" max="100" value="0" class="videoPositionSlider" style="display:inline-block;margin-right:2em;"></paper-slider>';
|
||||
|
||||
html += '<div class="currentTime">--:--</div>';
|
||||
|
||||
html += '<paper-icon-button icon="volume-up" class="muteButton mediaButton" onclick="MediaPlayer.mute();"></paper-icon-button>';
|
||||
html += '<paper-icon-button icon="volume-off" class="unmuteButton mediaButton" onclick="MediaPlayer.unMute();"></paper-icon-button>';
|
||||
|
||||
html += '<paper-slider pin step="1" min="0" max="100" value="0" class="videoVolumeSlider" style="width:100px;vertical-align:middle;margin-left:-1em;"></paper-slider>';
|
||||
html += '<paper-slider pin step="1" min="0" max="100" value="0" class="videoVolumeSlider" style="width:100px;vertical-align:middle;margin-left:-1em;margin-right:2em;display:inline-block;"></paper-slider>';
|
||||
|
||||
html += '<paper-icon-button icon="fullscreen" class="mediaButton fullscreenButton" onclick="MediaPlayer.toggleFullscreen();" id="video-fullscreenButton"></paper-icon-button>';
|
||||
html += '<paper-icon-button icon="info" class="mediaButton infoButton" onclick="MediaPlayer.toggleInfo();"></paper-icon-button>';
|
||||
|
@ -739,20 +742,24 @@
|
|||
html += '</div>'; // videoControls
|
||||
|
||||
html += '</div>'; // videoPlayer
|
||||
html += '</div>'; // videoBackdrop
|
||||
html += '</div>'; // mediaPlayer
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = html;
|
||||
document.body.appendChild(div);
|
||||
$(div).trigger('create');
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
var initComplete;
|
||||
|
||||
function initVideoElements() {
|
||||
|
||||
if (initComplete) {
|
||||
return;
|
||||
}
|
||||
|
||||
initComplete = true;
|
||||
ensureVideoPlayerElements();
|
||||
|
||||
var parent = $("#mediaPlayer");
|
||||
var parent = $("#videoPlayer");
|
||||
|
||||
muteButton = $('.muteButton', parent);
|
||||
unmuteButton = $('.unmuteButton', parent);
|
||||
|
@ -782,7 +789,7 @@
|
|||
updateVolumeButtons(vol);
|
||||
self.setVolume(vol);
|
||||
})[0];
|
||||
});
|
||||
}
|
||||
|
||||
var idleHandlerTimeout;
|
||||
function idleHandler() {
|
||||
|
@ -880,9 +887,9 @@
|
|||
var itemVideo = document.querySelector('.itemVideo');
|
||||
if (itemVideo) {
|
||||
//Events.on(itemVideo, 'mousemove', onMouseMove);
|
||||
Events.on(itemVideo, 'keydown', idleHandler);
|
||||
Events.on(itemVideo, 'scroll', idleHandler);
|
||||
Events.on(itemVideo, 'mousedown', idleHandler);
|
||||
itemVideo.addEventListener('keydown', idleHandler);
|
||||
itemVideo.addEventListener('scroll', idleHandler);
|
||||
itemVideo.addEventListener('mousedown', idleHandler);
|
||||
idleHandler();
|
||||
}
|
||||
}
|
||||
|
@ -914,41 +921,47 @@
|
|||
var itemVideo = document.querySelector('.itemVideo');
|
||||
if (itemVideo) {
|
||||
//Events.off(itemVideo, 'mousemove', onMouseMove);
|
||||
Events.off(itemVideo, 'keydown', idleHandler);
|
||||
Events.off(itemVideo, 'scroll', idleHandler);
|
||||
Events.off(itemVideo, 'mousedown', idleHandler);
|
||||
itemVideo.removeEventListener('keydown', idleHandler);
|
||||
itemVideo.removeEventListener('scroll', idleHandler);
|
||||
itemVideo.removeEventListener('mousedown', idleHandler);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace audio version
|
||||
self.cleanup = function (mediaRenderer) {
|
||||
|
||||
currentTimeElement.html('--:--');
|
||||
if (currentTimeElement) {
|
||||
currentTimeElement.html('--:--');
|
||||
}
|
||||
|
||||
unbindEventsForPlayback(mediaRenderer);
|
||||
};
|
||||
|
||||
self.playVideo = function (item, mediaSource, startPosition, callback) {
|
||||
|
||||
requirejs(['videorenderer'], function () {
|
||||
// TODO: remove dependency on nowplayingbar
|
||||
requirejs(['videorenderer', 'css!css/nowplayingbar.css', 'css!css/mediaplayer-video.css', 'paper-slider'], function () {
|
||||
|
||||
self.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
||||
initVideoElements();
|
||||
|
||||
self.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
||||
|
||||
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
|
||||
// This will start the transcoding process before actually feeding the video url into the player
|
||||
if ($.browser.safari && !mediaSource.RunTimeTicks) {
|
||||
if (browserInfo.safari && !mediaSource.RunTimeTicks) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.ajax({
|
||||
|
||||
type: 'GET',
|
||||
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
|
||||
}).always(function () {
|
||||
|
||||
}).then(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
}).done(function () {
|
||||
self.playVideoInternal(item, mediaSource, startPosition, streamInfo, callback);
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
@ -958,6 +971,53 @@
|
|||
});
|
||||
};
|
||||
|
||||
function fadeOut(elem) {
|
||||
|
||||
if (elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var onfinish = function () {
|
||||
elem.classList.add('hide');
|
||||
};
|
||||
|
||||
if (!browserInfo.animate) {
|
||||
onfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
var keyframes = [
|
||||
{ opacity: '1', offset: 0 },
|
||||
{ opacity: '0', offset: 1 }];
|
||||
var timing = { duration: 600, iterations: 1, easing: 'ease-out' };
|
||||
elem.animate(keyframes, timing).onfinish = onfinish;
|
||||
});
|
||||
}
|
||||
|
||||
function fadeIn(elem) {
|
||||
|
||||
if (!elem.classList.contains('hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
elem.classList.remove('hide');
|
||||
|
||||
if (!browserInfo.animate) {
|
||||
return;
|
||||
}
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
|
||||
var keyframes = [
|
||||
{ transform: 'scale3d(.2, .2, .2) ', opacity: '.6', offset: 0 },
|
||||
{ transform: 'none', opacity: '1', offset: 1 }
|
||||
];
|
||||
|
||||
var timing = { duration: 200, iterations: 1, easing: 'ease-out' };
|
||||
elem.animate(keyframes, timing);
|
||||
});
|
||||
}
|
||||
self.playVideoInternal = function (item, mediaSource, startPosition, streamInfo, callback) {
|
||||
|
||||
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
|
||||
|
@ -968,13 +1028,14 @@
|
|||
});
|
||||
|
||||
// Create video player
|
||||
var mediaPlayerContainer = $("#mediaPlayer").show();
|
||||
var mediaPlayerContainer = document.querySelector('#videoPlayer');
|
||||
fadeIn(mediaPlayerContainer);
|
||||
var videoControls = $('.videoControls', mediaPlayerContainer);
|
||||
|
||||
//show stop button
|
||||
$('#video-playButton', videoControls).hide();
|
||||
$('#video-pauseButton', videoControls).show();
|
||||
$('.videoTrackControl').visible(false);
|
||||
$('.videoTrackControl').addClass('hide');
|
||||
|
||||
var videoElement = $('#videoElement', mediaPlayerContainer);
|
||||
|
||||
|
@ -1008,11 +1069,11 @@
|
|||
}
|
||||
|
||||
if (AppInfo.hasPhysicalVolumeButtons) {
|
||||
$(volumeSlider).visible(false);
|
||||
$(volumeSlider).addClass('hide');
|
||||
$('.muteButton', videoControls).addClass('hide');
|
||||
$('.unmuteButton', videoControls).addClass('hide');
|
||||
} else {
|
||||
$(volumeSlider).visible(true);
|
||||
$(volumeSlider).removeClass('hide');
|
||||
$('.muteButton', videoControls).removeClass('hide');
|
||||
$('.unmuteButton', videoControls).removeClass('hide');
|
||||
}
|
||||
|
@ -1086,7 +1147,7 @@
|
|||
|
||||
}).on("click.mediaplayerevent", function (e) {
|
||||
|
||||
if (!$.browser.mobile) {
|
||||
if (!browserInfo.mobile) {
|
||||
if (this.paused()) {
|
||||
self.unpause();
|
||||
} else {
|
||||
|
@ -1096,7 +1157,7 @@
|
|||
|
||||
}).on("dblclick.mediaplayerevent", function () {
|
||||
|
||||
if (!$.browser.mobile) {
|
||||
if (!browserInfo.mobile) {
|
||||
self.toggleFullscreen();
|
||||
}
|
||||
});
|
||||
|
@ -1112,7 +1173,7 @@
|
|||
|
||||
self.updateNowPlayingInfo(item);
|
||||
|
||||
mediaRenderer.init().done(function () {
|
||||
mediaRenderer.init().then(function () {
|
||||
|
||||
self.onBeforePlaybackStart(mediaRenderer, item, mediaSource);
|
||||
|
||||
|
@ -1126,6 +1187,11 @@
|
|||
};
|
||||
|
||||
self.updatePlaylistUi = function () {
|
||||
|
||||
if (!initComplete) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = self.currentPlaylistIndex(null);
|
||||
var length = self.playlist.length;
|
||||
|
||||
|
@ -1136,7 +1202,7 @@
|
|||
}
|
||||
|
||||
if (length < 2) {
|
||||
$('.videoTrackControl').visible(false);
|
||||
$('.videoTrackControl').addClass('hide');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1158,8 +1224,8 @@
|
|||
nextTrackButton.removeAttribute('disabled');
|
||||
}
|
||||
|
||||
$(previousTrackButton).visible(true);
|
||||
$(nextTrackButton).visible(true);
|
||||
$(previousTrackButton).removeClass('hide');
|
||||
$(nextTrackButton).removeClass('hide');
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function (document, setTimeout, clearTimeout, screen, $, setInterval, window) {
|
||||
(function (document, setTimeout, clearTimeout, screen, setInterval, window) {
|
||||
|
||||
function mediaPlayer() {
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
|
||||
var targets = [{
|
||||
name: Globalize.translate('MyDevice'),
|
||||
id: ConnectionManager.deviceId(),
|
||||
id: AppInfo.deviceId,
|
||||
playerName: self.name,
|
||||
playableMediaTypes: ['Audio', 'Video'],
|
||||
isLocalPlayer: true,
|
||||
|
@ -120,7 +120,7 @@
|
|||
})[0].maxHeight;
|
||||
}
|
||||
|
||||
var isVlc = AppInfo.isNativeApp && $.browser.android;
|
||||
var isVlc = AppInfo.isNativeApp && browserInfo.android;
|
||||
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
||||
|
||||
var supportedFormats = getSupportedFormats();
|
||||
|
@ -129,6 +129,7 @@
|
|||
var canPlayAc3 = supportedFormats.indexOf('ac3') != -1;
|
||||
var canPlayAac = supportedFormats.indexOf('aac') != -1;
|
||||
var canPlayMp3 = supportedFormats.indexOf('mp3') != -1;
|
||||
var canPlayMkv = supportedFormats.indexOf('mkv') != -1;
|
||||
|
||||
var profile = {};
|
||||
|
||||
|
@ -147,7 +148,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
if ($.browser.chrome) {
|
||||
if (canPlayMkv) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mkv,mov',
|
||||
Type: 'Video',
|
||||
|
@ -201,6 +202,16 @@
|
|||
|
||||
profile.TranscodingProfiles = [];
|
||||
|
||||
if (canPlayMkv && !isVlc) {
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'mkv',
|
||||
Type: 'Video',
|
||||
AudioCodec: 'aac' + (canPlayAc3 ? ',ac3' : ''),
|
||||
VideoCodec: 'h264',
|
||||
Context: 'Streaming'
|
||||
});
|
||||
}
|
||||
|
||||
if (self.canPlayHls()) {
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'ts',
|
||||
|
@ -211,7 +222,7 @@
|
|||
Protocol: 'hls'
|
||||
});
|
||||
|
||||
if (canPlayAac && $.browser.safari && !AppInfo.isNativeApp) {
|
||||
if (canPlayAac && browserInfo.safari && !AppInfo.isNativeApp) {
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'ts',
|
||||
Type: 'Audio',
|
||||
|
@ -252,7 +263,7 @@
|
|||
Protocol: 'http'
|
||||
});
|
||||
|
||||
if (canPlayAac && $.browser.safari) {
|
||||
if (canPlayAac && browserInfo.safari) {
|
||||
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'aac',
|
||||
|
@ -311,12 +322,12 @@
|
|||
Value: 'HE-AAC'
|
||||
}
|
||||
// Disabling this is going to require us to learn why it was disabled in the first place
|
||||
,
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'AudioProfile',
|
||||
Value: 'LC'
|
||||
}
|
||||
//,
|
||||
//{
|
||||
// Condition: 'NotEquals',
|
||||
// Property: 'AudioProfile',
|
||||
// Value: 'LC'
|
||||
//}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -472,12 +483,6 @@
|
|||
|
||||
profile.ResponseProfiles = [];
|
||||
|
||||
//profile.ResponseProfiles.push({
|
||||
// Type: 'Video',
|
||||
// Container: 'mkv',
|
||||
// MimeType: 'video/mp4'
|
||||
//});
|
||||
|
||||
profile.ResponseProfiles.push({
|
||||
Type: 'Video',
|
||||
Container: 'm4v',
|
||||
|
@ -542,7 +547,7 @@
|
|||
|
||||
var intervalTime = ApiClient.isWebSocketOpen() ? 1200 : 5000;
|
||||
// Ease up with safari because it doesn't perform as well
|
||||
if ($.browser.safari) {
|
||||
if (browserInfo.safari) {
|
||||
intervalTime = Math.max(intervalTime, 5000);
|
||||
}
|
||||
self.lastProgressReport = 0;
|
||||
|
@ -589,11 +594,6 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
// Don't use viblast with windows phone, not working at the moment.
|
||||
if ($.browser.msie && $.browser.mobile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// viblast can help us here
|
||||
//return true;
|
||||
return window.MediaSource != null;
|
||||
|
@ -628,12 +628,12 @@
|
|||
subtitleStreamIndex = parseInt(subtitleStreamIndex);
|
||||
}
|
||||
|
||||
MediaController.getPlaybackInfo(self.currentItem.Id, deviceProfile, ticks, self.currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).done(function (result) {
|
||||
MediaController.getPlaybackInfo(self.currentItem.Id, deviceProfile, ticks, self.currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
|
||||
|
||||
if (validatePlaybackInfoResult(result)) {
|
||||
|
||||
self.currentMediaSource = result.MediaSources[0];
|
||||
self.createStreamInfo(self.currentItem.MediaType, self.currentItem, self.currentMediaSource, ticks).done(function (streamInfo) {
|
||||
self.createStreamInfo(self.currentItem.MediaType, self.currentItem, self.currentMediaSource, ticks).then(function (streamInfo) {
|
||||
|
||||
if (!streamInfo.url) {
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
|
@ -643,13 +643,13 @@
|
|||
|
||||
self.currentSubtitleStreamIndex = subtitleStreamIndex;
|
||||
|
||||
changeStreamToUrl(mediaRenderer, playSessionId, streamInfo, streamInfo.startTimeTicksOffset || 0);
|
||||
changeStreamToUrl(mediaRenderer, playSessionId, streamInfo);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function changeStreamToUrl(mediaRenderer, playSessionId, streamInfo, newPositionTicks) {
|
||||
function changeStreamToUrl(mediaRenderer, playSessionId, streamInfo) {
|
||||
|
||||
clearProgressInterval();
|
||||
|
||||
|
@ -668,17 +668,12 @@
|
|||
});
|
||||
|
||||
if (self.currentItem.MediaType == "Video") {
|
||||
ApiClient.stopActiveEncodings(playSessionId).done(function () {
|
||||
ApiClient.stopActiveEncodings(playSessionId).then(function () {
|
||||
|
||||
//self.startTimeTicksOffset = newPositionTicks;
|
||||
self.setSrcIntoRenderer(mediaRenderer, streamInfo, self.currentItem, self.currentMediaSource);
|
||||
|
||||
});
|
||||
|
||||
self.startTimeTicksOffset = newPositionTicks || 0;
|
||||
self.updateTextStreamUrls(newPositionTicks || 0);
|
||||
} else {
|
||||
self.startTimeTicksOffset = newPositionTicks || 0;
|
||||
self.setSrcIntoRenderer(mediaRenderer, streamInfo, self.currentItem, self.currentMediaSource);
|
||||
}
|
||||
}
|
||||
|
@ -707,8 +702,11 @@
|
|||
});
|
||||
}
|
||||
|
||||
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset || 0;
|
||||
|
||||
mediaRenderer.setCurrentSrc(streamInfo, item, mediaSource, tracks);
|
||||
self.streamInfo = streamInfo;
|
||||
//self.updateTextStreamUrls(streamInfo.startTimeTicksOffset || 0);
|
||||
};
|
||||
|
||||
self.setCurrentTime = function (ticks, positionSlider, currentTimeElement) {
|
||||
|
@ -753,8 +751,6 @@
|
|||
|
||||
function translateItemsForPlayback(items) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var firstItem = items[0];
|
||||
var promise;
|
||||
|
||||
|
@ -797,26 +793,31 @@
|
|||
}
|
||||
|
||||
if (promise) {
|
||||
promise.done(function (result) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
deferred.resolveWith(null, [result.Items]);
|
||||
promise.then(function (result) {
|
||||
|
||||
resolve(result.Items);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
deferred.resolveWith(null, [items]);
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
resolve(items);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
self.play = function (options) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
translateItemsForPlayback(options.items).done(function (items) {
|
||||
translateItemsForPlayback(options.items).then(function (items) {
|
||||
|
||||
self.playWithIntros(items, options, user);
|
||||
});
|
||||
|
@ -827,9 +828,9 @@
|
|||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
translateItemsForPlayback(result.Items).done(function (items) {
|
||||
translateItemsForPlayback(result.Items).then(function (items) {
|
||||
|
||||
self.playWithIntros(items, options, user);
|
||||
});
|
||||
|
@ -847,10 +848,10 @@
|
|||
|
||||
if (firstItem.MediaType === "Video") {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
if (options.startPositionTicks || firstItem.MediaType !== 'Video') {
|
||||
if (options.startPositionTicks || firstItem.MediaType !== 'Video' || !AppSettings.enableCinemaMode()) {
|
||||
|
||||
self.playInternal(firstItem, options.startPositionTicks, function () {
|
||||
self.setPlaylistState(0, items);
|
||||
|
@ -859,7 +860,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).done(function (intros) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).then(function (intros) {
|
||||
|
||||
items = intros.Items.concat(items);
|
||||
self.playInternal(items[0], options.startPositionTicks, function () {
|
||||
|
@ -877,10 +878,10 @@
|
|||
return MediaController.supportsDirectPlay(v);
|
||||
});
|
||||
|
||||
$.when.apply($, promises).done(function () {
|
||||
Promise.all(promises).then(function (responses) {
|
||||
|
||||
for (var i = 0, length = versions.length; i < length; i++) {
|
||||
versions[i].enableDirectPlay = arguments[i] || false;
|
||||
versions[i].enableDirectPlay = responses[i] || false;
|
||||
}
|
||||
var optimalVersion = versions.filter(function (v) {
|
||||
|
||||
|
@ -962,9 +963,11 @@
|
|||
} else {
|
||||
|
||||
// Reports of stuttering with h264 stream copy in IE
|
||||
mediaUrl += '&EnableAutoStreamCopy=false';
|
||||
|
||||
if (mediaUrl.indexOf('.mkv') == -1) {
|
||||
mediaUrl += '&EnableAutoStreamCopy=false';
|
||||
}
|
||||
startTimeTicksOffset = startPosition || 0;
|
||||
|
||||
contentType = 'video/' + mediaSource.TranscodingContainer;
|
||||
}
|
||||
}
|
||||
|
@ -1033,7 +1036,7 @@
|
|||
|
||||
require(['localassetmanager'], function () {
|
||||
|
||||
LocalAssetManager.translateFilePath(resultInfo.url).done(function (path) {
|
||||
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
|
||||
|
||||
resultInfo.url = path;
|
||||
Logger.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
|
||||
|
@ -1049,7 +1052,7 @@
|
|||
return deferred.promise();
|
||||
};
|
||||
|
||||
self.lastBitrateDetect = 0;
|
||||
self.lastBitrateDetections = {};
|
||||
|
||||
self.playInternal = function (item, startPosition, callback) {
|
||||
|
||||
|
@ -1066,23 +1069,25 @@
|
|||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.hideLoadingMsg();
|
||||
MediaController.showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - self.lastBitrateDetect) > 300000) {
|
||||
var bitrateDetectionKey = ApiClient.serverAddress();
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - (self.lastBitrateDetections[bitrateDetectionKey] || 0)) > 300000) {
|
||||
|
||||
ApiClient.detectBitrate().done(function (bitrate) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.detectBitrate().then(function (bitrate) {
|
||||
Logger.log('Max bitrate auto detected to ' + bitrate);
|
||||
self.lastBitrateDetect = new Date().getTime();
|
||||
self.lastBitrateDetections[bitrateDetectionKey] = new Date().getTime();
|
||||
AppSettings.maxStreamingBitrate(bitrate);
|
||||
|
||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||
}).fail(function () {
|
||||
|
||||
}, function () {
|
||||
|
||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||
});
|
||||
|
@ -1096,21 +1101,21 @@
|
|||
|
||||
if (item.MediaType === "Video") {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
Dashboard.showLoadingMsg();
|
||||
}
|
||||
|
||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) {
|
||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).then(function (playbackInfoResult) {
|
||||
|
||||
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||
|
||||
getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources).done(function (mediaSource) {
|
||||
getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources).then(function (mediaSource) {
|
||||
if (mediaSource) {
|
||||
|
||||
if (mediaSource.RequiresOpening) {
|
||||
|
||||
MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
||||
MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {
|
||||
|
||||
MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource).done(function (result) {
|
||||
MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource).then(function (result) {
|
||||
|
||||
openLiveStreamResult.MediaSource.enableDirectPlay = result;
|
||||
callback(openLiveStreamResult.MediaSource);
|
||||
|
@ -1122,7 +1127,7 @@
|
|||
callback(mediaSource);
|
||||
}
|
||||
} else {
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.hideLoadingMsg();
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
}
|
||||
});
|
||||
|
@ -1140,14 +1145,14 @@
|
|||
|
||||
function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback) {
|
||||
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
self.currentMediaSource = mediaSource;
|
||||
self.currentItem = item;
|
||||
|
||||
if (item.MediaType === "Video") {
|
||||
|
||||
requirejs(['videorenderer'], function () {
|
||||
requirejs(['videorenderer', 'scripts/mediaplayer-video'], function () {
|
||||
self.playVideo(item, self.currentMediaSource, startPosition, callback);
|
||||
});
|
||||
|
||||
|
@ -1207,17 +1212,16 @@
|
|||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
if (query.Ids && query.Ids.split(',').length == 1) {
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).done(function (item) {
|
||||
deferred.resolveWith(null, [
|
||||
{
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
}]);
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
ApiClient.getItem(userId, query.Ids.split(',')).then(function (item) {
|
||||
resolve({
|
||||
Items: [item],
|
||||
TotalRecordCount: 1
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -1334,11 +1338,11 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
translateItemsForPlayback(options.items).done(function (items) {
|
||||
translateItemsForPlayback(options.items).then(function (items) {
|
||||
|
||||
self.queueItems(items);
|
||||
});
|
||||
|
@ -1349,9 +1353,9 @@
|
|||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
translateItemsForPlayback(result.Items).done(function (items) {
|
||||
translateItemsForPlayback(result.Items).then(function (items) {
|
||||
|
||||
self.queueItems(items);
|
||||
});
|
||||
|
@ -1368,7 +1372,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
|
@ -1380,7 +1384,7 @@
|
|||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
options.items = result.Items;
|
||||
|
||||
|
@ -1478,7 +1482,7 @@
|
|||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
ApiClient.getItem(userId, id).then(function (item) {
|
||||
|
||||
var query = {
|
||||
UserId: userId,
|
||||
|
@ -1509,7 +1513,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
self.getItemsForPlayback(query).done(function (result) {
|
||||
self.getItemsForPlayback(query).then(function (result) {
|
||||
|
||||
self.play({ items: result.Items });
|
||||
|
||||
|
@ -1528,7 +1532,7 @@
|
|||
Fields: getItemFields,
|
||||
Limit: itemLimit
|
||||
|
||||
}).done(function (result) {
|
||||
}).then(function (result) {
|
||||
|
||||
self.play({ items: result.Items });
|
||||
|
||||
|
@ -1569,10 +1573,9 @@
|
|||
self.streamInfo = {};
|
||||
}
|
||||
|
||||
if (self.isFullScreen()) {
|
||||
self.exitFullScreen();
|
||||
if (self.resetEnhancements) {
|
||||
self.resetEnhancements();
|
||||
}
|
||||
self.resetEnhancements();
|
||||
};
|
||||
|
||||
self.isPlaying = function () {
|
||||
|
@ -1774,9 +1777,6 @@
|
|||
|
||||
if (item.MediaType == "Video") {
|
||||
|
||||
if (self.isFullScreen()) {
|
||||
self.exitFullScreen();
|
||||
}
|
||||
self.resetEnhancements();
|
||||
}
|
||||
|
||||
|
@ -1790,7 +1790,7 @@
|
|||
Events.trigger(self, 'playstatechange', [state]);
|
||||
};
|
||||
|
||||
Events.on(window, "beforeunload", function () {
|
||||
window.addEventListener("beforeunload", function () {
|
||||
|
||||
// Try to report playback stopped before the browser closes
|
||||
if (self.currentItem && self.currentMediaRenderer && currentProgressInterval) {
|
||||
|
@ -1875,6 +1875,10 @@
|
|||
list.push('mp3');
|
||||
}
|
||||
|
||||
if (browserInfo.chrome) {
|
||||
list.push('mkv');
|
||||
}
|
||||
|
||||
supportedFormats = list;
|
||||
return list;
|
||||
}
|
||||
|
@ -1885,7 +1889,7 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($.browser.mobile) {
|
||||
if (browserInfo.mobile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1920,7 +1924,7 @@
|
|||
|
||||
function playAudioInternal(item, mediaSource, startPositionTicks) {
|
||||
|
||||
self.createStreamInfo('Audio', item, mediaSource, startPositionTicks).done(function (streamInfo) {
|
||||
self.createStreamInfo('Audio', item, mediaSource, startPositionTicks).then(function (streamInfo) {
|
||||
|
||||
self.startTimeTicksOffset = streamInfo.startTimeTicksOffset;
|
||||
|
||||
|
@ -1972,7 +1976,7 @@
|
|||
self.currentMediaRenderer = mediaRenderer;
|
||||
self.currentDurationTicks = self.currentMediaSource.RunTimeTicks;
|
||||
|
||||
mediaRenderer.init().done(function () {
|
||||
mediaRenderer.init().then(function () {
|
||||
|
||||
// Set volume first to avoid an audible change
|
||||
mediaRenderer.volume(initialVolume);
|
||||
|
@ -1997,17 +2001,8 @@
|
|||
|
||||
window.MediaPlayer = new mediaPlayer();
|
||||
|
||||
function onConnectionChange() {
|
||||
window.MediaPlayer.lastBitrateDetect = 0;
|
||||
}
|
||||
|
||||
Dashboard.ready(function () {
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
|
||||
Events.on(ConnectionManager, 'localusersignedin', onConnectionChange);
|
||||
Events.on(ConnectionManager, 'localusersignedout', onConnectionChange);
|
||||
});
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
|
||||
|
||||
})(document, setTimeout, clearTimeout, screen, $, setInterval, window);
|
||||
})(document, setTimeout, clearTimeout, screen, setInterval, window);
|
|
@ -14,8 +14,6 @@
|
|||
$('#chkPeopleOthers', page).checked(config.PeopleMetadataOptions.DownloadOtherPeopleMetadata).checkboxradio("refresh");
|
||||
$('#chkPeopleGuestStars', page).checked(config.PeopleMetadataOptions.DownloadGuestStarMetadata).checkboxradio("refresh");
|
||||
|
||||
$('.chkEnableVideoFrameAnalysis', page).checked(config.EnableVideoFrameByFrameAnalysis);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
|
@ -101,29 +99,29 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (configuration) {
|
||||
ApiClient.getServerConfiguration().then(function (configuration) {
|
||||
|
||||
loadAdvancedConfig(page, configuration);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("metadata").done(function (metadata) {
|
||||
ApiClient.getNamedConfiguration("metadata").then(function (metadata) {
|
||||
|
||||
loadMetadataConfig(page, metadata);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("fanart").done(function (metadata) {
|
||||
ApiClient.getNamedConfiguration("fanart").then(function (metadata) {
|
||||
|
||||
loadFanartConfig(page, metadata);
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("themoviedb").done(function (metadata) {
|
||||
ApiClient.getNamedConfiguration("themoviedb").then(function (metadata) {
|
||||
|
||||
loadTmdbConfig(page, metadata);
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("tvdb").done(function (metadata) {
|
||||
ApiClient.getNamedConfiguration("tvdb").then(function (metadata) {
|
||||
|
||||
loadTvdbConfig(page, metadata);
|
||||
});
|
||||
|
@ -131,15 +129,15 @@
|
|||
var promise1 = ApiClient.getNamedConfiguration("chapters");
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Providers/Chapters"));
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadChapters(page, response1[0], response2[0]);
|
||||
loadChapters(page, responses[0], responses[1]);
|
||||
});
|
||||
});
|
||||
|
||||
function saveFanart(form) {
|
||||
|
||||
ApiClient.getNamedConfiguration("fanart").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("fanart").then(function (config) {
|
||||
|
||||
config.EnableAutomaticUpdates = $('#chkEnableFanartUpdates', form).checked();
|
||||
config.UserApiKey = $('#txtFanartApiKey', form).val();
|
||||
|
@ -150,7 +148,7 @@
|
|||
|
||||
function saveTvdb(form) {
|
||||
|
||||
ApiClient.getNamedConfiguration("tvdb").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("tvdb").then(function (config) {
|
||||
|
||||
config.EnableAutomaticUpdates = $('#chkEnableTvdbUpdates', form).checked();
|
||||
|
||||
|
@ -160,7 +158,7 @@
|
|||
|
||||
function saveTmdb(form) {
|
||||
|
||||
ApiClient.getNamedConfiguration("themoviedb").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("themoviedb").then(function (config) {
|
||||
|
||||
config.EnableAutomaticUpdates = $('#chkEnableTmdbUpdates', form).checked();
|
||||
|
||||
|
@ -170,12 +168,10 @@
|
|||
|
||||
function saveAdvancedConfig(form) {
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.SaveMetadataHidden = $('#chkSaveMetadataHidden', form).checked();
|
||||
|
||||
config.EnableVideoFrameByFrameAnalysis = $('.chkEnableVideoFrameAnalysis', form).checked();
|
||||
|
||||
config.EnableTvDbUpdates = $('#chkEnableTvdbUpdates', form).checked();
|
||||
config.EnableTmdbUpdates = $('#chkEnableTmdbUpdates', form).checked();
|
||||
config.EnableFanArtUpdates = $('#chkEnableFanartUpdates', form).checked();
|
||||
|
@ -190,13 +186,13 @@
|
|||
config.PeopleMetadataOptions.DownloadWriterMetadata = $('#chkPeopleWriters', form).checked();
|
||||
config.PeopleMetadataOptions.DownloadOtherPeopleMetadata = $('#chkPeopleOthers', form).checked();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
}
|
||||
|
||||
function saveMetadata(form) {
|
||||
|
||||
ApiClient.getNamedConfiguration("metadata").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("metadata").then(function (config) {
|
||||
|
||||
config.UseFileCreationTimeForDateAdded = $('#selectDateAdded', form).val() == '1';
|
||||
|
||||
|
@ -206,7 +202,7 @@
|
|||
|
||||
function saveChapters(form) {
|
||||
|
||||
ApiClient.getNamedConfiguration("chapters").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("chapters").then(function (config) {
|
||||
|
||||
config.EnableMovieChapterImageExtraction = $('#chkChaptersMovies', form).checked();
|
||||
config.EnableEpisodeChapterImageExtraction = $('#chkChaptersEpisodes', form).checked();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
config.ImageSavingConvention = $('#selectImageSavingConvention', form).val();
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
config.PreferredMetadataLanguage = $('#selectLanguage', form).val();
|
||||
config.MetadataCountryCode = $('#selectCountry', form).val();
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -52,23 +52,55 @@
|
|||
var allCultures;
|
||||
var allCountries;
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (result) {
|
||||
ApiClient.getServerConfiguration().then(function (result) {
|
||||
|
||||
config = result;
|
||||
load(page, config, allCultures, allCountries);
|
||||
});
|
||||
|
||||
ApiClient.getCultures().done(function (result) {
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
Dashboard.populateLanguages($('#selectLanguage', page), result);
|
||||
var html = "";
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
var culture = languages[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function populateCountries(select, allCountries) {
|
||||
|
||||
var html = "";
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
|
||||
var culture = allCountries[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + "</option>";
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
ApiClient.getCultures().then(function (result) {
|
||||
|
||||
populateLanguages(page.querySelector('#selectLanguage'), result);
|
||||
|
||||
allCultures = result;
|
||||
load(page, config, allCultures, allCountries);
|
||||
});
|
||||
|
||||
ApiClient.getCountries().done(function (result) {
|
||||
ApiClient.getCountries().then(function (result) {
|
||||
|
||||
Dashboard.populateCountries($('#selectCountry', page), result);
|
||||
populateCountries(page.querySelector('#selectCountry'), result);
|
||||
|
||||
allCountries = result;
|
||||
load(page, config, allCultures, allCountries);
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
var promise1 = ApiClient.getServerConfiguration();
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataPlugins"));
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var config = response1[0];
|
||||
var metadataPlugins = response2[0];
|
||||
var config = responses[0];
|
||||
var metadataPlugins = responses[1];
|
||||
|
||||
config = config.MetadataOptions.filter(function (c) {
|
||||
return c.ItemType == type;
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
} else {
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).done(function (defaultConfig) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).then(function (defaultConfig) {
|
||||
|
||||
|
||||
config = defaultConfig;
|
||||
|
@ -175,7 +175,7 @@
|
|||
|
||||
for (i = 0, length = plugins.length; i < length; i++) {
|
||||
|
||||
html += '<div style="margin:6px 0 0;">';
|
||||
html += '<div>';
|
||||
|
||||
if (i > 0) {
|
||||
html += '<paper-icon-button class="btnUp" data-pluginindex="' + i + '" icon="keyboard-arrow-up" title="' + Globalize.translate('ButtonUp') + '" style="padding:3px 8px;"></paper-icon-button>';
|
||||
|
@ -299,7 +299,7 @@
|
|||
|
||||
for (i = 0, length = plugins.length; i < length; i++) {
|
||||
|
||||
html += '<div style="margin:6px 0 0;">';
|
||||
html += '<div>';
|
||||
|
||||
if (i > 0) {
|
||||
html += '<paper-icon-button class="btnUp" data-pluginindex="' + i + '" icon="keyboard-arrow-up" title="' + Globalize.translate('ButtonUp') + '" style="padding:3px 8px;"></paper-icon-button>';
|
||||
|
@ -490,7 +490,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getServerConfiguration().done(function (config) {
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
|
||||
var type = currentType;
|
||||
|
||||
|
@ -501,16 +501,16 @@
|
|||
if (metadataOptions) {
|
||||
|
||||
saveSettingsIntoConfig(form, metadataOptions);
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
|
||||
} else {
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).done(function (defaultOptions) {
|
||||
ApiClient.getJSON(ApiClient.getUrl("System/Configuration/MetadataOptions/Default")).then(function (defaultOptions) {
|
||||
|
||||
defaultOptions.ItemType = type;
|
||||
config.MetadataOptions.push(defaultOptions);
|
||||
saveSettingsIntoConfig(form, defaultOptions);
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration(metadataKey).done(function (config) {
|
||||
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
|
||||
|
||||
config.UserId = $('#selectUser', form).val() || null;
|
||||
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
|
||||
|
@ -32,7 +32,7 @@
|
|||
config.EnablePathSubstitution = $('#chkEnablePathSubstitution', form).checked();
|
||||
config.EnableExtraThumbsDuplication = $('#chkEnableExtraThumbs', form).checked();
|
||||
|
||||
ApiClient.updateNamedConfiguration(metadataKey, config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration(metadataKey, config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -52,9 +52,9 @@
|
|||
var promise1 = ApiClient.getUsers();
|
||||
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadPage(page, response2[0], response1[0]);
|
||||
loadPage(page, responses[0], responses[0]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
var form = this;
|
||||
|
||||
ApiClient.getNamedConfiguration("subtitles").done(function (config) {
|
||||
ApiClient.getNamedConfiguration("subtitles").then(function (config) {
|
||||
|
||||
config.DownloadMovieSubtitles = $('#chkSubtitlesMovies', form).checked();
|
||||
config.DownloadEpisodeSubtitles = $('#chkSubtitlesEpisodes', form).checked();
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
});
|
||||
|
||||
ApiClient.updateNamedConfiguration("subtitles", config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
ApiClient.updateNamedConfiguration("subtitles", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
|
@ -90,9 +90,9 @@
|
|||
var promise1 = ApiClient.getNamedConfiguration("subtitles");
|
||||
var promise2 = ApiClient.getCultures();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadPage(page, response1[0], response2[0]);
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@
|
|||
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var result = response1[0];
|
||||
var user = response2[0];
|
||||
var result = responses[0];
|
||||
var user = responses[1];
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -67,7 +67,7 @@
|
|||
addLayoutButton: true,
|
||||
currentLayout: view
|
||||
|
||||
})).trigger('create');
|
||||
}));
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
|
||||
|
@ -202,21 +202,23 @@
|
|||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#boxsetsPage", function () {
|
||||
|
||||
pageIdOn('pageinit', 'boxsetsPage', function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var content = page;
|
||||
|
||||
initPage(content);
|
||||
|
||||
}).on('pagebeforeshow', "#boxsetsPage", function () {
|
||||
});
|
||||
pageIdOn('pagebeforeshow', 'boxsetsPage', function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var content = page;
|
||||
|
||||
reloadItems(content);
|
||||
|
||||
});
|
||||
|
||||
window.MoviesPage = window.MoviesPage || {};
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
Dashboard.showLoadingMsg();
|
||||
|
||||
var query = getQuery();
|
||||
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getGenres(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -58,7 +58,7 @@
|
|||
addLayoutButton: true,
|
||||
currentLayout: view
|
||||
|
||||
})).trigger('create');
|
||||
}));
|
||||
|
||||
if (view == "List") {
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
var query = getQuery();
|
||||
var view = getPageData().view;
|
||||
|
||||
ApiClient.getItems(userId, query).done(function (result) {
|
||||
ApiClient.getItems(userId, query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -167,7 +167,7 @@
|
|||
$('.btnChangeLayout', page).on('layoutchange', function (e, layout) {
|
||||
|
||||
if (layout == 'Timeline') {
|
||||
getQuery().SortBy = 'PremiereDate,SortName';
|
||||
getQuery().SortBy = 'ProductionYear,PremiereDate,SortName';
|
||||
getQuery().SortOrder = 'Descending';
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return $.browser.mobile && AppInfo.enableAppLayouts;
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
||||
}
|
||||
|
||||
function getPortraitShape() {
|
||||
|
@ -36,7 +36,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||
|
||||
var view = getView();
|
||||
var html = '';
|
||||
|
@ -93,7 +93,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getItems(userId, options).done(function (result) {
|
||||
ApiClient.getItems(userId, options).then(function (result) {
|
||||
|
||||
if (result.Items.length) {
|
||||
$('#resumableSection', page).show();
|
||||
|
@ -132,7 +132,9 @@
|
|||
});
|
||||
}
|
||||
|
||||
$('#resumableItems', page).html(html).lazyChildren();
|
||||
var resumableItems = page.querySelector('#resumableItems');
|
||||
resumableItems.innerHTML = html;
|
||||
ImageLoader.lazyChildren(resumableItems);
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -216,7 +218,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
});
|
||||
|
||||
ApiClient.getJSON(url).done(function (recommendations) {
|
||||
ApiClient.getJSON(url).then(function (recommendations) {
|
||||
|
||||
if (!recommendations.length) {
|
||||
|
||||
|
@ -340,12 +342,12 @@
|
|||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl);
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
});
|
||||
|
||||
pageIdOn('pageshow', "moviesPage", function () {
|
||||
pageIdOn('pagebeforeshow', "moviesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -355,7 +357,7 @@
|
|||
|
||||
if (parentId) {
|
||||
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).done(function (item) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
|
||||
|
||||
page.setAttribute('data-title', item.Name);
|
||||
LibraryMenu.setTitle(item.Name);
|
||||
|
@ -383,7 +385,7 @@
|
|||
var page = $($.mobile.activePage)[0];
|
||||
var pages = page.querySelector('neon-animated-pages');
|
||||
|
||||
$(pages).trigger('tabchange');
|
||||
pages.dispatchEvent(new CustomEvent("tabchange", {}));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
var query = getQuery();
|
||||
|
||||
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
var query = getQuery();
|
||||
query.UserId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Trailers', query)).done(function (result) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Trailers', query)).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
var query = getQuery();
|
||||
|
||||
ApiClient.getAlbumArtists(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getAlbumArtists(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
if (!pageData) {
|
||||
pageData = data[key] = {
|
||||
query: {
|
||||
SortBy: "AlbumArtist,SortName",
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "MusicAlbum",
|
||||
Recursive: true,
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
var query = getQuery();
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
@ -131,7 +131,7 @@
|
|||
$('.btnChangeLayout', page).on('layoutchange', function (e, layout) {
|
||||
|
||||
if (layout == 'Timeline') {
|
||||
getQuery().SortBy = 'PremiereDate,SortName';
|
||||
getQuery().SortBy = 'ProductionYear,PremiereDate,SortName';
|
||||
getQuery().SortOrder = 'Descending';
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
var query = getQuery();
|
||||
|
||||
ApiClient.getArtists(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getArtists(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
110
dashboard-ui/scripts/musicfolders.js
Normal file
110
dashboard-ui/scripts/musicfolders.js
Normal file
|
@ -0,0 +1,110 @@
|
|||
(function ($, document) {
|
||||
|
||||
var data = {};
|
||||
function getPageData() {
|
||||
var key = getSavedQueryKey();
|
||||
var pageData = data[key];
|
||||
|
||||
if (!pageData) {
|
||||
pageData = data[key] = {
|
||||
query: {
|
||||
SortBy: "SortName",
|
||||
SortOrder: "Ascending",
|
||||
Fields: "PrimaryImageAspectRatio,SortName,SyncInfo",
|
||||
StartIndex: 0,
|
||||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
|
||||
Limit: LibraryBrowser.getDefaultPageSize()
|
||||
},
|
||||
view: LibraryBrowser.getSavedView(key) || LibraryBrowser.getDefaultItemsView('Poster', 'Poster')
|
||||
};
|
||||
|
||||
pageData.query.ParentId = LibraryMenu.getTopParentId();
|
||||
LibraryBrowser.loadSavedQueryValues(key, pageData.query);
|
||||
}
|
||||
return pageData;
|
||||
}
|
||||
|
||||
function getQuery() {
|
||||
|
||||
return getPageData().query;
|
||||
}
|
||||
|
||||
function getSavedQueryKey() {
|
||||
|
||||
return LibraryBrowser.getSavedQueryKey('folders');
|
||||
}
|
||||
|
||||
function reloadItems(page, viewPanel) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var query = getQuery();
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
var html = '';
|
||||
var view = getPageData().view;
|
||||
var pagingHtml = LibraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: false,
|
||||
showLimit: false,
|
||||
sortButton: false,
|
||||
addLayoutButton: false,
|
||||
currentLayout: view,
|
||||
updatePageSizeSetting: false,
|
||||
viewIcon: 'filter-list',
|
||||
layouts: 'List,Poster,PosterCard,Timeline'
|
||||
});
|
||||
|
||||
page.querySelector('.listTopPaging').innerHTML = pagingHtml;
|
||||
|
||||
if (view == "Poster") {
|
||||
html = LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "square",
|
||||
context: 'music',
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
lazy: true,
|
||||
centerText: true,
|
||||
overlayPlayButton: true
|
||||
});
|
||||
}
|
||||
|
||||
var elem = page.querySelector('#items');
|
||||
elem.innerHTML = html + pagingHtml;
|
||||
ImageLoader.lazyChildren(elem);
|
||||
|
||||
$('.btnNextPage', page).on('click', function () {
|
||||
query.StartIndex += query.Limit;
|
||||
reloadItems(page, viewPanel);
|
||||
});
|
||||
|
||||
$('.btnPreviousPage', page).on('click', function () {
|
||||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page, viewPanel);
|
||||
});
|
||||
|
||||
LibraryBrowser.saveQueryValues(getSavedQueryKey(), query);
|
||||
LibraryBrowser.setLastRefreshed(page);
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
||||
window.MusicPage.initFoldersTab = function (page, tabContent) {
|
||||
|
||||
};
|
||||
|
||||
window.MusicPage.renderFoldersTab = function (page, tabContent) {
|
||||
|
||||
if (LibraryBrowser.needsRefresh(tabContent)) {
|
||||
reloadItems(tabContent);
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
var query = getQuery();
|
||||
|
||||
ApiClient.getMusicGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
||||
ApiClient.getMusicGenres(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
// Scroll back up so they can see the results from the beginning
|
||||
window.scrollTo(0, 0);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
|
||||
function enableScrollX() {
|
||||
return $.browser.mobile && AppInfo.enableAppLayouts;
|
||||
return browserInfo.mobile && AppInfo.enableAppLayouts;
|
||||
}
|
||||
|
||||
function getSquareShape() {
|
||||
|
@ -30,7 +30,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).done(function (items) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||
|
||||
var elem = page.querySelector('#recentlyAddedSongs');
|
||||
elem.innerHTML = LibraryBrowser.getPosterViewHtml({
|
||||
|
@ -70,7 +70,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
var elem;
|
||||
|
||||
|
@ -115,7 +115,7 @@
|
|||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
var elem;
|
||||
|
||||
|
@ -158,7 +158,7 @@
|
|||
Limit: itemsPerRow()
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
var elem;
|
||||
|
||||
|
@ -208,6 +208,12 @@
|
|||
loadPlaylists(tabContent, parentId);
|
||||
loadRecentlyPlayed(tabContent, parentId);
|
||||
loadFrequentlyPlayed(tabContent, parentId);
|
||||
|
||||
require(['scripts/favorites'], function () {
|
||||
|
||||
FavoriteItems.render(tabContent, Dashboard.getCurrentUserId(), parentId, ['favoriteArtists', 'favoriteAlbums', 'favoriteSongs']);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,6 +259,11 @@
|
|||
depends.push('scripts/musicgenres');
|
||||
renderMethod = 'renderGenresTab';
|
||||
break;
|
||||
case 6:
|
||||
depends.push('scripts/musicfolders');
|
||||
renderMethod = 'renderFoldersTab';
|
||||
initMethod = 'initFoldersTab';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -274,7 +285,7 @@
|
|||
window.MusicPage.renderSuggestedTab = loadSuggestionsTab;
|
||||
window.MusicPage.initSuggestedTab = initSuggestedTab;
|
||||
|
||||
$(document).on('pageinit', "#musicRecommendedPage", function () {
|
||||
pageIdOn('pageinit', "musicRecommendedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -291,11 +302,13 @@
|
|||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl);
|
||||
|
||||
$(pages).on('tabchange', function () {
|
||||
loadTab(page, parseInt(this.selected));
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
}).on('pageshow', "#musicRecommendedPage", function () {
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforeshow', "musicRecommendedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -305,7 +318,7 @@
|
|||
|
||||
if (parentId) {
|
||||
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).done(function (item) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), parentId).then(function (item) {
|
||||
|
||||
page.setAttribute('data-title', item.Name);
|
||||
LibraryMenu.setTitle(item.Name);
|
||||
|
|
|
@ -27,18 +27,18 @@ pageIdOn('pageshow', 'myPreferencesMenuPage', function () {
|
|||
page.querySelector('.lnkSync').classList.add('hide');
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
||||
page.querySelector('.headerUser').innerHTML = user.Name;
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.safari && user.Policy.IsAdministrator) {
|
||||
if (AppInfo.isNativeApp && browserInfo.safari && user.Policy.IsAdministrator) {
|
||||
page.querySelector('.adminSection').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.adminSection').classList.add('hide');
|
||||
}
|
||||
});
|
||||
|
||||
if (AppInfo.isNativeApp && $.browser.safari) {
|
||||
if (AppInfo.isNativeApp && browserInfo.safari) {
|
||||
page.querySelector('.userSection').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.userSection').classList.add('hide');
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
$('#selectLanguage', page).val(AppSettings.displayLanguage());
|
||||
|
||||
page.querySelector('.chkEnableFullScreen').checked = AppSettings.enableFullScreen();
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
|
@ -22,13 +20,12 @@
|
|||
user.Configuration.DisplayUnairedEpisodes = page.querySelector('.chkDisplayUnairedEpisodes').checked;
|
||||
user.Configuration.GroupMoviesIntoBoxSets = page.querySelector('.chkGroupMoviesIntoCollections').checked;
|
||||
|
||||
AppSettings.enableFullScreen(page.querySelector('.chkEnableFullScreen').checked);
|
||||
AppSettings.displayLanguage(page.querySelector('#selectLanguage').value);
|
||||
|
||||
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
|
||||
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
|
||||
loadForm(page, user);
|
||||
|
@ -43,7 +40,7 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
saveUser(page, user);
|
||||
|
||||
|
@ -67,7 +64,7 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
loadForm(page, user);
|
||||
|
||||
|
@ -80,12 +77,6 @@
|
|||
|
||||
$('.fldEnableBackdrops', page).show();
|
||||
|
||||
if (AppInfo.supportsFullScreen) {
|
||||
$('.fldFullscreen', page).show();
|
||||
} else {
|
||||
$('.fldFullscreen', page).hide();
|
||||
}
|
||||
|
||||
if (AppInfo.supportsUserDisplayLanguageSetting) {
|
||||
$('.languageSection', page).show();
|
||||
} else {
|
||||
|
|
|
@ -143,12 +143,12 @@
|
|||
var promise3 = ApiClient.getJSON(ApiClient.getUrl("Users/" + user.Id + "/SpecialViewOptions"));
|
||||
var promise4 = ApiClient.getJSON(ApiClient.getUrl("Users/" + user.Id + "/GroupingOptions"));
|
||||
|
||||
$.when(promise1, promise2, promise3, promise4).done(function (r1, r2, r3, r4) {
|
||||
Promise.all([promise1, promise2, promise3, promise4]).then(function (responses) {
|
||||
|
||||
renderViews(page, user, r4[0]);
|
||||
renderLatestItems(page, user, r1[0]);
|
||||
renderViewOrder(page, user, r2[0]);
|
||||
renderViewStyles(page, user, r3[0]);
|
||||
renderViews(page, user, responses[3]);
|
||||
renderLatestItems(page, user, responses[0]);
|
||||
renderViewOrder(page, user, responses[1]);
|
||||
renderViewStyles(page, user, responses[2]);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
@ -200,9 +200,9 @@
|
|||
displayPreferences.CustomPrefs.home2 = $('#selectHomeSection3', page).val();
|
||||
displayPreferences.CustomPrefs.home3 = $('#selectHomeSection4', page).val();
|
||||
|
||||
ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).done(function () {
|
||||
ApiClient.updateDisplayPreferences('home', displayPreferences, user.Id, AppSettings.displayPreferencesKey()).then(function () {
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
|
||||
loadForm(page, user, displayPreferences);
|
||||
|
@ -218,9 +218,9 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).done(function (displayPreferences) {
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (displayPreferences) {
|
||||
|
||||
saveUser(page, user, displayPreferences);
|
||||
|
||||
|
@ -283,9 +283,9 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).done(function (result) {
|
||||
ApiClient.getDisplayPreferences('home', user.Id, AppSettings.displayPreferencesKey()).then(function (result) {
|
||||
|
||||
loadForm(page, user, result);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
function loadForm(page, user, loggedInUser, allCulturesPromise) {
|
||||
|
||||
allCulturesPromise.done(function (allCultures) {
|
||||
allCulturesPromise.then(function (allCultures) {
|
||||
|
||||
populateLanguages($('#selectAudioLanguage', page), allCultures);
|
||||
populateLanguages($('#selectSubtitleLanguage', page), allCultures);
|
||||
|
@ -30,7 +30,7 @@
|
|||
$('#selectSubtitlePlaybackMode', page).val(user.Configuration.SubtitleMode || "").trigger('change');
|
||||
|
||||
page.querySelector('.chkPlayDefaultAudioTrack').checked = user.Configuration.PlayDefaultAudioTrack || false;
|
||||
page.querySelector('.chkEnableCinemaMode').checked = user.Configuration.EnableCinemaMode || false;
|
||||
page.querySelector('.chkEnableCinemaMode').checked = AppSettings.enableCinemaMode();
|
||||
page.querySelector('.chkEnableChromecastAc3').checked = AppSettings.enableChromecastAc3();
|
||||
page.querySelector('.chkExternalVideoPlayer').checked = AppSettings.enableExternalPlayers();
|
||||
|
||||
|
@ -67,13 +67,13 @@
|
|||
|
||||
var allCulturesPromise = ApiClient.getCultures();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
loadForm(page, response1[0] || response1, response2[0], allCulturesPromise);
|
||||
loadForm(page, responses[1], responses[0], allCulturesPromise);
|
||||
|
||||
});
|
||||
|
||||
ApiClient.getNamedConfiguration("cinemamode").done(function (cinemaConfig) {
|
||||
ApiClient.getNamedConfiguration("cinemamode").then(function (cinemaConfig) {
|
||||
|
||||
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||
$('.cinemaModeOptions', page).show();
|
||||
|
@ -90,12 +90,15 @@
|
|||
|
||||
user.Configuration.SubtitleMode = $('#selectSubtitlePlaybackMode', page).val();
|
||||
user.Configuration.PlayDefaultAudioTrack = page.querySelector('.chkPlayDefaultAudioTrack').checked;
|
||||
user.Configuration.EnableCinemaMode = page.querySelector('.chkEnableCinemaMode').checked;
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
AppSettings.enableCinemaMode(page.querySelector('.chkEnableCinemaMode').checked);
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.alert(Globalize.translate('SettingsSaved'));
|
||||
|
||||
}).always(function () {
|
||||
}, function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
}
|
||||
|
@ -120,7 +123,7 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (result) {
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
|
||||
saveUser(page, result);
|
||||
|
||||
|
@ -147,7 +150,13 @@
|
|||
|
||||
var page = this;
|
||||
|
||||
if (AppInfo.hasKnownExternalPlayerSupport) {
|
||||
if (AppInfo.supportsExternalPlayers) {
|
||||
$('.fldExternalPlayer', page).show();
|
||||
} else {
|
||||
$('.fldExternalPlayer', page).hide();
|
||||
}
|
||||
|
||||
if (AppInfo.supportsExternalPlayerMenu) {
|
||||
$('.labelNativeExternalPlayers', page).show();
|
||||
$('.labelGenericExternalPlayers', page).hide();
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
$('.username', page).html(user.Name);
|
||||
Events.trigger($('#uploadUserImage', page).val('')[0], 'change');
|
||||
|
@ -31,27 +31,35 @@
|
|||
|
||||
$('#fldImage', page).show().html('').html("<img width='140px' src='" + imageUrl + "' />");
|
||||
|
||||
var showImageEditing = false;
|
||||
|
||||
if (user.ConnectLinkType == 'Guest') {
|
||||
|
||||
$('.newImageForm', page).hide();
|
||||
$('#btnDeleteImage', page).hide();
|
||||
$('.connectMessage', page).show();
|
||||
}
|
||||
else if (user.PrimaryImageTag) {
|
||||
|
||||
$('#btnDeleteImage', page).show();
|
||||
$('#headerUploadNewImage', page).show();
|
||||
$('.newImageForm', page).show();
|
||||
showImageEditing = true;
|
||||
$('.connectMessage', page).hide();
|
||||
|
||||
} else {
|
||||
$('.newImageForm', page).show();
|
||||
$('#btnDeleteImage', page).hide();
|
||||
showImageEditing = true;
|
||||
$('#headerUploadNewImage', page).show();
|
||||
$('.connectMessage', page).hide();
|
||||
}
|
||||
|
||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||
|
||||
if (showImageEditing && AppInfo.supportsFileInput && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) {
|
||||
$('.newImageForm', page).show();
|
||||
$('#btnDeleteImage', page).removeClass('hide');
|
||||
} else {
|
||||
$('.newImageForm', page).hide();
|
||||
$('#btnDeleteImage', page).addClass('hide');
|
||||
}
|
||||
});
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
|
||||
|
@ -72,15 +80,15 @@
|
|||
|
||||
switch (evt.target.error.code) {
|
||||
case evt.target.error.NOT_FOUND_ERR:
|
||||
Dashboard.showError(Globalize.translate('FileNotFound'));
|
||||
Dashboard.alert(Globalize.translate('FileNotFound'));
|
||||
break;
|
||||
case evt.target.error.NOT_READABLE_ERR:
|
||||
Dashboard.showError(Globalize.translate('FileReadError'));
|
||||
Dashboard.alert(Globalize.translate('FileReadError'));
|
||||
break;
|
||||
case evt.target.error.ABORT_ERR:
|
||||
break; // noop
|
||||
default:
|
||||
Dashboard.showError(Globalize.translate('FileReadError'));
|
||||
Dashboard.alert(Globalize.translate('FileReadError'));
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -92,7 +100,7 @@
|
|||
function onFileReaderAbort(evt) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
Dashboard.showError(Globalize.translate('FileReadCancelled'));
|
||||
Dashboard.alert(Globalize.translate('FileReadCancelled'));
|
||||
}
|
||||
|
||||
function setFiles(page, files) {
|
||||
|
@ -115,16 +123,14 @@
|
|||
reader.onabort = onFileReaderAbort;
|
||||
|
||||
// Closure to capture the file information.
|
||||
reader.onload = (function (theFile) {
|
||||
return function (e) {
|
||||
reader.onload = function (e) {
|
||||
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:500px;max-height:200px;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:500px;max-height:200px;" src="', e.target.result, '" title="', escape(file.name), '"/>'].join('');
|
||||
|
||||
$('#userImageOutput', page).html(html);
|
||||
$('#fldUpload', page).show();
|
||||
};
|
||||
})(file);
|
||||
$('#userImageOutput', page).html(html);
|
||||
$('#fldUpload', page).show();
|
||||
};
|
||||
|
||||
// Read in the image file as a data URL.
|
||||
reader.readAsDataURL(file);
|
||||
|
@ -168,15 +174,10 @@
|
|||
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
ApiClient.uploadUserImage(userId, 'Primary', file).done(processImageChangeResult);
|
||||
ApiClient.uploadUserImage(userId, 'Primary', file).then(processImageChangeResult);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
self.onFileUploadChange = function (fileUpload) {
|
||||
|
||||
setFiles($.mobile.activePage, fileUpload.files);
|
||||
};
|
||||
}
|
||||
|
||||
window.MyProfilePage = new myProfilePage();
|
||||
|
@ -199,7 +200,7 @@
|
|||
|
||||
var userId = getParameterByName("userId");
|
||||
|
||||
ApiClient.deleteUserImage(userId, "primary").done(processImageChangeResult);
|
||||
ApiClient.deleteUserImage(userId, "primary").then(processImageChangeResult);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -207,6 +208,9 @@
|
|||
|
||||
$('.newImageForm').off('submit', MyProfilePage.onImageSubmit).on('submit', MyProfilePage.onImageSubmit);
|
||||
|
||||
page.querySelector('#uploadUserImage').addEventListener('change', function(e) {
|
||||
setFiles(page, e.target.files);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
@ -218,35 +222,49 @@
|
|||
|
||||
var userid = getParameterByName("userId");
|
||||
|
||||
ApiClient.getUser(userid).done(function (user) {
|
||||
ApiClient.getUser(userid).then(function (user) {
|
||||
|
||||
Dashboard.setPageTitle(user.Name);
|
||||
Dashboard.getCurrentUser().then(function(loggedInUser) {
|
||||
|
||||
Dashboard.setPageTitle(user.Name);
|
||||
|
||||
if (user.ConnectLinkType == 'Guest') {
|
||||
$('.localAccessSection', page).hide();
|
||||
$('.passwordSection', page).hide();
|
||||
}
|
||||
else if (user.HasConfiguredPassword) {
|
||||
$('#btnResetPassword', page).show();
|
||||
$('#fldCurrentPassword', page).show();
|
||||
$('.localAccessSection', page).show();
|
||||
$('.passwordSection', page).show();
|
||||
} else {
|
||||
$('#btnResetPassword', page).hide();
|
||||
$('#fldCurrentPassword', page).hide();
|
||||
$('.localAccessSection', page).hide();
|
||||
$('.passwordSection', page).show();
|
||||
}
|
||||
var showPasswordSection = true;
|
||||
var showLocalAccessSection = false;
|
||||
if (user.ConnectLinkType == 'Guest') {
|
||||
$('.localAccessSection', page).hide();
|
||||
showPasswordSection = false;
|
||||
}
|
||||
else if (user.HasConfiguredPassword) {
|
||||
$('#btnResetPassword', page).show();
|
||||
$('#fldCurrentPassword', page).show();
|
||||
showLocalAccessSection = true;
|
||||
} else {
|
||||
$('#btnResetPassword', page).hide();
|
||||
$('#fldCurrentPassword', page).hide();
|
||||
}
|
||||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '******');
|
||||
$('#btnResetEasyPassword', page).show();
|
||||
} else {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '');
|
||||
$('#btnResetEasyPassword', page).hide();
|
||||
}
|
||||
if (showPasswordSection && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) {
|
||||
$('.passwordSection', page).show();
|
||||
} else {
|
||||
$('.passwordSection', page).hide();
|
||||
}
|
||||
|
||||
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
||||
if (showLocalAccessSection && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) {
|
||||
$('.localAccessSection', page).show();
|
||||
} else {
|
||||
$('.localAccessSection', page).hide();
|
||||
}
|
||||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '******');
|
||||
$('#btnResetEasyPassword', page).removeClass('hide');
|
||||
} else {
|
||||
$('#txtEasyPassword', page).val('').attr('placeholder', '');
|
||||
$('#btnResetEasyPassword', page).addClass('hide');
|
||||
}
|
||||
|
||||
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
||||
});
|
||||
});
|
||||
|
||||
$('#txtCurrentPassword', page).val('');
|
||||
|
@ -262,7 +280,7 @@
|
|||
|
||||
if (easyPassword) {
|
||||
|
||||
ApiClient.updateEasyPassword(userId, easyPassword).done(function () {
|
||||
ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
||||
|
||||
onEasyPasswordSaved(page, userId);
|
||||
|
||||
|
@ -275,11 +293,11 @@
|
|||
|
||||
function onEasyPasswordSaved(page, userId) {
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
user.Configuration.EnableLocalPassword = page.querySelector('.chkEnableLocalEasyPassword').checked;
|
||||
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).done(function () {
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -296,7 +314,7 @@
|
|||
var currentPassword = $('#txtCurrentPassword', page).val();
|
||||
var newPassword = $('#txtNewPassword', page).val();
|
||||
|
||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).done(function () {
|
||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -317,7 +335,7 @@
|
|||
|
||||
if ($('#txtNewPassword', page).val() != $('#txtNewPasswordConfirm', page).val()) {
|
||||
|
||||
Dashboard.showError(Globalize.translate('PasswordMatchError'));
|
||||
Dashboard.alert(Globalize.translate('PasswordMatchError'));
|
||||
} else {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
@ -356,7 +374,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.resetUserPassword(userId).done(function () {
|
||||
ApiClient.resetUserPassword(userId).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
@ -386,7 +404,7 @@
|
|||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.resetEasyPassword(userId).done(function () {
|
||||
ApiClient.resetEasyPassword(userId).then(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
saveUser(page, user);
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
$('.btnSelectSyncPath', page).on('click', function () {
|
||||
|
||||
require(['nativedirectorychooser'], function () {
|
||||
NativeDirectoryChooser.chooseDirectory().done(function (path) {
|
||||
NativeDirectoryChooser.chooseDirectory().then(function (path) {
|
||||
$('#txtSyncPath', page).val(path);
|
||||
});
|
||||
});
|
||||
|
@ -80,7 +80,7 @@
|
|||
|
||||
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getUser(userId).done(function (user) {
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
|
||||
loadForm(page, user);
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue