";
html += "";
}
return html;
}
function loadlibraryButtons(elem, userId, index) {
return getUserViews(userId).then(function (items) {
var html = ' ';
if (index) {
html += '
' + Globalize.translate('HeaderMyMedia') + '
';
}
html += '
';
html += getLibraryButtonsHtml(items);
html += '
';
return getAppInfo().then(function (infoHtml) {
elem.innerHTML = html + infoHtml;
});
});
}
/**
* Returns a random integer between min (inclusive) and max (inclusive)
* Using Math.round() will give you a non-uniform distribution!
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getAppInfo() {
var frequency = 86400000;
if (AppInfo.isNativeApp) {
frequency = 172800000;
}
var cacheKey = 'lastappinfopresent5';
var lastDatePresented = parseInt(appSettings.get(cacheKey) || '0');
// Don't show the first time, right after installation
if (!lastDatePresented) {
appSettings.set(cacheKey, new Date().getTime());
return Promise.resolve('');
}
if ((new Date().getTime() - lastDatePresented) < frequency) {
return Promise.resolve('');
}
return Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
appSettings.set(cacheKey, new Date().getTime());
if (pluginSecurityInfo.IsMBSupporter) {
return '';
}
var infos = [getPremiereInfo];
if (!browserInfo.safari || !AppInfo.isNativeApp) {
infos.push(getTheaterInfo);
}
if (!AppInfo.enableAppLayouts) {
infos.push(getUpgradeMobileLayoutsInfo);
}
appSettings.set(cacheKey, new Date().getTime());
return infos[getRandomInt(0, infos.length - 1)]();
});
}
function getCard(img, target, shape) {
shape = shape || 'backdropCard';
var html = '
';
return html;
}
function getTheaterInfo() {
var html = '';
html += '
';
html += '
Try Emby Theater
';
var nameText = AppInfo.isNativeApp ? 'Emby Theater' : 'Emby Theater';
html += '
A beautiful app for your TV and large screen tablet. ' + nameText + ' runs on Windows, Xbox One, Google Chrome, FireFox, Microsoft Edge and Opera.
';
html += '
';
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater1.png', 'https://emby.media/download');
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater2.png', 'https://emby.media/download');
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater3.png', 'https://emby.media/download');
html += '
';
html += ' ';
html += '
';
return html;
}
function getPremiereInfo() {
var html = '';
html += '
';
html += '
Try Emby Premiere
';
var cardTarget = AppInfo.isNativeApp ? '' : 'https://emby.media/premiere';
var learnMoreText = AppInfo.isNativeApp ? '' : 'Learn more';
html += '
Design beautiful Cover Art, enjoy free access to Emby apps, and more. ' + learnMoreText + '
';
html += '
';
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater1.png', cardTarget);
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater2.png', cardTarget);
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/theater3.png', cardTarget);
html += '
';
html += ' ';
html += '
';
return html;
}
function getUpgradeMobileLayoutsInfo() {
var html = '';
html += '
';
html += '
Unlock Improved Layouts with Emby Premiere
';
var cardTarget = AppInfo.isNativeApp ? '' : 'https://emby.media/premiere';
var learnMoreText = AppInfo.isNativeApp ? '' : 'Learn more';
html += '
Combined horizontal and vertical swiping, better detail layouts, and more. ' + learnMoreText + '
';
html += '
';
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/ms1.png', cardTarget, 'portraitCard');
html += getCard('https://raw.githubusercontent.com/MediaBrowser/Emby.Resources/master/apps/ms2.png', cardTarget, 'portraitCard');
html += '
';
html += ' ';
html += '
';
return html;
}
function loadRecentlyAdded(elem, user) {
var options = {
Limit: 20,
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
ImageTypeLimit: 1,
EnableImageTypes: "Primary,Backdrop,Thumb"
};
return ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/Latest', options)).then(function (items) {
var html = '';
var cardLayout = false;
if (items.length) {
html += '