2015-05-06 20:11:51 -07:00
|
|
|
|
(function (window, document, $, devicePixelRatio) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
function renderHeader() {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2013-12-28 00:09:05 -07:00
|
|
|
|
var html = '<div class="viewMenuBar ui-bar-b">';
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-26 08:31:50 -07:00
|
|
|
|
html += '<button type="button" data-role="none" onclick="history.back();" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-left"></div></button>';
|
2015-04-25 20:25:07 -07:00
|
|
|
|
|
2014-06-21 22:52:31 -07:00
|
|
|
|
html += '<button type="button" data-role="none" title="Menu" class="headerButton dashboardMenuButton barsMenuButton headerButtonLeft">';
|
2014-12-19 23:06:27 -07:00
|
|
|
|
html += '<div class="barMenuInner fa fa-bars">';
|
2014-07-27 15:01:29 -07:00
|
|
|
|
html += '</div>';
|
2014-06-21 22:52:31 -07:00
|
|
|
|
html += '</button>';
|
|
|
|
|
|
|
|
|
|
html += '<button type="button" data-role="none" title="Menu" class="headerButton libraryMenuButton barsMenuButton headerButtonLeft">';
|
2014-12-19 23:06:27 -07:00
|
|
|
|
html += '<div class="barMenuInner fa fa-bars">';
|
2014-07-27 15:01:29 -07:00
|
|
|
|
html += '</div>';
|
2014-05-21 20:35:18 -07:00
|
|
|
|
html += '</button>';
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
2015-03-21 11:12:12 -07:00
|
|
|
|
html += '<div class="libraryMenuButtonText headerButton"><span>EMBY</span></div>';
|
2015-01-20 23:26:16 -07:00
|
|
|
|
|
2013-12-27 14:10:06 -07:00
|
|
|
|
html += '<div class="viewMenuSecondary">';
|
|
|
|
|
|
2015-05-29 18:07:54 -07:00
|
|
|
|
html += '<button id="btnCast" class="btnCast btnDefaultCast headerButton headerButtonRight" type="button" data-role="none" style="display:none;"><div class="headerSelectedPlayer"></div><i class="material-icons btnCastImageDefault">cast</i><i class="material-icons btnCastImageActive">cast_connected</i></button>';
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2015-05-29 18:07:54 -07:00
|
|
|
|
html += '<button onclick="Search.showSearchPanel();" type="button" data-role="none" class="headerButton headerButtonRight headerSearchButton" style="display:none;"><i class="material-icons">search</i></button>';
|
2015-05-25 10:32:22 -07:00
|
|
|
|
html += '<div class="viewMenuSearch hide">';
|
|
|
|
|
html += '<form class="viewMenuSearchForm">';
|
2015-05-22 08:59:17 -07:00
|
|
|
|
html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />';
|
|
|
|
|
html += '<div class="searchInputIcon fa fa-search"></div>';
|
|
|
|
|
html += '<button data-role="none" type="button" data-iconpos="notext" class="imageButton btnCloseSearch"><i class="fa fa-close"></i></button>';
|
2015-05-25 10:32:22 -07:00
|
|
|
|
html += '</form>';
|
|
|
|
|
html += '</div>';
|
2015-05-22 08:59:17 -07:00
|
|
|
|
|
2015-06-01 22:46:06 -07:00
|
|
|
|
html += '<button onclick="VoiceInputManager.startListening();" type="button" data-role="none" class="headerButton headerButtonRight headerVoiceButton" style="display:none;"><i class="material-icons">mic</i></button>';
|
|
|
|
|
|
2015-06-03 21:50:10 -07:00
|
|
|
|
//if (AppInfo.isNativeApp && $.browser.android)
|
|
|
|
|
//{
|
|
|
|
|
// html += '<button class="headerButtonViewMenu headerButton headerButtonRight" type="button" data-role="none"><i class="material-icons">more_vert</i></button>';
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if (!$.browser.mobile && !AppInfo.isTouchPreferred) {
|
2015-06-01 22:46:06 -07:00
|
|
|
|
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton" style="display:none;"><i class="material-icons">settings</i></a>';
|
|
|
|
|
}
|
2015-05-22 08:59:17 -07:00
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
$(document.body).append(html);
|
|
|
|
|
$('.viewMenuBar').lazyChildren();
|
2015-05-22 08:59:17 -07:00
|
|
|
|
|
|
|
|
|
$(document).trigger('headercreated');
|
|
|
|
|
bindMenuEvents();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function addUserToHeader(user) {
|
|
|
|
|
|
|
|
|
|
var header = $('.viewMenuBar');
|
|
|
|
|
|
2015-05-08 09:58:27 -07:00
|
|
|
|
if (user.localUser) {
|
2015-05-22 08:59:17 -07:00
|
|
|
|
$('.btnCast', header).show();
|
|
|
|
|
$('.headerSearchButton', header).show();
|
2015-06-01 22:46:06 -07:00
|
|
|
|
|
2015-06-02 10:46:44 -07:00
|
|
|
|
requirejs(['voice/voice'], function () {
|
2015-06-01 22:46:06 -07:00
|
|
|
|
|
|
|
|
|
if (VoiceInputManager.isSupported()) {
|
|
|
|
|
$('.headerVoiceButton', header).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.headerVoiceButton', header).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
} else {
|
|
|
|
|
$('.btnCast', header).hide();
|
2015-06-01 22:46:06 -07:00
|
|
|
|
$('.headerVoiceButton', header).hide();
|
2015-05-22 08:59:17 -07:00
|
|
|
|
$('.headerSearchButton', header).hide();
|
|
|
|
|
}
|
2015-05-13 22:42:55 -07:00
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
if (user.canManageServer) {
|
|
|
|
|
$('.dashboardEntryHeaderButton', header).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.dashboardEntryHeaderButton', header).hide();
|
2014-10-25 11:32:58 -07:00
|
|
|
|
}
|
2015-04-25 20:25:07 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bindMenuEvents() {
|
2014-05-29 12:34:20 -07:00
|
|
|
|
|
2015-05-06 20:11:51 -07:00
|
|
|
|
if (AppInfo.isTouchPreferred) {
|
2015-04-25 20:25:07 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
$('.libraryMenuButton').on('click', showLibraryMenu);
|
|
|
|
|
$('.dashboardMenuButton').on('click', showDashboardMenu);
|
2015-04-25 20:25:07 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
$('.libraryMenuButton').createHoverTouch().on('hovertouch', showLibraryMenu);
|
|
|
|
|
$('.dashboardMenuButton').createHoverTouch().on('hovertouch', showDashboardMenu);
|
|
|
|
|
}
|
2015-05-04 07:35:38 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
// Have to wait for document ready here because otherwise
|
|
|
|
|
// we may see the jQM redirect back and forth problem
|
|
|
|
|
$(initViewMenuBarHeadroom);
|
2015-06-03 21:50:10 -07:00
|
|
|
|
|
|
|
|
|
//$('.headerButtonViewMenu').off('click', onViewButtonClick).on('click', onViewButtonClick);
|
2015-05-25 10:32:22 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-03 21:50:10 -07:00
|
|
|
|
//function onViewButtonClick() {
|
|
|
|
|
|
|
|
|
|
// var html = '<div class="appViewMenuPanel" data-role="panel" data-position="right" data-display="overlay" data-position-fixed="true" data-theme="a">';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// html += '</div>';
|
|
|
|
|
|
|
|
|
|
// $(document.body).append(html);
|
|
|
|
|
|
|
|
|
|
// var elem = $('.appViewMenuPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
|
|
|
|
|
|
|
|
|
|
// $(this).off("panelclose").remove();
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
function initViewMenuBarHeadroom() {
|
|
|
|
|
|
2015-05-04 07:35:38 -07:00
|
|
|
|
// grab an element
|
|
|
|
|
var viewMenuBar = document.getElementsByClassName("viewMenuBar")[0];
|
2015-05-06 20:11:51 -07:00
|
|
|
|
initHeadRoom(viewMenuBar);
|
2013-12-27 14:10:06 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-07 15:27:01 -07:00
|
|
|
|
function updateViewMenuBarHeadroom(page, viewMenuBar) {
|
2015-05-08 09:58:27 -07:00
|
|
|
|
|
2015-05-07 15:27:01 -07:00
|
|
|
|
if ($(page).hasClass('libraryPage')) {
|
|
|
|
|
viewMenuBar.removeClass('headroomDisabled');
|
|
|
|
|
} else {
|
|
|
|
|
viewMenuBar.addClass('headroomDisabled');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-05 09:51:39 -07:00
|
|
|
|
function getItemHref(item, context) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-07-05 09:51:39 -07:00
|
|
|
|
return LibraryBrowser.getHref(item, context);
|
2014-05-01 19:54:33 -07:00
|
|
|
|
}
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
function getViewsHtml() {
|
2014-05-10 22:11:53 -07:00
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
html += '<div class="libraryMenuOptions">';
|
|
|
|
|
html += '</div>';
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
html += '<div class="sidebarDivider"></div>';
|
2014-12-30 23:24:49 -07:00
|
|
|
|
html += '<div class="adminMenuOptions">';
|
2014-12-30 12:16:01 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '<div class="sidebarHeader">';
|
|
|
|
|
html += Globalize.translate('HeaderAdmin');
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2015-06-04 13:27:46 -07:00
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="dashboard" href="dashboard.html"><span class="fa fa-server sidebarLinkIcon"></span>' + Globalize.translate('ButtonManageServer') + '</a>';
|
2015-01-23 21:50:45 -07:00
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder editorViewMenu" data-itemid="editor" href="edititemmetadata.html"><span class="fa fa-edit sidebarLinkIcon"></span>' + Globalize.translate('ButtonMetadataManager') + '</a>';
|
2015-06-04 13:27:46 -07:00
|
|
|
|
|
|
|
|
|
if (!$.browser.mobile && !AppInfo.isTouchPreferred) {
|
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="reports" href="reports.html"><span class="fa fa-bar-chart sidebarLinkIcon"></span>' + Globalize.translate('ButtonReports') + '</a>';
|
|
|
|
|
}
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
html += '<div class="sidebarDivider"></div>';
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '<div class="userMenuOptions">';
|
|
|
|
|
|
|
|
|
|
if (Dashboard.isConnectMode()) {
|
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="selectserver" href="selectserver.html"><span class="fa fa-globe sidebarLinkIcon"></span>' + Globalize.translate('ButtonSelectServer') + '</a>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="logout" href="#" onclick="Dashboard.logout();"><span class="fa fa-sign-out sidebarLinkIcon"></span>' + Globalize.translate('ButtonSignOut') + '</a>';
|
2014-05-14 13:20:19 -07:00
|
|
|
|
html += '</div>';
|
2015-05-29 16:51:33 -07:00
|
|
|
|
|
2014-05-03 16:38:23 -07:00
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2014-03-18 10:05:57 -07:00
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
function showLibraryMenu() {
|
2014-03-13 02:00:47 -07:00
|
|
|
|
|
2014-06-21 22:52:31 -07:00
|
|
|
|
var page = $.mobile.activePage;
|
|
|
|
|
var panel;
|
|
|
|
|
|
2015-05-18 15:23:03 -07:00
|
|
|
|
ConnectionManager.user(window.ApiClient).done(function (user) {
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2015-04-27 10:55:57 -07:00
|
|
|
|
panel = getLibraryMenu(user);
|
|
|
|
|
updateLibraryNavLinks(page);
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
panel = $(panel).panel('toggle').off('mouseleave.librarymenu');
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
if (!AppInfo.isTouchPreferred) {
|
|
|
|
|
panel.on('mouseleave.librarymenu', function () {
|
2015-04-27 10:55:57 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
$(this).panel("close");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-06-21 22:52:31 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showDashboardMenu() {
|
2014-05-17 14:23:48 -07:00
|
|
|
|
|
2014-06-21 22:52:31 -07:00
|
|
|
|
var page = $.mobile.activePage;
|
|
|
|
|
var panel = getDashboardMenu(page);
|
2014-05-17 14:23:48 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
panel = $(panel).panel('toggle').off('mouseleave.librarymenu');
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
if (!AppInfo.isTouchPreferred) {
|
|
|
|
|
panel.on('mouseleave.librarymenu', function () {
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
$(this).panel("close");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-17 14:23:48 -07:00
|
|
|
|
}
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
2014-05-17 14:23:48 -07:00
|
|
|
|
function updateLibraryMenu(panel) {
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2015-05-18 15:23:03 -07:00
|
|
|
|
var apiClient = window.ApiClient;
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
|
|
|
|
if (!apiClient) {
|
|
|
|
|
|
|
|
|
|
$('.adminMenuOptions').hide();
|
2014-12-30 23:24:49 -07:00
|
|
|
|
$('.syncViewMenu').hide();
|
2015-05-29 16:51:33 -07:00
|
|
|
|
$('.userMenuOptions').hide();
|
2014-10-25 11:32:58 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
var userId = Dashboard.getCurrentUserId();
|
2014-05-03 16:38:23 -07:00
|
|
|
|
|
2014-10-25 11:32:58 -07:00
|
|
|
|
apiClient.getUserViews(userId).done(function (result) {
|
2014-05-14 13:20:19 -07:00
|
|
|
|
|
|
|
|
|
var items = result.Items;
|
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
var html = '';
|
|
|
|
|
html += '<div class="sidebarHeader">';
|
2015-05-31 11:22:51 -07:00
|
|
|
|
html += Globalize.translate('HeaderMedia');
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += items.map(function (i) {
|
2014-05-14 13:20:19 -07:00
|
|
|
|
|
2014-12-30 12:16:01 -07:00
|
|
|
|
var iconCssClass = 'fa';
|
2014-05-14 13:20:19 -07:00
|
|
|
|
|
2014-06-07 12:46:24 -07:00
|
|
|
|
var itemId = i.Id;
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2014-06-07 12:46:24 -07:00
|
|
|
|
if (i.CollectionType == "channels") {
|
|
|
|
|
itemId = "channels";
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "livetv") {
|
|
|
|
|
itemId = "livetv";
|
|
|
|
|
}
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
2014-06-30 19:29:27 -07:00
|
|
|
|
if (i.Type == 'Channel') {
|
|
|
|
|
}
|
2014-06-07 12:46:24 -07:00
|
|
|
|
|
2014-12-30 12:16:01 -07:00
|
|
|
|
if (i.CollectionType == "photos") {
|
|
|
|
|
iconCssClass += ' fa-photo';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "music" || i.CollectionType == "musicvideos") {
|
|
|
|
|
iconCssClass += ' fa-music';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "books") {
|
|
|
|
|
iconCssClass += ' fa-book';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "playlists") {
|
|
|
|
|
iconCssClass += ' fa-list';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "games") {
|
|
|
|
|
iconCssClass += ' fa-gamepad';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "movies") {
|
|
|
|
|
iconCssClass += ' fa-film';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "channels" || i.Type == 'Channel') {
|
|
|
|
|
iconCssClass += ' fa-globe';
|
|
|
|
|
}
|
|
|
|
|
else if (i.CollectionType == "tvshows" || i.CollectionType == "livetv") {
|
|
|
|
|
iconCssClass += ' fa-video-camera';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
iconCssClass += ' fa-folder-open-o';
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-23 21:50:45 -07:00
|
|
|
|
return '<a data-itemid="' + itemId + '" class="lnkMediaFolder sidebarLink" href="' + getItemHref(i, i.CollectionType) + '"><span class="' + iconCssClass + ' sidebarLinkIcon"></span><span class="sectionName">' + i.Name + '</span></a>';
|
2014-05-14 13:20:19 -07:00
|
|
|
|
|
|
|
|
|
}).join('');
|
|
|
|
|
|
2014-05-21 20:35:18 -07:00
|
|
|
|
var elem = $('.libraryMenuOptions').html(html);
|
|
|
|
|
|
2015-01-23 21:50:45 -07:00
|
|
|
|
$('.sidebarLink', elem).on('click', function () {
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
2014-12-30 12:16:01 -07:00
|
|
|
|
var section = $('.sectionName', this)[0];
|
|
|
|
|
var text = section ? section.innerHTML : this.innerHTML;
|
|
|
|
|
|
|
|
|
|
$('.libraryMenuButtonText').html(text);
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
|
|
|
|
});
|
2014-05-14 13:20:19 -07:00
|
|
|
|
});
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-05-14 13:20:19 -07:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-12-19 23:06:27 -07:00
|
|
|
|
if (user.Policy.IsAdministrator) {
|
2014-05-14 13:20:19 -07:00
|
|
|
|
$('.adminMenuOptions').show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.adminMenuOptions').hide();
|
|
|
|
|
}
|
2015-01-17 22:45:10 -07:00
|
|
|
|
|
2014-12-30 23:24:49 -07:00
|
|
|
|
if (user.Policy.EnableSync) {
|
|
|
|
|
$('.syncViewMenu').show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.syncViewMenu').hide();
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 22:52:31 -07:00
|
|
|
|
var requiresLibraryMenuRefresh = false;
|
2015-05-20 09:28:55 -07:00
|
|
|
|
var requiresViewMenuRefresh = false;
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2014-10-25 11:32:58 -07:00
|
|
|
|
function getLibraryMenu(user) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-05-12 11:04:25 -07:00
|
|
|
|
var panel = $('#libraryPanel');
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
|
|
|
|
if (!panel.length) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
html += '<div data-role="panel" id="libraryPanel" class="libraryPanel" data-position="left" data-display="overlay" data-position-fixed="true" data-theme="b">';
|
|
|
|
|
|
2015-04-27 10:55:57 -07:00
|
|
|
|
html += '<div class="sidebarLinks librarySidebarLinks">';
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
var userHref = user.localUser && user.localUser.Policy.EnableUserPreferenceAccess ?
|
|
|
|
|
'mypreferencesdisplay.html?userId=' + user.localUser.Id :
|
|
|
|
|
(user.localUser ? 'index.html' : '#');
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
var hasUserImage = user.imageUrl && AppInfo.enableUserImage;
|
|
|
|
|
var paddingLeft = hasUserImage ? 'padding-left:.7em;' : '';
|
|
|
|
|
html += '<a style="margin-top:0;' + paddingLeft + 'display:block;color:#fff;text-decoration:none;font-size:16px;font-weight:400!important;background: #111;" href="' + userHref + '">';
|
2015-04-27 10:55:57 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
var imgWidth = 44;
|
2015-04-27 10:55:57 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
if (hasUserImage) {
|
|
|
|
|
var url = user.imageUrl;
|
2015-05-02 09:34:27 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
if (user.supportsImageParams) {
|
|
|
|
|
url += "&width=" + (imgWidth * Math.max(devicePixelRatio || 1, 2));
|
2015-05-02 09:34:27 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '<div class="lazy" data-src="' + url + '" style="width:' + imgWidth + 'px;height:' + imgWidth + 'px;background-size:contain;background-repeat:no-repeat;background-position:center center;border-radius:1000px;vertical-align:middle;margin-right:.8em;display:inline-block;"></div>';
|
|
|
|
|
} else {
|
|
|
|
|
html += '<span class="fa fa-user sidebarLinkIcon"></span>';
|
2015-05-02 09:34:27 -07:00
|
|
|
|
}
|
2015-04-27 10:55:57 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += user.name;
|
|
|
|
|
html += '</a>';
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
html += '<div class="sidebarDivider" style="margin-top:0;"></div>';
|
2015-05-02 16:08:02 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
var homeHref = window.ApiClient ? 'index.html' : 'selectserver.html';
|
2015-04-29 10:39:23 -07:00
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '<a class="lnkMediaFolder sidebarLink" href="' + homeHref + '"><span class="fa fa-home sidebarLinkIcon"></span><span>' + Globalize.translate('ButtonHome') + '</span></a>';
|
2015-04-29 10:39:23 -07:00
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="inbox" href="notificationlist.html"><span class="fa fa-inbox sidebarLinkIcon"></span>';
|
|
|
|
|
html += Globalize.translate('ButtonInbox');
|
|
|
|
|
html += '<div class="btnNotifications"><div class="btnNotificationsInner">0</div></div>';
|
|
|
|
|
html += '</a>';
|
|
|
|
|
|
2015-05-29 16:51:33 -07:00
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="remote" href="nowplaying.html"><span class="fa fa-tablet sidebarLinkIcon"></span>' + Globalize.translate('ButtonRemote') + '</a>';
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
2015-06-01 22:46:06 -07:00
|
|
|
|
html += '<a class="sidebarLink lnkMediaFolder syncViewMenu" data-itemid="mysync" href="mysync.html"><span class="fa fa-refresh sidebarLinkIcon"></span>' + Globalize.translate('ButtonSync') + '</a>';
|
2015-05-08 12:10:53 -07:00
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
html += '<div class="sidebarDivider"></div>';
|
2015-05-08 12:10:53 -07:00
|
|
|
|
|
2014-06-10 10:36:06 -07:00
|
|
|
|
html += getViewsHtml();
|
2014-05-09 12:43:06 -07:00
|
|
|
|
html += '</div>';
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
2015-05-31 14:07:44 -07:00
|
|
|
|
$(document.body).append(html).trigger('libraryMenuCreated');
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-09 21:29:04 -07:00
|
|
|
|
panel = $('#libraryPanel').panel({}).lazyChildren().trigger('create');
|
2014-05-17 14:23:48 -07:00
|
|
|
|
|
|
|
|
|
updateLibraryMenu();
|
2013-12-27 14:10:06 -07:00
|
|
|
|
}
|
2014-06-21 22:52:31 -07:00
|
|
|
|
else if (requiresLibraryMenuRefresh) {
|
|
|
|
|
updateLibraryMenu();
|
|
|
|
|
requiresLibraryMenuRefresh = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return panel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDashboardMenu(page) {
|
|
|
|
|
|
|
|
|
|
var panel = $('#dashboardPanel', page);
|
|
|
|
|
|
|
|
|
|
if (!panel.length) {
|
|
|
|
|
|
|
|
|
|
var html = '';
|
|
|
|
|
|
|
|
|
|
html += '<div data-role="panel" id="dashboardPanel" class="dashboardPanel" data-position="left" data-display="overlay" data-position-fixed="true" data-theme="b">';
|
|
|
|
|
|
|
|
|
|
html += '<div style="margin: 0 -1em;">';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
$(document.body).append(html);
|
|
|
|
|
panel = $('#dashboardPanel').panel({}).trigger('create');
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
|
|
|
|
return panel;
|
|
|
|
|
}
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2014-05-23 18:16:53 -07:00
|
|
|
|
function setLibraryMenuText(text) {
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2014-05-23 18:16:53 -07:00
|
|
|
|
$('.libraryMenuButtonText').html('<span>' + text + '</span>');
|
|
|
|
|
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
function getTopParentId() {
|
|
|
|
|
|
2015-05-20 10:29:26 -07:00
|
|
|
|
return getParameterByName('topParentId') || null;
|
2014-05-01 19:54:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-13 02:00:47 -07:00
|
|
|
|
window.LibraryMenu = {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
showLibraryMenu: showLibraryMenu,
|
|
|
|
|
|
2014-05-23 18:16:53 -07:00
|
|
|
|
getTopParentId: getTopParentId,
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
2014-05-23 18:16:53 -07:00
|
|
|
|
setText: setLibraryMenuText
|
2014-03-13 02:00:47 -07:00
|
|
|
|
};
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-03-29 11:20:42 -07:00
|
|
|
|
function updateCastIcon() {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-03-29 11:20:42 -07:00
|
|
|
|
var info = MediaController.getPlayerInfo();
|
|
|
|
|
|
|
|
|
|
if (info.isLocalPlayer) {
|
|
|
|
|
|
|
|
|
|
$('.btnCast').addClass('btnDefaultCast').removeClass('btnActiveCast');
|
2014-06-21 22:52:31 -07:00
|
|
|
|
$('.headerSelectedPlayer').html('');
|
2014-03-29 11:20:42 -07:00
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
$('.btnCast').removeClass('btnDefaultCast').addClass('btnActiveCast');
|
2014-08-16 22:38:13 -07:00
|
|
|
|
|
|
|
|
|
$('.headerSelectedPlayer').html((info.deviceName || info.name));
|
2014-03-29 11:20:42 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2014-05-12 11:04:25 -07:00
|
|
|
|
function updateLibraryNavLinks(page) {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
|
|
|
|
page = $(page);
|
|
|
|
|
|
|
|
|
|
var isLiveTvPage = page.hasClass('liveTvPage');
|
2014-05-02 21:20:04 -07:00
|
|
|
|
var isChannelsPage = page.hasClass('channelsPage');
|
2014-05-12 11:04:25 -07:00
|
|
|
|
var isEditorPage = page.hasClass('metadataEditorPage');
|
|
|
|
|
var isReportsPage = page.hasClass('reportsPage');
|
2014-12-30 23:24:49 -07:00
|
|
|
|
var isMySyncPage = page.hasClass('mySyncPage');
|
2014-05-03 16:38:23 -07:00
|
|
|
|
|
2014-12-30 23:24:49 -07:00
|
|
|
|
var id = isLiveTvPage || isChannelsPage || isEditorPage || isReportsPage || isMySyncPage || page.hasClass('allLibraryPage') ?
|
2014-05-01 19:54:33 -07:00
|
|
|
|
'' :
|
|
|
|
|
getTopParentId() || '';
|
|
|
|
|
|
2014-05-09 12:43:06 -07:00
|
|
|
|
$('.lnkMediaFolder').each(function () {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
|
|
|
|
var itemId = this.getAttribute('data-itemid');
|
|
|
|
|
|
2014-05-02 21:20:04 -07:00
|
|
|
|
if (isChannelsPage && itemId == 'channels') {
|
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
|
|
|
|
else if (isLiveTvPage && itemId == 'livetv') {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
2014-05-12 11:04:25 -07:00
|
|
|
|
else if (isEditorPage && itemId == 'editor') {
|
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
|
|
|
|
else if (isReportsPage && itemId == 'reports') {
|
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
2014-12-30 23:24:49 -07:00
|
|
|
|
else if (isMySyncPage && itemId == 'mysync') {
|
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
2014-05-01 19:54:33 -07:00
|
|
|
|
else if (id && itemId == id) {
|
|
|
|
|
$(this).addClass('selectedMediaFolder');
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$(this).removeClass('selectedMediaFolder');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2014-08-02 19:16:37 -07:00
|
|
|
|
var context = getParameterByName('context');
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-08-02 19:16:37 -07:00
|
|
|
|
if (context !== 'playlists') {
|
|
|
|
|
$('.scopedLibraryViewNav a', page).each(function () {
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-08-02 19:16:37 -07:00
|
|
|
|
var src = this.href;
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-08-02 19:16:37 -07:00
|
|
|
|
if (src.indexOf('#') != -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2014-08-02 19:16:37 -07:00
|
|
|
|
src = replaceQueryString(src, 'topParentId', id);
|
|
|
|
|
|
|
|
|
|
this.href = src;
|
|
|
|
|
});
|
|
|
|
|
}
|
2014-05-01 19:54:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-21 20:35:18 -07:00
|
|
|
|
function updateContextText(page) {
|
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
var jPage = $(page);
|
|
|
|
|
|
|
|
|
|
var name = jPage.attr('data-contextname');
|
2014-05-21 20:35:18 -07:00
|
|
|
|
|
|
|
|
|
if (name) {
|
|
|
|
|
|
|
|
|
|
$('.libraryMenuButtonText').html('<span>' + name + '</span>');
|
|
|
|
|
|
|
|
|
|
}
|
2015-05-25 10:32:22 -07:00
|
|
|
|
else if (jPage.hasClass('allLibraryPage') || jPage.hasClass('type-interior')) {
|
2015-03-21 11:12:12 -07:00
|
|
|
|
$('.libraryMenuButtonText').html('<span class="logoLibraryMenuButtonText">EMBY</span>');
|
2014-05-21 20:35:18 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-21 22:52:31 -07:00
|
|
|
|
function onWebSocketMessage(e, data) {
|
|
|
|
|
|
|
|
|
|
var msg = data;
|
|
|
|
|
|
|
|
|
|
if (msg.MessageType === "UserConfigurationUpdated") {
|
|
|
|
|
|
|
|
|
|
if (msg.Data.Id == Dashboard.getCurrentUserId()) {
|
|
|
|
|
|
|
|
|
|
requiresLibraryMenuRefresh = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
function buildViewMenuBar(page) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
if ($(page).hasClass('standalonePage')) {
|
2015-05-25 10:32:22 -07:00
|
|
|
|
$('.viewMenuBar').hide();
|
2015-05-20 09:28:55 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
if (requiresViewMenuRefresh) {
|
|
|
|
|
$('.viewMenuBar').remove();
|
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
var viewMenuBar = $('.viewMenuBar').show();
|
2014-05-21 20:35:18 -07:00
|
|
|
|
if (!$('.viewMenuBar').length) {
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
renderHeader();
|
|
|
|
|
updateViewMenuBarHeadroom(page, $('.viewMenuBar'));
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
updateCastIcon();
|
2014-05-01 19:54:33 -07:00
|
|
|
|
|
2015-05-22 08:59:17 -07:00
|
|
|
|
updateLibraryNavLinks(page);
|
|
|
|
|
updateContextText(page);
|
|
|
|
|
requiresViewMenuRefresh = false;
|
|
|
|
|
|
|
|
|
|
ConnectionManager.user(window.ApiClient).done(addUserToHeader);
|
2014-05-14 11:04:26 -07:00
|
|
|
|
|
2014-05-21 20:35:18 -07:00
|
|
|
|
} else {
|
|
|
|
|
updateContextText(page);
|
|
|
|
|
updateLibraryNavLinks(page);
|
2015-05-07 15:27:01 -07:00
|
|
|
|
updateViewMenuBarHeadroom(page, viewMenuBar);
|
2015-05-20 09:28:55 -07:00
|
|
|
|
requiresViewMenuRefresh = false;
|
2014-05-01 19:54:33 -07:00
|
|
|
|
}
|
2015-05-20 09:28:55 -07:00
|
|
|
|
}
|
2014-10-25 11:32:58 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
// The first time we create the view menu bar, wait until doc ready + login validated
|
|
|
|
|
// Otherwise we run into the jQM redirect back and forth problem
|
|
|
|
|
var updateViewMenuBarBeforePageShow = false;
|
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
$(document).on('pageinit', ".page", function () {
|
2014-06-21 22:52:31 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
$(function () {
|
|
|
|
|
onPageInitDocumentReady(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).on('pagebeforeshowready', ".page", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
if (updateViewMenuBarBeforePageShow) {
|
|
|
|
|
onPageBeforeShowDocumentReady(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}).one('pageshowready', ".page", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
|
onPageBeforeShowDocumentReady(page);
|
|
|
|
|
updateViewMenuBarBeforePageShow = true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).on('pageshowready', ".page", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
onPageShowDocumentReady(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function onPageInitDocumentReady(page) {
|
2015-05-20 09:28:55 -07:00
|
|
|
|
$('.libraryViewNav', page).wrapInner('<div class="libraryViewNavInner"></div>');
|
|
|
|
|
|
|
|
|
|
$('.libraryViewNav a', page).each(function () {
|
|
|
|
|
|
|
|
|
|
this.innerHTML = '<span class="libraryViewNavLinkContent">' + this.innerHTML + '</span>';
|
|
|
|
|
});
|
2015-05-25 10:32:22 -07:00
|
|
|
|
}
|
2015-05-20 09:28:55 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
function onPageBeforeShowDocumentReady(page) {
|
2014-05-23 07:09:58 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
buildViewMenuBar(page);
|
2014-05-23 07:09:58 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
var jpage = $(page);
|
2015-05-08 20:48:43 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
var isLibraryPage = jpage.hasClass('libraryPage');
|
2015-05-08 20:48:43 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
if (isLibraryPage) {
|
|
|
|
|
$(document.body).addClass('libraryDocument').removeClass('dashboardDocument');
|
2015-05-08 20:48:43 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
if (AppInfo.enableBottomTabs) {
|
|
|
|
|
$(page).addClass('noSecondaryNavPage');
|
2015-05-08 09:58:27 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
$(function () {
|
2015-05-07 15:27:01 -07:00
|
|
|
|
|
2015-05-20 09:28:55 -07:00
|
|
|
|
$('.footer').addClass('footerOverBottomTabs');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
$('.libraryViewNav', page).each(function () {
|
|
|
|
|
|
|
|
|
|
initHeadRoom(this);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (jpage.hasClass('type-interior')) {
|
|
|
|
|
$(document.body).addClass('dashboardDocument').removeClass('libraryDocument');
|
|
|
|
|
} else {
|
|
|
|
|
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
2014-05-23 07:09:58 -07:00
|
|
|
|
}
|
2015-05-25 10:32:22 -07:00
|
|
|
|
}
|
2014-05-23 07:09:58 -07:00
|
|
|
|
|
2015-05-25 10:32:22 -07:00
|
|
|
|
function onPageShowDocumentReady(page) {
|
2014-03-14 21:14:07 -07:00
|
|
|
|
var elem = $('.libraryViewNavInner .ui-btn-active:visible', page);
|
|
|
|
|
|
|
|
|
|
if (elem.length) {
|
|
|
|
|
elem[0].scrollIntoView();
|
2014-03-16 09:15:10 -07:00
|
|
|
|
|
|
|
|
|
// Scroll back up so in case vertical scroll was messed with
|
|
|
|
|
$(document).scrollTop(0);
|
2014-03-14 21:14:07 -07:00
|
|
|
|
}
|
2015-05-25 10:32:22 -07:00
|
|
|
|
}
|
2013-12-27 14:10:06 -07:00
|
|
|
|
|
2015-05-06 20:11:51 -07:00
|
|
|
|
function initHeadRoom(elem) {
|
|
|
|
|
|
|
|
|
|
if (!AppInfo.enableHeadRoom) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-08 20:48:43 -07:00
|
|
|
|
requirejs(["thirdparty/headroom"], function () {
|
|
|
|
|
|
|
|
|
|
// construct an instance of Headroom, passing the element
|
|
|
|
|
var headroom = new Headroom(elem);
|
|
|
|
|
// initialise
|
|
|
|
|
headroom.init();
|
|
|
|
|
});
|
2015-05-06 20:11:51 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-25 11:32:58 -07:00
|
|
|
|
function initializeApiClient(apiClient) {
|
2014-10-30 21:57:24 -07:00
|
|
|
|
|
2015-05-19 12:15:40 -07:00
|
|
|
|
requiresLibraryMenuRefresh = true;
|
2014-10-25 11:32:58 -07:00
|
|
|
|
$(apiClient).off('websocketmessage.librarymenu', onWebSocketMessage).on('websocketmessage.librarymenu', onWebSocketMessage);
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-19 12:15:40 -07:00
|
|
|
|
Dashboard.ready(function () {
|
2015-05-18 15:23:03 -07:00
|
|
|
|
|
2015-05-19 12:15:40 -07:00
|
|
|
|
if (window.ApiClient) {
|
|
|
|
|
initializeApiClient(window.ApiClient);
|
|
|
|
|
}
|
2015-05-18 18:46:31 -07:00
|
|
|
|
|
2015-05-19 12:15:40 -07:00
|
|
|
|
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
|
|
|
|
initializeApiClient(apiClient);
|
2015-05-18 18:46:31 -07:00
|
|
|
|
|
2015-05-19 12:15:40 -07:00
|
|
|
|
}).on('localusersignedin localusersignedout', function () {
|
|
|
|
|
requiresLibraryMenuRefresh = true;
|
2015-05-20 09:28:55 -07:00
|
|
|
|
requiresViewMenuRefresh = true;
|
2015-05-19 12:15:40 -07:00
|
|
|
|
});
|
2014-10-30 21:57:24 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-05-01 19:54:33 -07:00
|
|
|
|
$(function () {
|
|
|
|
|
|
2014-03-29 09:58:49 -07:00
|
|
|
|
$(MediaController).on('playerchange', function () {
|
2014-03-29 11:20:42 -07:00
|
|
|
|
updateCastIcon();
|
2014-03-29 09:58:49 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-05-06 20:11:51 -07:00
|
|
|
|
})(window, document, jQuery, window.devicePixelRatio);
|
2014-06-03 20:34:36 -07:00
|
|
|
|
|
|
|
|
|
$.fn.createHoverTouch = function () {
|
|
|
|
|
|
|
|
|
|
var preventHover = false;
|
|
|
|
|
var timerId;
|
|
|
|
|
|
|
|
|
|
function startTimer(elem) {
|
|
|
|
|
|
|
|
|
|
stopTimer();
|
|
|
|
|
|
|
|
|
|
timerId = setTimeout(function () {
|
|
|
|
|
|
|
|
|
|
$(elem).trigger('hovertouch');
|
2014-06-07 14:06:01 -07:00
|
|
|
|
}, 300);
|
2014-06-03 20:34:36 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function stopTimer(elem) {
|
|
|
|
|
|
|
|
|
|
if (timerId) {
|
|
|
|
|
clearTimeout(timerId);
|
|
|
|
|
timerId = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $(this).on('mouseenter', function () {
|
|
|
|
|
|
|
|
|
|
if (preventHover === true) {
|
2014-06-07 12:46:24 -07:00
|
|
|
|
preventHover = false;
|
2014-06-03 20:34:36 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startTimer(this);
|
|
|
|
|
|
|
|
|
|
}).on('mouseleave', function () {
|
|
|
|
|
|
|
|
|
|
stopTimer(this);
|
|
|
|
|
|
|
|
|
|
}).on('touchstart', function () {
|
|
|
|
|
|
|
|
|
|
preventHover = true;
|
|
|
|
|
|
|
|
|
|
}).on('click', function () {
|
|
|
|
|
|
|
|
|
|
preventHover = true;
|
|
|
|
|
|
|
|
|
|
if (preventHover) {
|
|
|
|
|
$(this).trigger('hovertouch');
|
2014-06-24 14:45:21 -07:00
|
|
|
|
stopTimer(this);
|
|
|
|
|
preventHover = false;
|
2014-06-03 20:34:36 -07:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
};
|