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

Merge pull request #1894 from dmitrylyzo/fix-old-webos

Fix webOS 1.2
This commit is contained in:
dkanada 2020-10-01 14:03:08 +09:00 committed by GitHub
commit 74b31ea2fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 39 deletions

View file

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

View file

@ -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: {

View file

@ -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: {