diff --git a/.eslintrc.js b/.eslintrc.js index 2c750c847c..21ae7e28e4 100644 --- a/.eslintrc.js +++ b/.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', diff --git a/src/apps/dashboard/controllers/dashboard.js b/src/apps/dashboard/controllers/dashboard.js index 1ffa88be60..119fe8e670 100644 --- a/src/apps/dashboard/controllers/dashboard.js +++ b/src/apps/dashboard/controllers/dashboard.js @@ -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); diff --git a/src/controllers/edititemmetadata.js b/src/controllers/edititemmetadata.js index a5ac202cc7..5502772db9 100644 --- a/src/controllers/edititemmetadata.js +++ b/src/controllers/edititemmetadata.js @@ -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); } }); diff --git a/src/controllers/livetv/livetvschedule.js b/src/controllers/livetv/livetvschedule.js index 84d51b6513..2ececff07a 100644 --- a/src/controllers/livetv/livetvschedule.js +++ b/src/controllers/livetv/livetvschedule.js @@ -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) { diff --git a/src/scripts/editorsidebar.js b/src/scripts/editorsidebar.js index 37094e5d03..0074d34260 100644 --- a/src/scripts/editorsidebar.js +++ b/src/scripts/editorsidebar.js @@ -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 */ diff --git a/src/scripts/livetvcomponents.js b/src/scripts/livetvcomponents.js index 68a2c53453..6f35db3cae 100644 --- a/src/scripts/livetvcomponents.js +++ b/src/scripts/livetvcomponents.js @@ -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 -};