';
html += '
';
html += '';
html += '
';
html += '';
html += '
';
html += ' ';
html += '(function (window, document, $, devicePixelRatio) { function renderHeader() { var html = '
'; $(document.body).append(html); ImageLoader.lazyChildren(document.querySelector('.viewMenuBar')); Events.trigger(document, 'headercreated'); bindMenuEvents(); } function onBackClick() { if (Dashboard.exitOnBack()) { Dashboard.exit(); } else { history.back(); } } function addUserToHeader(user) { var header = document.querySelector('.viewMenuBar'); if (user.localUser) { $('.btnCast', header).visible(true); document.querySelector('.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'); document.querySelector('.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) { var userButtonHeight = 26; var url = user.imageUrl; if (user.supportsImageParams) { url += "&height=" + (userButtonHeight * Math.max(devicePixelRatio || 1, 2)); } var headerUserButton = header.querySelector('.headerUserButton'); if (headerUserButton) { headerUserButton.icon = null; headerUserButton.src = url; headerUserButton.classList.add('headerUserButtonRound'); } } } } function bindMenuEvents() { if (AppInfo.isTouchPreferred) { $('.mainDrawerButton').on('touchend', openMainDrawer).on('click', openMainDrawer); } else { $('.mainDrawerButton').createHoverTouch().on('hovertouch', openMainDrawer); } $('.headerBackButton').on('click', onBackClick); var viewMenuBar = document.getElementsByClassName("viewMenuBar")[0]; 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); } var requiresDrawerRefresh = true; var requiresDashboardDrawerRefresh = true; var lastOpenTime = new Date().getTime(); function openMainDrawer() { var drawerPanel = document.querySelector('.mainDrawerPanel'); drawerPanel.openDrawer(); lastOpenTime = new Date().getTime(); } function onMainDrawerOpened() { if ($.browser.mobile) { document.body.classList.add('bodyWithPopupOpen'); } var drawer = document.querySelector('.mainDrawerPanel .mainDrawer'); ConnectionManager.user(window.ApiClient).done(function (user) { if (requiresDrawerRefresh) { ensureDrawerStructure(drawer); refreshUserInfoInDrawer(user, drawer); refreshLibraryInfoInDrawer(user, drawer); refreshBottomUserInfoInDrawer(user, drawer); Events.trigger(document, 'libraryMenuCreated'); updateLibraryMenu(user.localUser); } var pageElem = $($.mobile.activePage)[0]; if (requiresDrawerRefresh || requiresDashboardDrawerRefresh) { refreshDashboardInfoInDrawer(pageElem, user, drawer); requiresDashboardDrawerRefresh = false; } requiresDrawerRefresh = false; updateLibraryNavLinks(pageElem); }); 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 ensureDrawerStructure(drawer) { if (drawer.querySelector('.mainDrawerContent')) { return; } var html = '