mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add object assign polyfill
This commit is contained in:
parent
74505accb3
commit
bd8391a61c
13 changed files with 145 additions and 103 deletions
|
@ -1,4 +1,4 @@
|
|||
<div id="indexPage" style="outline: none;" data-role="page" data-dom-cache="true" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-title="${ButtonHome}" data-backdroptype="movie,series,game,book" data-require="scripts/indexpage,paper-tabs,neon-animated-pages">
|
||||
<div id="indexPage" style="outline: none;" data-role="page" data-dom-cache="true" class="page homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs" data-title="${ButtonHome}" data-backdroptype="movie,series,game,book">
|
||||
|
||||
<div class="libraryViewNav libraryViewNavWithMinHeight hide">
|
||||
<paper-tabs hidescrollbuttons noink>
|
||||
|
|
23
dashboard-ui/legacy/objectassign.js
Normal file
23
dashboard-ui/legacy/objectassign.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
if (typeof Object.assign != 'function') {
|
||||
(function () {
|
||||
Object.assign = function (target) {
|
||||
'use strict';
|
||||
if (target === undefined || target === null) {
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var output = Object(target);
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var source = arguments[index];
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
if (source.hasOwnProperty(nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
};
|
||||
})();
|
||||
}
|
|
@ -343,7 +343,7 @@
|
|||
receiverName = castPlayer.session.receiver.friendlyName;
|
||||
}
|
||||
|
||||
message = $.extend(message, {
|
||||
message = Object.assign(message, {
|
||||
userId: Dashboard.getCurrentUserId(),
|
||||
deviceId: ApiClient.deviceId(),
|
||||
accessToken: ApiClient.accessToken(),
|
||||
|
|
|
@ -272,47 +272,10 @@
|
|||
});
|
||||
}
|
||||
|
||||
pageIdOn('pageinit', "indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var tabs = page.querySelector('paper-tabs');
|
||||
var pages = page.querySelector('neon-animated-pages');
|
||||
|
||||
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'home.html');
|
||||
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(page, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
page.querySelector('.btnTakeTour').addEventListener('click', function () {
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
if (AppInfo.enableHomeTabs) {
|
||||
page.classList.remove('noSecondaryNavPage');
|
||||
page.querySelector('.libraryViewNav').classList.remove('hide');
|
||||
} else {
|
||||
page.classList.add('noSecondaryNavPage');
|
||||
page.querySelector('.libraryViewNav').classList.add('hide');
|
||||
}
|
||||
});
|
||||
|
||||
pageIdOn('pageshow', "indexPage", function () {
|
||||
var page = this;
|
||||
Events.on(MediaController, 'playbackstop', onPlaybackStop);
|
||||
});
|
||||
|
||||
pageIdOn('pagebeforehide', "indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
Events.off(MediaController, 'playbackstop', onPlaybackStop);
|
||||
});
|
||||
|
||||
function onPlaybackStop(e, state) {
|
||||
|
||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
|
||||
var page = $($.mobile.activePage)[0];
|
||||
var page = $.mobile.activePage;
|
||||
var pages = page.querySelector('neon-animated-pages');
|
||||
|
||||
pages.dispatchEvent(new CustomEvent("tabchange", {}));
|
||||
|
@ -328,4 +291,36 @@
|
|||
renderHomeTab: loadHomeTab
|
||||
};
|
||||
|
||||
return function (view, params) {
|
||||
|
||||
var self = this;
|
||||
|
||||
var pages = view.querySelector('neon-animated-pages');
|
||||
|
||||
LibraryBrowser.configurePaperLibraryTabs(view, view.querySelector('paper-tabs'), pages, 'home.html');
|
||||
|
||||
pages.addEventListener('tabchange', function (e) {
|
||||
loadTab(view, parseInt(e.target.selected));
|
||||
});
|
||||
|
||||
view.querySelector('.btnTakeTour').addEventListener('click', function () {
|
||||
takeTour(view, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
if (AppInfo.enableHomeTabs) {
|
||||
view.classList.remove('noSecondaryNavPage');
|
||||
view.querySelector('.libraryViewNav').classList.remove('hide');
|
||||
} else {
|
||||
view.classList.add('noSecondaryNavPage');
|
||||
view.querySelector('.libraryViewNav').classList.add('hide');
|
||||
}
|
||||
|
||||
view.addEventListener('viewshow', function (e) {
|
||||
Events.on(MediaController, 'playbackstop', onPlaybackStop);
|
||||
});
|
||||
|
||||
view.addEventListener('viewbeforehide', function (e) {
|
||||
Events.off(MediaController, 'playbackstop', onPlaybackStop);
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
define(['playlistManager', 'appSettings', 'appStorage'], function (playlistManager, appSettings, appStorage) {
|
||||
define(['playlistManager', 'appSettings', 'appStorage', 'jQuery'], function (playlistManager, appSettings, appStorage, $) {
|
||||
|
||||
var libraryBrowser = (function (window, document, screen) {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['appSettings', 'appStorage', 'libraryBrowser'], function (appSettings, appStorage, LibraryBrowser) {
|
||||
define(['appSettings', 'appStorage', 'libraryBrowser', 'jQuery'], function (appSettings, appStorage, LibraryBrowser, $) {
|
||||
|
||||
var showOverlayTimeout;
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@
|
|||
document.body.classList.add('bodyWithPopupOpen');
|
||||
}
|
||||
|
||||
var pageElem = $($.mobile.activePage)[0];
|
||||
var pageElem = $.mobile.activePage;
|
||||
|
||||
if (requiresDrawerRefresh || requiresDashboardDrawerRefresh) {
|
||||
|
||||
|
@ -435,7 +435,7 @@
|
|||
view.icon = 'live-tv';
|
||||
view.onclick = "LibraryBrowser.showTab('livetv.html', 0);";
|
||||
|
||||
var guideView = $.extend({}, view);
|
||||
var guideView = Object.assign({}, view);
|
||||
guideView.Name = Globalize.translate('ButtonGuide');
|
||||
guideView.ImageTags = {};
|
||||
guideView.icon = 'dvr';
|
||||
|
@ -443,7 +443,7 @@
|
|||
guideView.onclick = "LibraryBrowser.showTab('livetv.html', 1);";
|
||||
list.push(guideView);
|
||||
|
||||
var recordedTvView = $.extend({}, view);
|
||||
var recordedTvView = Object.assign({}, view);
|
||||
recordedTvView.Name = Globalize.translate('ButtonRecordedTv');
|
||||
recordedTvView.ImageTags = {};
|
||||
recordedTvView.icon = 'video-library';
|
||||
|
@ -457,13 +457,25 @@
|
|||
});
|
||||
}
|
||||
|
||||
function showBySelector(selector, show) {
|
||||
var elem = document.querySelector(selector);
|
||||
|
||||
if (elem) {
|
||||
if (show) {
|
||||
elem.classList.remove('hide');
|
||||
} else {
|
||||
elem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateLibraryMenu(user) {
|
||||
|
||||
if (!user) {
|
||||
|
||||
$('.adminMenuOptions').addClass('hide');
|
||||
$('.lnkMySync').addClass('hide');
|
||||
$('.userMenuOptions').addClass('hide');
|
||||
showBySelector('.adminMenuOptions', false);
|
||||
showBySelector('.lnkMySync', false);
|
||||
showBySelector('.userMenuOptions', false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -541,19 +553,23 @@
|
|||
libraryMenuOptions.innerHTML = html;
|
||||
var elem = libraryMenuOptions;
|
||||
|
||||
$('.sidebarLink', elem).off('click', onSidebarLinkClick).on('click', onSidebarLinkClick);
|
||||
var sidebarLinks = elem.querySelectorAll('.sidebarLink');
|
||||
for (var i = 0, length = sidebarLinks.length; i < length; i++) {
|
||||
sidebarLinks[i].removeEventListener('click', onSidebarLinkClick);
|
||||
sidebarLinks[i].addEventListener('click', onSidebarLinkClick);
|
||||
}
|
||||
});
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
$('.adminMenuOptions').removeClass('hide');
|
||||
showBySelector('.adminMenuOptions', true);
|
||||
} else {
|
||||
$('.adminMenuOptions').addClass('hide');
|
||||
showBySelector('.adminMenuOptions', false);
|
||||
}
|
||||
|
||||
if (user.Policy.EnableSync) {
|
||||
$('.lnkMySync').removeClass('hide');
|
||||
showBySelector('.lnkMySync', true);
|
||||
} else {
|
||||
$('.lnkMySync').addClass('hide');
|
||||
showBySelector('.lnkMySync', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
NowPlayingItem: state.NowPlayingItem
|
||||
};
|
||||
|
||||
info = $.extend(info, state.PlayState);
|
||||
info = Object.assign(info, state.PlayState);
|
||||
|
||||
ApiClient.reportPlaybackStart(info);
|
||||
|
||||
|
@ -126,12 +126,11 @@
|
|||
|
||||
function showActivePlayerMenuInternal(playerInfo) {
|
||||
|
||||
var id = 'dlg' + new Date().getTime();
|
||||
var html = '';
|
||||
|
||||
var style = "";
|
||||
|
||||
html += '<paper-dialog id="' + id + '" entry-animation="fade-in-animation" exit-animation="fade-out-animation" with-backdrop style="' + style + '">';
|
||||
var dlg = document.createElement('paper-dialog');
|
||||
dlg.setAttribute('with-backdrop', 'with-backdrop');
|
||||
dlg.setAttribute('role', 'alertdialog');
|
||||
|
||||
html += '<h2>';
|
||||
html += (playerInfo.deviceName || playerInfo.name);
|
||||
|
@ -160,21 +159,19 @@
|
|||
html += '<paper-button dialog-dismiss>' + Globalize.translate('ButtonCancel') + '</paper-button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</paper-dialog>';
|
||||
dlg.innerHTML = html;
|
||||
|
||||
$(document.body).append(html);
|
||||
document.body.appendChild(dlg);
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
var dlg = document.getElementById(id);
|
||||
|
||||
$('.chkMirror', dlg).on('change', onMirrorChange);
|
||||
dlg.querySelector('.chkMirror').addEventListener('change', onMirrorChange);
|
||||
|
||||
dlg.open();
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
$(dlg).on('iron-overlay-closed', function () {
|
||||
$(this).remove();
|
||||
dlg.addEventListener('iron-overlay-closed', function () {
|
||||
dlg.parentNode.removeChild(dlg);
|
||||
});
|
||||
|
||||
}, 100);
|
||||
|
@ -1045,7 +1042,9 @@
|
|||
|
||||
document.addEventListener('headercreated', function () {
|
||||
|
||||
$('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked);
|
||||
var btnCast = document.querySelector('.viewMenuBar .btnCast');
|
||||
btnCast.removeEventListener('click', onCastButtonClicked);
|
||||
btnCast.addEventListener('click', onCastButtonClicked);
|
||||
});
|
||||
|
||||
pageClassOn('pagebeforeshow', "page", function () {
|
||||
|
|
|
@ -273,7 +273,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
require(['css!css/nowplayingbar.css', 'paper-slider'], function () {
|
||||
require(['jQuery', 'css!css/nowplayingbar.css', 'paper-slider'], function ($) {
|
||||
|
||||
nowPlayingBarElement = document.querySelector('.nowPlayingBar');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['appStorage'], function (appStorage) {
|
||||
define(['appStorage', 'jQuery'], function (appStorage, $) {
|
||||
|
||||
var supporterPlaybackKey = 'lastSupporterPlaybackMessage4';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['jQuery', 'searchmenu'], function ($) {
|
||||
define(['libraryBrowser'], function (libraryBrowser) {
|
||||
|
||||
var searchHintTimeout;
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
|||
return i;
|
||||
});
|
||||
|
||||
var html = LibraryBrowser.getPosterViewHtml({
|
||||
var html = libraryBrowser.getPosterViewHtml({
|
||||
items: hints,
|
||||
shape: "auto",
|
||||
lazy: true,
|
||||
|
@ -151,12 +151,13 @@
|
|||
|
||||
if (createIfNeeded && !elem) {
|
||||
|
||||
var html = '<div class="searchResultsOverlay ui-body-b smoothScrollY background-theme-b">';
|
||||
var div = document.createElement('div');
|
||||
div.className = 'searchResultsOverlay ui-body-b smoothScrollY background-theme-b';
|
||||
|
||||
html += '<div class="searchResultsContainer"><div class="itemsContainer"></div></div></div>';
|
||||
div.innerHTML = '<div class="searchResultsContainer"><div class="itemsContainer"></div></div></div>';
|
||||
|
||||
elem = $(html).appendTo(document.body)[0];
|
||||
$(elem).createCardMenus();
|
||||
document.body.appendChild(div);
|
||||
libraryBrowser.createCardMenus(div);
|
||||
}
|
||||
|
||||
return elem;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['jQuery'], function ($) {
|
||||
define([], function () {
|
||||
|
||||
function fadeIn(elem, iterations) {
|
||||
|
||||
|
@ -16,15 +16,25 @@
|
|||
self.show = function () {
|
||||
|
||||
require(['css!css/search.css'], function () {
|
||||
$('.headerSearchInput').val('');
|
||||
|
||||
$('.btnCloseSearch').hide();
|
||||
var elem = $('.viewMenuSearch').removeClass('hide')[0];
|
||||
document.querySelector('.headerSearchInput').value = '';
|
||||
|
||||
fadeIn(elem, 1).onfinish = function () {
|
||||
$('.headerSearchInput').focus();
|
||||
$('.btnCloseSearch').show();
|
||||
document.querySelector('.btnCloseSearch').classList.add('hide');
|
||||
var elem = document.querySelector('.viewMenuSearch');
|
||||
|
||||
elem.classList.remove('hide');
|
||||
|
||||
var onFinish = function() {
|
||||
document.querySelector('.headerSearchInput').focus();
|
||||
document.querySelector('.btnCloseSearch').classList.remove('hide');
|
||||
};
|
||||
|
||||
if (elem.animate) {
|
||||
fadeIn(elem, 1).onfinish = onFinish;
|
||||
} else {
|
||||
onFinish();
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -37,48 +47,40 @@
|
|||
}
|
||||
|
||||
if (!viewMenuSearch.classList.contains('hide')) {
|
||||
$('.btnCloseSearch').hide();
|
||||
document.querySelector('.btnCloseSearch').classList.add('hide');
|
||||
viewMenuSearch.classList.add('hide');
|
||||
}
|
||||
};
|
||||
|
||||
$('.viewMenuSearchForm').on('submit', function () {
|
||||
|
||||
document.querySelector('.viewMenuSearchForm').addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.btnCloseSearch').on('click', function () {
|
||||
document.querySelector('.btnCloseSearch').addEventListener('click', function () {
|
||||
self.hide();
|
||||
Events.trigger(self, 'closed');
|
||||
});
|
||||
|
||||
$('.headerSearchInput').on("keyup", function (e) {
|
||||
document.querySelector('.headerSearchInput').addEventListener('keyup', function (e) {
|
||||
|
||||
// Down key
|
||||
if (e.keyCode == 40) {
|
||||
|
||||
//var first = $('.card', panel)[0];
|
||||
|
||||
//if (first) {
|
||||
// first.focus();
|
||||
//}
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
Events.trigger(self, 'change', [this.value]);
|
||||
}
|
||||
|
||||
}).on("search", function (e) {
|
||||
|
||||
if (!this.value) {
|
||||
|
||||
Events.trigger(self, 'change', ['']);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
document.querySelector('.headerSearchInput').addEventListener('search', function (e) {
|
||||
if (!this.value) {
|
||||
Events.trigger(self, 'change', ['']);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.SearchMenu = new searchMenu();
|
||||
|
|
|
@ -1854,6 +1854,7 @@ var AppInfo = {};
|
|||
define("slideshow", [embyWebComponentsBowerPath + "/slideshow/slideshow"], returnFirstDependency);
|
||||
|
||||
define('fetch', [bowerPath + '/fetch/fetch']);
|
||||
define('objectassign', ['legacy/objectassign']);
|
||||
define('webcomponentsjs', [bowerPath + '/webcomponentsjs/webcomponents-lite.min.js']);
|
||||
define('native-promise-only', [bowerPath + '/native-promise-only/lib/npo.src']);
|
||||
|
||||
|
@ -2133,6 +2134,10 @@ var AppInfo = {};
|
|||
deps.push('fetch');
|
||||
}
|
||||
|
||||
if (typeof Object.assign != 'function') {
|
||||
deps.push('objectassign');
|
||||
}
|
||||
|
||||
require(deps, function (connectionManagerExports, credentialProviderFactory) {
|
||||
|
||||
window.MediaBrowser = window.MediaBrowser || {};
|
||||
|
@ -2403,13 +2408,14 @@ var AppInfo = {};
|
|||
|
||||
defineRoute({
|
||||
path: '/home.html',
|
||||
dependencies: ['jQuery'],
|
||||
autoFocus: false
|
||||
dependencies: ['paper-tabs', 'neon-animated-pages'],
|
||||
autoFocus: false,
|
||||
controller: 'scripts/indexpage'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/index.html',
|
||||
dependencies: ['jQuery'],
|
||||
dependencies: [],
|
||||
autoFocus: false,
|
||||
isDefaultRoute: true
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue