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:
commit
78f9a1f4e8
6 changed files with 16 additions and 41 deletions
13
.eslintrc.js
13
.eslintrc.js
|
@ -228,15 +228,12 @@ module.exports = {
|
|||
},
|
||||
env: {
|
||||
node: false,
|
||||
amd: true,
|
||||
browser: true,
|
||||
es6: true,
|
||||
es2017: true,
|
||||
es2020: true
|
||||
},
|
||||
globals: {
|
||||
// Browser globals
|
||||
'MediaMetadata': 'readonly',
|
||||
// Tizen globals
|
||||
'tizen': 'readonly',
|
||||
'webapis': 'readonly',
|
||||
|
@ -249,19 +246,9 @@ module.exports = {
|
|||
'ApiClient': 'writable',
|
||||
'Events': 'writable',
|
||||
'chrome': 'writable',
|
||||
'DlnaProfilePage': 'writable',
|
||||
'DashboardPage': 'writable',
|
||||
'Emby': 'readonly',
|
||||
'Globalize': 'writable',
|
||||
'Hls': 'writable',
|
||||
'LibraryMenu': 'writable',
|
||||
'LinkParser': 'writable',
|
||||
'LiveTvHelpers': 'writable',
|
||||
'Loading': 'writable',
|
||||
'MetadataEditor': 'writable',
|
||||
'ServerNotifications': 'writable',
|
||||
'TaskButton': 'writable',
|
||||
'UserParentalControlPage': 'writable',
|
||||
'Windows': 'readonly',
|
||||
// Build time definitions
|
||||
__COMMIT_SHA__: 'readonly',
|
||||
|
|
|
@ -394,7 +394,7 @@ function renderRunningTasks(view, tasks) {
|
|||
view.querySelector('#divRunningTasks').innerHTML = html;
|
||||
}
|
||||
|
||||
window.DashboardPage = {
|
||||
const DashboardPage = {
|
||||
startInterval: function (apiClient) {
|
||||
apiClient.sendMessage('SessionsStart', '0,1500');
|
||||
apiClient.sendMessage('ScheduledTasksInfoStart', '0,1000');
|
||||
|
@ -741,6 +741,7 @@ window.DashboardPage = {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default function (view) {
|
||||
function onRestartRequired(evt, apiClient) {
|
||||
console.debug('onRestartRequired not implemented', evt, apiClient);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import loading from '../components/loading/loading';
|
||||
import '../scripts/editorsidebar';
|
||||
import loading from 'components/loading/loading';
|
||||
import { getCurrentItemId, setCurrentItemId } from 'scripts/editorsidebar';
|
||||
|
||||
function reload(context, itemId) {
|
||||
loading.show();
|
||||
|
@ -16,14 +16,16 @@ function reload(context, itemId) {
|
|||
|
||||
export default function (view) {
|
||||
view.addEventListener('viewshow', function () {
|
||||
reload(this, MetadataEditor.getCurrentItemId());
|
||||
reload(this, getCurrentItemId());
|
||||
});
|
||||
MetadataEditor.setCurrentItemId(null);
|
||||
|
||||
setCurrentItemId(null);
|
||||
|
||||
view.querySelector('.libraryTree').addEventListener('itemclicked', function (event) {
|
||||
const data = event.detail;
|
||||
|
||||
if (data.id != MetadataEditor.getCurrentItemId()) {
|
||||
MetadataEditor.setCurrentItemId(data.id);
|
||||
if (data.id != getCurrentItemId()) {
|
||||
setCurrentItemId(data.id);
|
||||
reload(view, data.id);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,12 +2,12 @@ import cardBuilder from 'components/cardbuilder/cardBuilder';
|
|||
import imageLoader from 'components/images/imageLoader';
|
||||
import layoutManager from 'components/layoutManager';
|
||||
import loading from 'components/loading/loading';
|
||||
import { getTimersHtml } from 'scripts/livetvcomponents';
|
||||
import { getBackdropShape } from 'utils/card';
|
||||
import Dashboard from 'utils/dashboard';
|
||||
|
||||
import 'elements/emby-button/emby-button';
|
||||
import 'elements/emby-itemscontainer/emby-itemscontainer';
|
||||
import 'scripts/livetvcomponents';
|
||||
|
||||
function enableScrollX() {
|
||||
return !layoutManager.desktop;
|
||||
|
@ -71,7 +71,7 @@ function renderActiveRecordings(context, promise) {
|
|||
}
|
||||
|
||||
function renderTimers(context, timers, options) {
|
||||
LiveTvHelpers.getTimersHtml(timers, options).then(function (html) {
|
||||
getTimersHtml(timers, options).then(function (html) {
|
||||
const elem = context;
|
||||
|
||||
if (html) {
|
||||
|
|
|
@ -287,11 +287,12 @@ function updateEditorNode(page, item) {
|
|||
}
|
||||
}
|
||||
|
||||
function setCurrentItemId(id) {
|
||||
let itemId;
|
||||
export function setCurrentItemId(id) {
|
||||
itemId = id;
|
||||
}
|
||||
|
||||
function getCurrentItemId() {
|
||||
export function getCurrentItemId() {
|
||||
if (itemId) {
|
||||
return itemId;
|
||||
}
|
||||
|
@ -326,16 +327,4 @@ $(document).on('itemsaved', '.metadataEditorPage', function (e, item) {
|
|||
.off('open_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 */
|
||||
|
|
|
@ -8,7 +8,7 @@ function enableScrollX() {
|
|||
return !layoutManager.desktop;
|
||||
}
|
||||
|
||||
function getTimersHtml(timers, options) {
|
||||
export function getTimersHtml(timers, options) {
|
||||
options = options || {};
|
||||
|
||||
const items = timers.map(function (t) {
|
||||
|
@ -102,7 +102,3 @@ function getTimersHtml(timers, options) {
|
|||
}
|
||||
return Promise.resolve(html);
|
||||
}
|
||||
|
||||
window.LiveTvHelpers = {
|
||||
getTimersHtml: getTimersHtml
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue