mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
commit
74b31ea2fe
3 changed files with 41 additions and 39 deletions
|
@ -37,53 +37,56 @@ import 'css!components/viewManager/viewContainer';
|
||||||
const newViewInfo = normalizeNewView(options, isPluginpage);
|
const newViewInfo = normalizeNewView(options, isPluginpage);
|
||||||
const newView = newViewInfo.elem;
|
const newView = newViewInfo.elem;
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
const currentPage = allPages[pageIndex];
|
||||||
const currentPage = allPages[pageIndex];
|
|
||||||
|
|
||||||
if (currentPage) {
|
if (currentPage) {
|
||||||
triggerDestroy(currentPage);
|
triggerDestroy(currentPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
let view = newView;
|
let view = newView;
|
||||||
|
|
||||||
if (typeof view == 'string') {
|
if (typeof view == 'string') {
|
||||||
view = document.createElement('div');
|
view = document.createElement('div');
|
||||||
view.innerHTML = newView;
|
view.innerHTML = newView;
|
||||||
}
|
}
|
||||||
|
|
||||||
view.classList.add('mainAnimatedPage');
|
view.classList.add('mainAnimatedPage');
|
||||||
|
|
||||||
if (currentPage) {
|
if (currentPage) {
|
||||||
if (newViewInfo.hasScript && window.$) {
|
if (newViewInfo.hasScript && window.$) {
|
||||||
mainAnimatedPages.removeChild(currentPage);
|
mainAnimatedPages.removeChild(currentPage);
|
||||||
view = $(view).appendTo(mainAnimatedPages)[0];
|
view = $(view).appendTo(mainAnimatedPages)[0];
|
||||||
} else {
|
|
||||||
mainAnimatedPages.replaceChild(view, currentPage);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (newViewInfo.hasScript && window.$) {
|
mainAnimatedPages.replaceChild(view, currentPage);
|
||||||
view = $(view).appendTo(mainAnimatedPages)[0];
|
|
||||||
} else {
|
|
||||||
mainAnimatedPages.appendChild(view);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if (options.type) {
|
if (newViewInfo.hasScript && window.$) {
|
||||||
view.setAttribute('data-type', options.type);
|
view = $(view).appendTo(mainAnimatedPages)[0];
|
||||||
|
} else {
|
||||||
|
mainAnimatedPages.appendChild(view);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const properties = [];
|
if (options.type) {
|
||||||
|
view.setAttribute('data-type', options.type);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.fullscreen) {
|
const properties = [];
|
||||||
properties.push('fullscreen');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (properties.length) {
|
if (options.fullscreen) {
|
||||||
view.setAttribute('data-properties', properties.join(','));
|
properties.push('fullscreen');
|
||||||
}
|
}
|
||||||
|
|
||||||
allPages[pageIndex] = view;
|
if (properties.length) {
|
||||||
setControllerClass(view, options).then(() => {
|
view.setAttribute('data-properties', properties.join(','));
|
||||||
|
}
|
||||||
|
|
||||||
|
allPages[pageIndex] = view;
|
||||||
|
|
||||||
|
return setControllerClass(view, options)
|
||||||
|
// Timeout for polyfilled CustomElements (webOS 1.2)
|
||||||
|
.then(() => new Promise((resolve) => setTimeout(resolve, 0)))
|
||||||
|
.then(() => {
|
||||||
if (onBeforeChange) {
|
if (onBeforeChange) {
|
||||||
onBeforeChange(view, false, options);
|
onBeforeChange(view, false, options);
|
||||||
}
|
}
|
||||||
|
@ -101,9 +104,8 @@ import 'css!components/viewManager/viewContainer';
|
||||||
$.mobile.activePage = view;
|
$.mobile.activePage = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(view);
|
return view;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ module.exports = merge(common, {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules[\\/](?!date-fns|epubjs|jellyfin-apiclient|query-string|split-on-first|strict-uri-encode|xmldom)/,
|
exclude: /node_modules[\\/](?!date-fns|epubjs|libarchive|jellyfin-apiclient|query-string|split-on-first|strict-uri-encode|xmldom)/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = merge(common, {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules[\\/](?!date-fns|epubjs|jellyfin-apiclient|query-string|split-on-first|strict-uri-encode|xmldom)/,
|
exclude: /node_modules[\\/](?!date-fns|epubjs|libarchive|jellyfin-apiclient|query-string|split-on-first|strict-uri-encode|xmldom)/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue