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

Merge pull request #6523 from thornbill/remove-globals

This commit is contained in:
Bill Thornton 2025-02-13 16:32:57 -05:00 committed by GitHub
commit 78f9a1f4e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 16 additions and 41 deletions

View file

@ -228,15 +228,12 @@ module.exports = {
}, },
env: { env: {
node: false, node: false,
amd: true,
browser: true, browser: true,
es6: true, es6: true,
es2017: true, es2017: true,
es2020: true es2020: true
}, },
globals: { globals: {
// Browser globals
'MediaMetadata': 'readonly',
// Tizen globals // Tizen globals
'tizen': 'readonly', 'tizen': 'readonly',
'webapis': 'readonly', 'webapis': 'readonly',
@ -249,19 +246,9 @@ module.exports = {
'ApiClient': 'writable', 'ApiClient': 'writable',
'Events': 'writable', 'Events': 'writable',
'chrome': 'writable', 'chrome': 'writable',
'DlnaProfilePage': 'writable',
'DashboardPage': 'writable',
'Emby': 'readonly', 'Emby': 'readonly',
'Globalize': 'writable',
'Hls': 'writable', 'Hls': 'writable',
'LibraryMenu': 'writable', 'LibraryMenu': 'writable',
'LinkParser': 'writable',
'LiveTvHelpers': 'writable',
'Loading': 'writable',
'MetadataEditor': 'writable',
'ServerNotifications': 'writable',
'TaskButton': 'writable',
'UserParentalControlPage': 'writable',
'Windows': 'readonly', 'Windows': 'readonly',
// Build time definitions // Build time definitions
__COMMIT_SHA__: 'readonly', __COMMIT_SHA__: 'readonly',

View file

@ -394,7 +394,7 @@ function renderRunningTasks(view, tasks) {
view.querySelector('#divRunningTasks').innerHTML = html; view.querySelector('#divRunningTasks').innerHTML = html;
} }
window.DashboardPage = { const DashboardPage = {
startInterval: function (apiClient) { startInterval: function (apiClient) {
apiClient.sendMessage('SessionsStart', '0,1500'); apiClient.sendMessage('SessionsStart', '0,1500');
apiClient.sendMessage('ScheduledTasksInfoStart', '0,1000'); apiClient.sendMessage('ScheduledTasksInfoStart', '0,1000');
@ -741,6 +741,7 @@ window.DashboardPage = {
}); });
} }
}; };
export default function (view) { export default function (view) {
function onRestartRequired(evt, apiClient) { function onRestartRequired(evt, apiClient) {
console.debug('onRestartRequired not implemented', evt, apiClient); console.debug('onRestartRequired not implemented', evt, apiClient);

View file

@ -1,5 +1,5 @@
import loading from '../components/loading/loading'; import loading from 'components/loading/loading';
import '../scripts/editorsidebar'; import { getCurrentItemId, setCurrentItemId } from 'scripts/editorsidebar';
function reload(context, itemId) { function reload(context, itemId) {
loading.show(); loading.show();
@ -16,14 +16,16 @@ function reload(context, itemId) {
export default function (view) { export default function (view) {
view.addEventListener('viewshow', function () { view.addEventListener('viewshow', function () {
reload(this, MetadataEditor.getCurrentItemId()); reload(this, getCurrentItemId());
}); });
MetadataEditor.setCurrentItemId(null);
setCurrentItemId(null);
view.querySelector('.libraryTree').addEventListener('itemclicked', function (event) { view.querySelector('.libraryTree').addEventListener('itemclicked', function (event) {
const data = event.detail; const data = event.detail;
if (data.id != MetadataEditor.getCurrentItemId()) { if (data.id != getCurrentItemId()) {
MetadataEditor.setCurrentItemId(data.id); setCurrentItemId(data.id);
reload(view, data.id); reload(view, data.id);
} }
}); });

View file

@ -2,12 +2,12 @@ import cardBuilder from 'components/cardbuilder/cardBuilder';
import imageLoader from 'components/images/imageLoader'; import imageLoader from 'components/images/imageLoader';
import layoutManager from 'components/layoutManager'; import layoutManager from 'components/layoutManager';
import loading from 'components/loading/loading'; import loading from 'components/loading/loading';
import { getTimersHtml } from 'scripts/livetvcomponents';
import { getBackdropShape } from 'utils/card'; import { getBackdropShape } from 'utils/card';
import Dashboard from 'utils/dashboard'; import Dashboard from 'utils/dashboard';
import 'elements/emby-button/emby-button'; import 'elements/emby-button/emby-button';
import 'elements/emby-itemscontainer/emby-itemscontainer'; import 'elements/emby-itemscontainer/emby-itemscontainer';
import 'scripts/livetvcomponents';
function enableScrollX() { function enableScrollX() {
return !layoutManager.desktop; return !layoutManager.desktop;
@ -71,7 +71,7 @@ function renderActiveRecordings(context, promise) {
} }
function renderTimers(context, timers, options) { function renderTimers(context, timers, options) {
LiveTvHelpers.getTimersHtml(timers, options).then(function (html) { getTimersHtml(timers, options).then(function (html) {
const elem = context; const elem = context;
if (html) { if (html) {

View file

@ -287,11 +287,12 @@ function updateEditorNode(page, item) {
} }
} }
function setCurrentItemId(id) { let itemId;
export function setCurrentItemId(id) {
itemId = id; itemId = id;
} }
function getCurrentItemId() { export function getCurrentItemId() {
if (itemId) { if (itemId) {
return itemId; return itemId;
} }
@ -326,16 +327,4 @@ $(document).on('itemsaved', '.metadataEditorPage', function (e, item) {
.off('open_node.jstree', onNodeOpen) .off('open_node.jstree', onNodeOpen)
.off('load_node.jstree', onNodeOpen); .off('load_node.jstree', onNodeOpen);
}); });
let itemId;
window.MetadataEditor = {
getItemPromise: function () {
const currentItemId = getCurrentItemId();
if (currentItemId) {
return ApiClient.getItem(Dashboard.getCurrentUserId(), currentItemId);
}
return ApiClient.getRootFolder(Dashboard.getCurrentUserId());
},
getCurrentItemId: getCurrentItemId,
setCurrentItemId: setCurrentItemId
};
/* eslint-enable @typescript-eslint/naming-convention */ /* eslint-enable @typescript-eslint/naming-convention */

View file

@ -8,7 +8,7 @@ function enableScrollX() {
return !layoutManager.desktop; return !layoutManager.desktop;
} }
function getTimersHtml(timers, options) { export function getTimersHtml(timers, options) {
options = options || {}; options = options || {};
const items = timers.map(function (t) { const items = timers.map(function (t) {
@ -102,7 +102,3 @@ function getTimersHtml(timers, options) {
} }
return Promise.resolve(html); return Promise.resolve(html);
} }
window.LiveTvHelpers = {
getTimersHtml: getTimersHtml
};