1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

get headroom from bower

This commit is contained in:
Luke Pulverenti 2015-11-28 15:39:14 -05:00
parent 77e3111ad1
commit 27c3bdc042
58 changed files with 1224 additions and 3803 deletions

View file

@ -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();

View file

@ -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 AppInfo.isNativeApp || window.location.href.toLowerCase().indexOf('https') == 0;
}
function initSignup(page) {

View file

@ -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);
@ -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';
}

View file

@ -449,7 +449,7 @@
function getCurrentItemId() {
var url = window.location.hash || getWindowUrl();
var url = window.location.hash || window.location.href;
return getParameterByName('id', url);
}

View file

@ -1,53 +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, "&lt;");
// 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, '&amp;').
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, '&lt;').
replace(/>/g, '&gt;');
}
// 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) {
$.fn.checked = function (value) {
if (value === true || value === false) {
// Set the value of the checkbox
return $(this).each(function () {
@ -59,99 +10,6 @@ $.fn.checked = function (value) {
}
};
$.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;
};
}
/*
* 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 getWindowUrl(win) {
return (win || window).location.href;
}
function getWindowLocationSearch(win) {
var search = (win || window).location.search;
@ -252,13 +110,4 @@ function parseISO8601Date(s, options) {
}
return new Date(ms);
}
// 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');
};
}

View file

@ -23,7 +23,7 @@
{ 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: 'HeaderFavoriteArtists', types: "MusicArtist", id: "favoriteArtists", shape: getSquareShape(), preferThumb: false, showTitle: true, overlayText: false, showParentTitle: true, centerText: true, overlayMoreButton: true, defaultAction: 'instantmix' },
{ 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' }
];

View file

@ -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();

View file

@ -1,5 +1,32 @@
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, '&amp;').
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, '&lt;').
replace(/>/g, '&gt;');
}
var pageSizeKey = 'pagesize_v4';
var libraryBrowser = {
@ -27,7 +54,7 @@
getSavedQueryKey: function (modifier) {
return getWindowUrl().split('#')[0] + (modifier || '');
return window.location.href.split('#')[0] + (modifier || '');
},
loadSavedQueryValues: function (key, query) {
@ -139,12 +166,6 @@
return false;
}
if (typeof ($.browser.androidVersion) == 'number' && !isNaN($.browser.androidVersion)) {
if ($.browser.androidVersion < 5) {
return false;
}
}
return false;
},
@ -378,7 +399,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');
@ -408,7 +429,7 @@
}
};
if (getWindowUrl().toLowerCase().indexOf(url.toLowerCase()) != -1) {
if (window.location.href.toLowerCase().indexOf(url.toLowerCase()) != -1) {
afterNavigate.call($($.mobile.activePage)[0]);
} else {

View file

@ -2,26 +2,11 @@
var showOverlayTimeout;
function getCardHoverElement(e) {
var elem = parentWithClass(e.target, 'card');
if (!elem) {
return null;
}
if (elem.classList.contains('bannerCard')) {
return null;
}
return elem;
}
function onHoverOut(e) {
var elem = getCardHoverElement(e);
var elem = e.target;
if (!elem) {
if (!elem.classList.contains('card')) {
return;
}
@ -732,9 +717,9 @@
function onHoverIn(e) {
var elem = getCardHoverElement(e);
var elem = e.target;
if (!elem) {
if (!elem.classList.contains('card')) {
return;
}

View file

@ -73,7 +73,7 @@
var headerSearchButton = document.querySelector('.headerSearchButton');
if (user.localUser) {
$('.btnCast', header).visible(true);
$('.btnCast', header).removeClass('hide');
if (headerSearchButton) {
headerSearchButton.classList.remove('hide');
@ -90,7 +90,7 @@
});
} else {
$('.btnCast', header).visible(false);
$('.btnCast', header).addClass('hide');
document.querySelector('.headerVoiceButton').classList.add('hide');
if (headerSearchButton) {
headerSearchButton.classList.add('hide');
@ -145,24 +145,6 @@
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');
//}
}
function getItemHref(item, context) {
return LibraryBrowser.getHref(item, context);
@ -435,9 +417,9 @@
if (!user) {
$('.adminMenuOptions').visible(false);
$('.lnkMySync').visible(false);
$('.userMenuOptions').visible(false);
$('.adminMenuOptions').addClass('hide');
$('.lnkMySync').addClass('hide');
$('.userMenuOptions').addClass('hide');
return;
}
@ -519,15 +501,15 @@
});
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');
}
}
@ -565,13 +547,17 @@
setTimeout(function () {
closeMainDrawer();
// On mobile devices don't navigate until after the closing animation has completed or it may stutter
var delay = $.browser.mobile ? 350 : 0;
setTimeout(function () {
if (action) {
action();
} else {
Dashboard.navigate(link.href);
}
}, 350);
}, delay);
}, 50);
}
@ -586,9 +572,12 @@
closeMainDrawer();
// On mobile devices don't navigate until after the closing animation has completed or it may stutter
var delay = $.browser.mobile ? 350 : 0;
setTimeout(function () {
Dashboard.logout();
}, 350);
}, delay);
}
return false;
@ -779,7 +768,6 @@
if (!viewMenuBar) {
renderHeader();
updateViewMenuBarHeadroom(page, document.querySelector('.viewMenuBar'));
updateCastIcon();
@ -791,7 +779,6 @@
} else {
viewMenuBar.classList.remove('hide');
updateLibraryNavLinks(page);
updateViewMenuBarHeadroom(page, viewMenuBar);
requiresViewMenuRefresh = false;
}
}
@ -924,7 +911,7 @@
return;
}
requirejs(["thirdparty/headroom"], function () {
requirejs(["headroom"], function () {
// construct an instance of Headroom, passing the element
var headroom = new Headroom(elem, {

View file

@ -998,7 +998,7 @@
//show stop button
$('#video-playButton', videoControls).hide();
$('#video-pauseButton', videoControls).show();
$('.videoTrackControl').visible(false);
$('.videoTrackControl').addClass('hide');
var videoElement = $('#videoElement', mediaPlayerContainer);
@ -1032,11 +1032,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');
}
@ -1165,7 +1165,7 @@
}
if (length < 2) {
$('.videoTrackControl').visible(false);
$('.videoTrackControl').addClass('hide');
return;
}
@ -1187,8 +1187,8 @@
nextTrackButton.removeAttribute('disabled');
}
$(previousTrackButton).visible(true);
$(nextTrackButton).visible(true);
$(previousTrackButton).removeClass('hide');
$(nextTrackButton).removeClass('hide');
};
}

View file

@ -589,11 +589,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;

View file

@ -108,15 +108,17 @@
});
}
for (var i = 0, length = list.length; i < length; i++) {
require(['humanedate'], function() {
for (var i = 0, length = list.length; i < length; i++) {
var notification = list[i];
var notification = list[i];
html += getNotificationHtml(notification);
html += getNotificationHtml(notification);
}
}
elem.html(html).trigger('create');
elem.html(html).trigger('create');
});
}
function getNotificationHtml(notification) {

View file

@ -375,7 +375,12 @@
// See bindEvents for why this is necessary
if (volumeSlider) {
$(volumeSlider).visible(showVolumeSlider);
if (showVolumeSlider) {
volumeSlider.classList.remove('hide');
} else {
volumeSlider.classList.add('hide');
}
if (!volumeSlider.dragging) {
volumeSlider.value = playState.VolumeLevel || 0;

View file

@ -545,7 +545,13 @@
var item = state.NowPlayingItem;
var displayName = item ? MediaController.getNowPlayingNameHtml(item).replace('<br/>', ' - ') : '';
$('.nowPlayingPageTitle', page).html(displayName).visible(displayName.length > 0);
$('.nowPlayingPageTitle', page).html(displayName);
if (displayName.length > 0) {
$('.nowPlayingPageTitle', page).removeClass('hide');
} else {
$('.nowPlayingPageTitle', page).addClass('hide');
}
var url;
var backdropUrl = null;

View file

@ -151,13 +151,16 @@
html += '<div class="searchResultsContainer"><div class="itemsContainer"></div></div></div>';
elem = $(html).appendTo(document.body).hide()[0];
elem = $(html).appendTo(document.body)[0];
$(elem).createCardMenus();
}
return elem;
}
var currentAnimation;
var isVisible;
function onHeaderSearchChange(val) {
var elem;
@ -166,8 +169,11 @@
elem = getSearchOverlay(true);
$(elem).show();
elem.style.opacity = '1';
if (!isVisible) {
fadeIn(elem, 1);
}
isVisible = true;
document.body.classList.add('bodyWithPopupOpen');
updateSearchOverlay(elem, val);
@ -176,16 +182,34 @@
elem = getSearchOverlay(false);
if (elem) {
require(["jquery", "velocity"], function ($, Velocity) {
$(elem).velocity("fadeOut");
document.body.classList.remove('bodyWithPopupOpen');
});
updateSearchOverlay(elem, '');
if (isVisible) {
fadeOut(elem, 1);
isVisible = false;
}
document.body.classList.remove('bodyWithPopupOpen');
}
}
}
function fadeIn(elem, iterations) {
var keyframes = [
{ opacity: '0', offset: 0 },
{ opacity: '1', offset: 1 }];
var timing = { duration: 200, iterations: iterations, fill: 'both' };
currentAnimation = elem.animate(keyframes, timing);
}
function fadeOut(elem, iterations) {
var keyframes = [
{ opacity: '1', offset: 0 },
{ opacity: '0', offset: 1 }];
var timing = { duration: 600, iterations: iterations, fill: 'both' };
currentAnimation = elem.animate(keyframes, timing);
}
function bindSearchEvents() {
require(['searchmenu'], function () {

View file

@ -9,16 +9,13 @@
Dashboard.importCss('css/search.css');
$('.headerSearchInput').val('');
require(["jquery", "velocity"], function ($, Velocity) {
$('.btnCloseSearch').hide();
var elem = $('.viewMenuSearch').removeClass('hide')[0];
$('.btnCloseSearch').hide();
var elem = $('.viewMenuSearch').removeClass('hide')[0];
fadeIn(elem, 1).onfinish = function () {
$('.headerSearchInput').focus();
$('.btnCloseSearch').show();
};
});
fadeIn(elem, 1).onfinish = function () {
$('.headerSearchInput').focus();
$('.btnCloseSearch').show();
};
};
function fadeIn(elem, iterations) {

View file

@ -1,20 +1,5 @@
(function () {
$.ajaxSetup({
crossDomain: true
});
if ($.browser.msie || $.browser.edge) {
// This is unfortunately required due to IE's over-aggressive caching.
// https://github.com/MediaBrowser/MediaBrowser/issues/179
$.ajaxSetup({
cache: false
});
}
$.support.cors = true;
function onOneDocumentClick() {
document.removeEventListener('click', onOneDocumentClick);
@ -50,7 +35,7 @@ var Dashboard = {
return true;
}
var url = getWindowUrl().toLowerCase();
var url = window.location.href.toLowerCase();
return url.indexOf('mediabrowser.tv') != -1 ||
url.indexOf('emby.media') != -1;
@ -135,7 +120,7 @@ var Dashboard = {
// Try to get the server address from the browser url
// This will preserve protocol, hostname, port and subdirectory
var urlLower = getWindowUrl().toLowerCase();
var urlLower = window.location.href.toLowerCase();
var index = urlLower.indexOf('/web');
if (index == -1) {
index = urlLower.indexOf('/dashboard');
@ -346,7 +331,7 @@ var Dashboard = {
reloadPage: function () {
var currentUrl = getWindowUrl().toLowerCase();
var currentUrl = window.location.href.toLowerCase();
var newUrl;
// If they're on a plugin config page just go back to the dashboard
@ -354,7 +339,7 @@ var Dashboard = {
if (currentUrl.indexOf('configurationpage') != -1) {
newUrl = "dashboard.html";
} else {
newUrl = getWindowUrl();
newUrl = window.location.href;
}
window.location.href = newUrl;
@ -489,10 +474,6 @@ var Dashboard = {
if (elem) {
elem.active = false;
setTimeout(function () {
elem.active = false;
}, 100);
}
},
@ -1506,7 +1487,7 @@ var Dashboard = {
},
isServerlessPage: function () {
var url = getWindowUrl().toLowerCase();
var url = window.location.href.toLowerCase();
return url.indexOf('connectlogin.html') != -1 || url.indexOf('selectserver.html') != -1 || url.indexOf('login.html') != -1 || url.indexOf('forgotpassword.html') != -1 || url.indexOf('forgotpasswordpin.html') != -1;
},
@ -1555,16 +1536,6 @@ var Dashboard = {
}
}
if (typeof ($.browser.androidVersion) == 'number' && !isNaN($.browser.androidVersion)) {
if ($.browser.androidVersion < 5) {
quality -= 10;
if ($.browser.androidVersion < 4.4) {
quality -= 10;
}
}
}
return quality;
},
@ -1585,20 +1556,18 @@ var Dashboard = {
function generateDeviceName() {
var name = "Web Browser";
var name;
if ($.browser.chrome) {
name = "Chrome";
} else if ($.browser.safari) {
name = "Safari";
} else if ($.browser.msie) {
name = "Internet Explorer";
} else if ($.browser.opera) {
name = "Opera";
} else if ($.browser.mozilla) {
name = "Firefox";
} else if ($.browser.edge) {
name = "Edge";
} else if ($.browser.mozilla) {
name = "Firefox";
} else if ($.browser.msie) {
name = "Internet Explorer";
} else {
name = "Web Browser";
}
if ($.browser.version) {
@ -1711,15 +1680,13 @@ var AppInfo = {};
AppInfo.enableAppStorePolicy = isCordova;
var isIOS = $.browser.safari || $.browser.ipad || $.browser.iphone;
var isIOS = $.browser.ipad || $.browser.iphone;
var isAndroid = $.browser.android;
var isMobile = $.browser.mobile;
if (isIOS) {
if (isMobile) {
AppInfo.hasLowImageBandwidth = true;
}
AppInfo.hasLowImageBandwidth = true;
if (isCordova) {
//AppInfo.enableSectionTransitions = true;
@ -1735,15 +1702,12 @@ var AppInfo = {};
}
} else {
if (isMobile) {
AppInfo.enableDetailPageChapters = false;
AppInfo.enableDetailsMenuImages = false;
AppInfo.enableMovieHomeSuggestions = false;
AppInfo.cardMargin = 'largeCardMargin';
AppInfo.enableDetailPageChapters = false;
AppInfo.enableDetailsMenuImages = false;
AppInfo.enableMovieHomeSuggestions = false;
AppInfo.cardMargin = 'largeCardMargin';
AppInfo.forcedImageFormat = 'jpg';
}
AppInfo.forcedImageFormat = 'jpg';
}
}
@ -1773,16 +1737,10 @@ var AppInfo = {};
}
}
if (!$.browser.tv && !isIOS) {
// This doesn't perform well on iOS
AppInfo.enableHeadRoom = !isIOS;
// Don't enable headroom on mobile chrome when the address bar is visible
// With two bars hiding and showing it gets a little awkward
if (AppInfo.isNativeApp || window.navigator.standalone || !$.browser.mobile) {
AppInfo.enableHeadRoom = true;
}
}
AppInfo.supportsDownloading = !AppInfo.isNativeApp || !$.browser.safari;
AppInfo.supportsDownloading = !(AppInfo.isNativeApp && isIOS);
AppInfo.enableUserImage = true;
AppInfo.hasPhysicalVolumeButtons = isCordova || isMobile;
@ -1821,7 +1779,7 @@ var AppInfo = {};
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, AppInfo.appName, AppInfo.appVersion, AppInfo.deviceName, AppInfo.deviceId, capabilities);
if (getWindowUrl().toLowerCase().indexOf('wizardstart.html') != -1) {
if (window.location.href.toLowerCase().indexOf('wizardstart.html') != -1) {
window.ConnectionManager.clearData();
}
@ -1954,10 +1912,6 @@ var AppInfo = {};
var urlArgs = "v=" + window.dashboardVersion;
if ($.browser.msie || $.browser.edge) {
urlArgs += new Date().getTime();
}
var paths = {
velocity: "bower_components/velocity/velocity.min",
tvguide: 'components/tvguide/tvguide',
@ -1968,7 +1922,10 @@ var AppInfo = {};
medialibraryeditor: 'components/medialibraryeditor/medialibraryeditor',
howler: 'bower_components/howler.js/howler.min',
sortable: 'bower_components/Sortable/Sortable.min',
masonry: 'bower_components/masonry/dist/masonry.pkgd.min'
isMobile: 'bower_components/isMobile/isMobile.min',
headroom: 'bower_components/headroom.js/dist/headroom.min',
masonry: 'bower_components/masonry/dist/masonry.pkgd.min',
humanedate: 'components/humanedate'
};
if (Dashboard.isRunningInCordova()) {
@ -2049,10 +2006,6 @@ var AppInfo = {};
Dashboard.importCss('css/livetv.css');
return {};
});
define("fontawesome", [], function () {
Dashboard.importCss('thirdparty/fontawesome/css/font-awesome.min.css');
return {};
});
define("detailtablecss", [], function () {
Dashboard.importCss('css/detailtable.css');
return {};
@ -2141,26 +2094,24 @@ var AppInfo = {};
define("fileupload", ["apiclient/fileupload"]);
}
define("buttonenabled", ["components/buttonenabled"]);
var deps = [];
if (!deviceId) {
deps.push('cryptojs-sha1');
}
if (!window.Promise) {
deps.push('bower_components/native-promise-only/lib/npo.src');
}
if (!window.fetch) {
deps.push('bower_components/fetch/fetch');
}
deps.push('scripts/mediacontroller');
deps.push('scripts/globalize');
deps.push('apiclient/events');
require(deps, function () {
loadImageCache();
$.extend(AppInfo, Dashboard.getAppInfo(appName, appVersion, deviceId, deviceName));
initAfterDependencies(promiseResolve, capabilities);
@ -2196,6 +2147,9 @@ var AppInfo = {};
deps.push('scripts/appsettings');
deps.push('apiclient/apiclient');
deps.push('apiclient/connectionmanager');
deps.push('apiclient/deferred');
deps.push('apiclient/credentials');
deps.push('apiclient/md5');
require(deps, function () {
@ -2227,48 +2181,45 @@ var AppInfo = {};
document.title = Globalize.translateDocument(document.title, 'html');
$(function () {
var mainDrawerPanelContent = document.querySelector('.mainDrawerPanelContent');
var mainDrawerPanelContent = document.querySelector('.mainDrawerPanelContent');
if (mainDrawerPanelContent) {
if (mainDrawerPanelContent) {
var newHtml = mainDrawerPanelContent.innerHTML.substring(4);
newHtml = newHtml.substring(0, newHtml.length - 3);
var newHtml = mainDrawerPanelContent.innerHTML.substring(4);
newHtml = newHtml.substring(0, newHtml.length - 3);
var srch = 'data-require=';
var index = newHtml.indexOf(srch);
var depends;
var srch = 'data-require=';
var index = newHtml.indexOf(srch);
var depends;
if (index != -1) {
if (index != -1) {
var requireAttribute = newHtml.substring(index + srch.length + 1);
var requireAttribute = newHtml.substring(index + srch.length + 1);
requireAttribute = requireAttribute.substring(0, requireAttribute.indexOf('"'));
depends = requireAttribute.split(',');
}
depends = depends || [];
if (newHtml.indexOf('type-interior') != -1) {
depends.push('jqmpopup');
depends.push('jqmlistview');
depends.push('jqmcollapsible');
depends.push('jqmcontrolgroup');
depends.push('jqmcheckbox');
}
require(depends, function () {
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
onAppReady(promiseResolve);
});
return;
requireAttribute = requireAttribute.substring(0, requireAttribute.indexOf('"'));
depends = requireAttribute.split(',');
}
onAppReady(promiseResolve);
});
depends = depends || [];
if (newHtml.indexOf('type-interior') != -1) {
depends.push('jqmpopup');
depends.push('jqmlistview');
depends.push('jqmcollapsible');
depends.push('jqmcontrolgroup');
depends.push('jqmcheckbox');
}
require(depends, function () {
// Don't like having to use jQuery here, but it takes care of making sure that embedded script executes
$(mainDrawerPanelContent).html(Globalize.translateDocument(newHtml, 'html'));
onAppReady(promiseResolve);
});
return;
}
onAppReady(promiseResolve);
});
});
}
@ -2324,10 +2275,8 @@ var AppInfo = {};
deps.push('cordova/ios/tabbar');
}
deps.push('scripts/remotecontrol');
deps.push('scripts/search');
deps.push('scripts/librarylist');
deps.push('scripts/notifications');
deps.push('scripts/alphapicker');
deps.push('thirdparty/jquery.unveil-custom.js');
deps.push('scripts/playlistmanager');
@ -2339,7 +2288,23 @@ var AppInfo = {};
$.mobile.initializePage();
promiseResolve();
require(['scripts/thememediaplayer']);
var postInitDependencies = [];
if (navigator.webkitPersistentStorage) {
postInitDependencies.push('components/imagestore');
}
else if (Dashboard.isRunningInCordova()) {
postInitDependencies.push('cordova/imagestore');
}
postInitDependencies.push('scripts/thememediaplayer');
postInitDependencies.push('scripts/notifications');
postInitDependencies.push('scripts/remotecontrol');
require(postInitDependencies);
Dashboard.importCss('css/notifications.css');
Dashboard.importCss('css/chromecast.css');
});
if (AppInfo.enableNowPlayingBar) {
@ -2347,16 +2312,6 @@ var AppInfo = {};
}
}
function loadImageCache() {
if (navigator.webkitPersistentStorage) {
require(['components/imagestore']);
}
else if (Dashboard.isRunningInCordova()) {
require(['cordova/imagestore']);
}
}
function initCordovaWithDeviceId(deferred, deviceId) {
cordova.getAppVersion.getVersionNumber(function (appVersion) {
@ -2387,32 +2342,113 @@ var AppInfo = {};
}, false);
}
Dashboard.initPromise = new Promise(function (resolve, reject) {
function setBrowserInfo(isMobile) {
setAppInfo();
setDocumentClasses();
var uaMatch = function (ua) {
ua = ua.toLowerCase();
function onWebComponentsReady() {
if (Dashboard.isRunningInCordova()) {
initCordova(resolve);
} else {
init(resolve, Dashboard.capabilities());
var match = /(edge)[ \/]([\w.]+)/.exec(ua) ||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(safari)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
var platform_match = /(ipad)/.exec(ua) ||
/(iphone)/.exec(ua) ||
/(android)/.exec(ua) ||
[];
var browser = match[1] || "";
if (ua.indexOf("windows phone") != -1 || ua.indexOf("iemobile") != -1) {
// http://www.neowin.net/news/ie11-fakes-user-agent-to-fool-gmail-in-windows-phone-81-gdr1-update
browser = "msie";
}
else if (ua.indexOf("like gecko") != -1 && ua.indexOf('webkit') == -1 && ua.indexOf('opera') == -1 && ua.indexOf('chrome') == -1 && ua.indexOf('safari') == -1) {
browser = "msie";
}
return {
browser: browser,
version: match[2] || "0",
platform: platform_match[0] || ""
};
};
var userAgent = window.navigator.userAgent;
var matched = uaMatch(userAgent);
var browser = {};
if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
}
initRequire();
if ('registerElement' in document && 'content' in document.createElement('template')) {
onWebComponentsReady();
} else {
document.addEventListener('WebComponentsReady', function () {
var delay = $.browser.mobile ? 500 : 300;
setTimeout(onWebComponentsReady, delay);
});
require(['bower_components/webcomponentsjs/webcomponents-lite.min.js']);
if (matched.platform) {
browser[matched.platform] = true;
}
if (!browser.chrome && !browser.msie && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf("webkit") != -1) {
browser.safari = true;
}
if (isMobile.any) {
browser.mobile = true;
}
jQuery.browser = browser;
}
initRequire();
var initialDependencies = [];
initialDependencies.push('isMobile');
initialDependencies.push('thirdparty/jquerymobile-1.4.5/jquery.mobile.custom.js');
initialDependencies.push('apiclient/logger');
initialDependencies.push('apiclient/store');
initialDependencies.push('apiclient/device');
var supportsNativeWebComponents = 'registerElement' in document && 'content' in document.createElement('template');
if (!supportsNativeWebComponents) {
initialDependencies.push('bower_components/webcomponentsjs/webcomponents-lite.min.js');
}
if (!window.Promise) {
initialDependencies.push('bower_components/native-promise-only/lib/npo.src');
}
require(initialDependencies, function (isMobile) {
$.mobile.filterHtml = Dashboard.filterHtml;
Dashboard.initPromise = new Promise(function (resolve, reject) {
function onWebComponentsReady() {
if (Dashboard.isRunningInCordova()) {
initCordova(resolve);
} else {
init(resolve, Dashboard.capabilities());
}
}
setBrowserInfo(isMobile);
setAppInfo();
setDocumentClasses();
if (supportsNativeWebComponents) {
onWebComponentsReady();
} else {
document.addEventListener('WebComponentsReady', function () {
setTimeout(onWebComponentsReady, 500);
});
}
});
});
})();
@ -2555,6 +2591,4 @@ window.addEventListener("beforeunload", function () {
apiClient.closeWebSocket();
}
}
});
$.mobile.filterHtml = Dashboard.filterHtml;
});

View file

@ -391,7 +391,11 @@
SupportsSync: true
};
$('.categorySyncButton', page).visible(isAvailable(item));
if (isAvailable(item)) {
$('.categorySyncButton', page).removeClass('hide');
} else {
$('.categorySyncButton', page).addClass('hide');
}
});
}

View file

@ -1,5 +1,4 @@

$.fn.taskButton = function (options) {
$.fn.taskButton = function (options) {
function pollTasks(button) {
@ -34,7 +33,13 @@ $.fn.taskButton = function (options) {
return;
}
$(button).buttonEnabled(task.State == 'Idle').attr('data-taskid', task.Id);
if (task.State == 'Idle') {
$(button).removeAttr('disabled');
} else {
$(button).attr('disabled', 'disabled');
}
$(button).attr('data-taskid', task.Id);
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);