diff --git a/.eslintrc.js b/.eslintrc.js
index a42ab3f53c..2851fd803f 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -100,6 +100,7 @@ module.exports = {
'jQuery': 'readonly',
// Jellyfin globals
'ApiClient': 'writable',
+ 'Events': 'writable',
'chrome': 'writable',
'DlnaProfilePage': 'writable',
'DashboardPage': 'writable',
@@ -115,6 +116,8 @@ module.exports = {
'Loading': 'writable',
'MetadataEditor': 'writable',
'PlaylistViewer': 'writable',
+ 'ServerNotifications': 'writable',
+ 'TaskButton': 'writable',
'UserParentalControlPage': 'writable',
'Windows': 'readonly'
},
diff --git a/src/components/directorybrowser/directorybrowser.js b/src/components/directorybrowser/directorybrowser.js
index 2d53da67ed..e918149ac9 100644
--- a/src/components/directorybrowser/directorybrowser.js
+++ b/src/components/directorybrowser/directorybrowser.js
@@ -10,303 +10,299 @@ import '../formdialog.scss';
import '../../elements/emby-button/emby-button';
import alert from '../alert';
-/* eslint-disable indent */
-
- function getSystemInfo() {
- return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
- info => {
- systemInfo = info;
- return info;
- }
- );
- }
-
- function onDialogClosed() {
- loading.hide();
- }
-
- function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
- if (path && typeof path !== 'string') {
- throw new Error('invalid path');
+function getSystemInfo() {
+ return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
+ info => {
+ systemInfo = info;
+ return info;
}
+ );
+}
- loading.show();
+function onDialogClosed() {
+ loading.hide();
+}
- const promises = [];
+function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
+ if (path && typeof path !== 'string') {
+ throw new Error('invalid path');
+ }
- if (path === 'Network') {
- promises.push(ApiClient.getNetworkDevices());
+ loading.show();
+
+ const promises = [];
+
+ if (path === 'Network') {
+ promises.push(ApiClient.getNetworkDevices());
+ } else {
+ if (path) {
+ promises.push(ApiClient.getDirectoryContents(path, fileOptions));
+ promises.push(ApiClient.getParentPath(path));
} else {
+ promises.push(ApiClient.getDrives());
+ }
+ }
+
+ Promise.all(promises).then(
+ responses => {
+ const folders = responses[0];
+ const parentPath = responses[1] || '';
+ let html = '';
+
+ page.querySelector('.results').scrollTop = 0;
+ page.querySelector('#txtDirectoryPickerPath').value = path || '';
+
if (path) {
- promises.push(ApiClient.getDirectoryContents(path, fileOptions));
- promises.push(ApiClient.getParentPath(path));
- } else {
- promises.push(ApiClient.getDrives());
+ html += getItem('lnkPath lnkDirectory', '', parentPath, '...');
+ }
+ for (let i = 0, length = folders.length; i < length; i++) {
+ const folder = folders[i];
+ const cssClass = folder.Type === 'File' ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
+ html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
+ }
+
+ if (!path) {
+ html += getItem('lnkPath lnkDirectory', '', 'Network', globalize.translate('ButtonNetwork'));
+ }
+
+ page.querySelector('.results').innerHTML = html;
+ loading.hide();
+ }, () => {
+ if (updatePathOnError) {
+ page.querySelector('#txtDirectoryPickerPath').value = '';
+ page.querySelector('.results').innerHTML = '';
+ loading.hide();
}
}
+ );
+}
- Promise.all(promises).then(
- responses => {
- const folders = responses[0];
- const parentPath = responses[1] || '';
- let html = '';
+function getItem(cssClass, type, path, name) {
+ let html = '';
+ html += `
`;
+ html += '
';
+ html += '
';
+ html += name;
+ html += '
';
+ html += '
';
+ html += '
';
+ html += '
';
+ return html;
+}
- page.querySelector('.results').scrollTop = 0;
- page.querySelector('#txtDirectoryPickerPath').value = path || '';
+function getEditorHtml(options, systemInfo) {
+ let html = '';
+ html += '';
+ html += '
';
+ if (!options.pathReadOnly) {
+ const instruction = options.instruction ? `${options.instruction}
` : '';
+ html += '
';
+ html += instruction;
+ if (systemInfo.OperatingSystem.toLowerCase() === 'bsd') {
+ html += '
';
+ html += '
';
+ html += globalize.translate('MessageDirectoryPickerBSDInstruction');
+ html += '
';
+ } else if (systemInfo.OperatingSystem.toLowerCase() === 'linux') {
+ html += '
';
+ html += '
';
+ html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
+ html += '
';
+ }
+ html += '
';
+ }
+ html += '
';
+ html += '
';
+ html += '
';
+ html += '';
- if (path) {
- html += getItem('lnkPath lnkDirectory', '', parentPath, '...');
- }
- for (let i = 0, length = folders.length; i < length; i++) {
- const folder = folders[i];
- const cssClass = folder.Type === 'File' ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
- html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
+ return html;
+}
+
+function alertText(text) {
+ alertTextWithOptions({
+ text: text
+ });
+}
+
+function alertTextWithOptions(options) {
+ alert(options);
+}
+
+function validatePath(path, validateWriteable, apiClient) {
+ return apiClient.ajax({
+ type: 'POST',
+ url: apiClient.getUrl('Environment/ValidatePath'),
+ data: JSON.stringify({
+ ValidateWriteable: validateWriteable,
+ Path: path
+ }),
+ contentType: 'application/json'
+ }).catch(response => {
+ if (response) {
+ if (response.status === 404) {
+ alertText(globalize.translate('PathNotFound'));
+ return Promise.reject();
+ }
+ if (response.status === 500) {
+ if (validateWriteable) {
+ alertText(globalize.translate('WriteAccessRequired'));
+ } else {
+ alertText(globalize.translate('PathNotFound'));
}
+ return Promise.reject();
+ }
+ }
+ return Promise.resolve();
+ });
+}
- if (!path) {
- html += getItem('lnkPath lnkDirectory', '', 'Network', globalize.translate('ButtonNetwork'));
- }
+function initEditor(content, options, fileOptions) {
+ content.addEventListener('click', e => {
+ const lnkPath = dom.parentWithClass(e.target, 'lnkPath');
+ if (lnkPath) {
+ const path = lnkPath.getAttribute('data-path');
+ if (lnkPath.classList.contains('lnkFile')) {
+ content.querySelector('#txtDirectoryPickerPath').value = path;
+ } else {
+ refreshDirectoryBrowser(content, path, fileOptions, true);
+ }
+ }
+ });
- page.querySelector('.results').innerHTML = html;
- loading.hide();
+ content.addEventListener('click', e => {
+ if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
+ const path = content.querySelector('#txtDirectoryPickerPath').value;
+ refreshDirectoryBrowser(content, path, fileOptions);
+ }
+ });
+
+ content.addEventListener('change', e => {
+ const txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
+ if (txtDirectoryPickerPath && txtDirectoryPickerPath.id === 'txtDirectoryPickerPath') {
+ refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
+ }
+ });
+
+ content.querySelector('form').addEventListener('submit', function(e) {
+ if (options.callback) {
+ let networkSharePath = this.querySelector('#txtNetworkPath');
+ networkSharePath = networkSharePath ? networkSharePath.value : null;
+ const path = this.querySelector('#txtDirectoryPickerPath').value;
+ validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path, networkSharePath));
+ }
+ e.preventDefault();
+ e.stopPropagation();
+ return false;
+ });
+}
+
+function getDefaultPath(options) {
+ if (options.path) {
+ return Promise.resolve(options.path);
+ } else {
+ return ApiClient.getJSON(ApiClient.getUrl('Environment/DefaultDirectoryBrowser')).then(
+ result => {
+ return result.Path || '';
}, () => {
- if (updatePathOnError) {
- page.querySelector('#txtDirectoryPickerPath').value = '';
- page.querySelector('.results').innerHTML = '';
- loading.hide();
- }
+ return '';
}
);
}
+}
- function getItem(cssClass, type, path, name) {
- let html = '';
- html += ``;
- html += '
';
- html += '
';
- html += name;
- html += '
';
- html += '
';
- html += '
';
- html += '
';
- return html;
- }
+let systemInfo;
+class DirectoryBrowser {
+ currentDialog;
- function getEditorHtml(options, systemInfo) {
- let html = '';
- html += '';
- html += '
';
- if (!options.pathReadOnly) {
- const instruction = options.instruction ? `${options.instruction}
` : '';
- html += '
';
- html += instruction;
- if (systemInfo.OperatingSystem.toLowerCase() === 'bsd') {
- html += '
';
- html += '
';
- html += globalize.translate('MessageDirectoryPickerBSDInstruction');
- html += '
';
- } else if (systemInfo.OperatingSystem.toLowerCase() === 'linux') {
- html += '
';
- html += '
';
- html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
- html += '
';
+ show = options => {
+ options = options || {};
+ const fileOptions = {
+ includeDirectories: true
+ };
+ if (options.includeDirectories != null) {
+ fileOptions.includeDirectories = options.includeDirectories;
}
- html += '
';
- }
- html += '
';
- html += '
';
- html += '
';
- html += '';
+ if (options.includeFiles != null) {
+ fileOptions.includeFiles = options.includeFiles;
+ }
+ Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
+ responses => {
+ const systemInfo = responses[0];
+ const initialPath = responses[1];
+ const dlg = dialogHelper.createDialog({
+ size: 'small',
+ removeOnClose: true,
+ scrollY: false
+ });
+ dlg.classList.add('ui-body-a');
+ dlg.classList.add('background-theme-a');
+ dlg.classList.add('directoryPicker');
+ dlg.classList.add('formDialog');
- return html;
- }
-
- function alertText(text) {
- alertTextWithOptions({
- text: text
- });
- }
-
- function alertTextWithOptions(options) {
- alert(options);
- }
-
- function validatePath(path, validateWriteable, apiClient) {
- return apiClient.ajax({
- type: 'POST',
- url: apiClient.getUrl('Environment/ValidatePath'),
- data: JSON.stringify({
- ValidateWriteable: validateWriteable,
- Path: path
- }),
- contentType: 'application/json'
- }).catch(response => {
- if (response) {
- if (response.status === 404) {
- alertText(globalize.translate('PathNotFound'));
- return Promise.reject();
- }
- if (response.status === 500) {
- if (validateWriteable) {
- alertText(globalize.translate('WriteAccessRequired'));
- } else {
- alertText(globalize.translate('PathNotFound'));
+ let html = '';
+ html += '';
+ html += getEditorHtml(options, systemInfo);
+ dlg.innerHTML = html;
+ initEditor(dlg, options, fileOptions);
+ dlg.addEventListener('close', onDialogClosed);
+ dialogHelper.open(dlg);
+ dlg.querySelector('.btnCloseDialog').addEventListener('click', () => {
+ dialogHelper.close(dlg);
+ });
+ this.currentDialog = dlg;
+ dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
+ const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
+ if (txtNetworkPath) {
+ txtNetworkPath.value = options.networkSharePath || '';
+ }
+ if (!options.pathReadOnly) {
+ refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
}
- return Promise.reject();
- }
- }
- return Promise.resolve();
- });
- }
-
- function initEditor(content, options, fileOptions) {
- content.addEventListener('click', e => {
- const lnkPath = dom.parentWithClass(e.target, 'lnkPath');
- if (lnkPath) {
- const path = lnkPath.getAttribute('data-path');
- if (lnkPath.classList.contains('lnkFile')) {
- content.querySelector('#txtDirectoryPickerPath').value = path;
- } else {
- refreshDirectoryBrowser(content, path, fileOptions, true);
- }
- }
- });
-
- content.addEventListener('click', e => {
- if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
- const path = content.querySelector('#txtDirectoryPickerPath').value;
- refreshDirectoryBrowser(content, path, fileOptions);
- }
- });
-
- content.addEventListener('change', e => {
- const txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
- if (txtDirectoryPickerPath && txtDirectoryPickerPath.id === 'txtDirectoryPickerPath') {
- refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
- }
- });
-
- content.querySelector('form').addEventListener('submit', function(e) {
- if (options.callback) {
- let networkSharePath = this.querySelector('#txtNetworkPath');
- networkSharePath = networkSharePath ? networkSharePath.value : null;
- const path = this.querySelector('#txtDirectoryPickerPath').value;
- validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path, networkSharePath));
- }
- e.preventDefault();
- e.stopPropagation();
- return false;
- });
- }
-
- function getDefaultPath(options) {
- if (options.path) {
- return Promise.resolve(options.path);
- } else {
- return ApiClient.getJSON(ApiClient.getUrl('Environment/DefaultDirectoryBrowser')).then(
- result => {
- return result.Path || '';
- }, () => {
- return '';
}
);
- }
- }
+ };
- class directoryBrowser {
- constructor() {
- let currentDialog;
- this.show = options => {
- options = options || {};
- const fileOptions = {
- includeDirectories: true
- };
- if (options.includeDirectories != null) {
- fileOptions.includeDirectories = options.includeDirectories;
- }
- if (options.includeFiles != null) {
- fileOptions.includeFiles = options.includeFiles;
- }
- Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
- responses => {
- const systemInfo = responses[0];
- const initialPath = responses[1];
- const dlg = dialogHelper.createDialog({
- size: 'small',
- removeOnClose: true,
- scrollY: false
- });
- dlg.classList.add('ui-body-a');
- dlg.classList.add('background-theme-a');
- dlg.classList.add('directoryPicker');
- dlg.classList.add('formDialog');
+ close = () => {
+ if (this.currentDialog) {
+ dialogHelper.close(this.currentDialog);
+ }
+ };
+}
- let html = '';
- html += '';
- html += getEditorHtml(options, systemInfo);
- dlg.innerHTML = html;
- initEditor(dlg, options, fileOptions);
- dlg.addEventListener('close', onDialogClosed);
- dialogHelper.open(dlg);
- dlg.querySelector('.btnCloseDialog').addEventListener('click', () => {
- dialogHelper.close(dlg);
- });
- currentDialog = dlg;
- dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
- const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
- if (txtNetworkPath) {
- txtNetworkPath.value = options.networkSharePath || '';
- }
- if (!options.pathReadOnly) {
- refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
- }
- }
- );
- };
- this.close = () => {
- if (currentDialog) {
- dialogHelper.close(currentDialog);
- }
- };
- }
- }
-
- let systemInfo;
-
-/* eslint-enable indent */
-export default directoryBrowser;
+export default DirectoryBrowser;
diff --git a/src/components/mediaLibraryCreator/mediaLibraryCreator.js b/src/components/mediaLibraryCreator/mediaLibraryCreator.js
index ffccd8e933..72795f66f1 100644
--- a/src/components/mediaLibraryCreator/mediaLibraryCreator.js
+++ b/src/components/mediaLibraryCreator/mediaLibraryCreator.js
@@ -102,8 +102,8 @@ import template from './mediaLibraryCreator.template.html';
function onAddButtonClick() {
const page = dom.parentWithClass(this, 'dlg-librarycreator');
- import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
enableNetworkSharePath: true,
callback: function (path, networkSharePath) {
diff --git a/src/components/mediaLibraryEditor/mediaLibraryEditor.js b/src/components/mediaLibraryEditor/mediaLibraryEditor.js
index cfd1955c7b..dcb418f806 100644
--- a/src/components/mediaLibraryEditor/mediaLibraryEditor.js
+++ b/src/components/mediaLibraryEditor/mediaLibraryEditor.js
@@ -162,8 +162,8 @@ import template from './mediaLibraryEditor.template.html';
}
function showDirectoryBrowser(context, originalPath, networkPath) {
- import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
enableNetworkSharePath: true,
pathReadOnly: originalPath != null,
diff --git a/src/components/tvproviders/xmltv.js b/src/components/tvproviders/xmltv.js
index 853f9975cb..1f782b3607 100644
--- a/src/components/tvproviders/xmltv.js
+++ b/src/components/tvproviders/xmltv.js
@@ -145,8 +145,8 @@ export default function (page, providerId, options) {
function onSelectPathClick(e) {
const page = $(e.target).parents('.xmltvForm')[0];
- import('../directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
diff --git a/src/controllers/dashboard/encodingsettings.js b/src/controllers/dashboard/encodingsettings.js
index 88f1e975cd..97afb430a0 100644
--- a/src/controllers/dashboard/encodingsettings.js
+++ b/src/controllers/dashboard/encodingsettings.js
@@ -217,8 +217,8 @@ import alert from '../../components/alert';
setDecodingCodecsVisible(page, this.value);
});
$('#btnSelectEncoderPath', page).on('click.selectDirectory', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
@@ -232,8 +232,8 @@ import alert from '../../components/alert';
});
});
$('#btnSelectTranscodingTempPath', page).on('click.selectDirectory', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
callback: function (path) {
if (path) {
@@ -249,8 +249,8 @@ import alert from '../../components/alert';
});
});
$('#btnSelectFallbackFontPath', page).on('click.selectDirectory', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeDirectories: true,
callback: function (path) {
diff --git a/src/controllers/dashboard/general.js b/src/controllers/dashboard/general.js
index 6dbdd14011..e14cceefa3 100644
--- a/src/controllers/dashboard/general.js
+++ b/src/controllers/dashboard/general.js
@@ -55,8 +55,8 @@ import alert from '../../components/alert';
const brandingConfigKey = 'branding';
export default function (view) {
$('#btnSelectCachePath', view).on('click.selectDirectory', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
callback: function (path) {
if (path) {
@@ -72,8 +72,8 @@ import alert from '../../components/alert';
});
});
$('#btnSelectMetadataPath', view).on('click.selectDirectory', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
path: $('#txtMetadataPath', view).val(),
networkSharePath: $('#txtMetadataNetworkPath', view).val(),
diff --git a/src/controllers/dashboard/networking.js b/src/controllers/dashboard/networking.js
index 5cfab50938..61ce04ad0b 100644
--- a/src/controllers/dashboard/networking.js
+++ b/src/controllers/dashboard/networking.js
@@ -181,8 +181,8 @@ import alert from '../../components/alert';
}
});
view.querySelector('#btnSelectCertPath').addEventListener('click', function () {
- import('../../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
includeDirectories: true,
diff --git a/src/controllers/livetvsettings.js b/src/controllers/livetvsettings.js
index 4bc7d11283..abaa1c0a37 100644
--- a/src/controllers/livetvsettings.js
+++ b/src/controllers/livetvsettings.js
@@ -60,8 +60,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
const page = this;
$('.liveTvSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
$('#btnSelectRecordingPath', page).on('click.selectDirectory', function () {
- import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
callback: function (path) {
if (path) {
@@ -75,8 +75,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
});
});
$('#btnSelectMovieRecordingPath', page).on('click.selectDirectory', function () {
- import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
callback: function (path) {
if (path) {
@@ -90,8 +90,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
});
});
$('#btnSelectSeriesRecordingPath', page).on('click.selectDirectory', function () {
- import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
callback: function (path) {
if (path) {
@@ -105,8 +105,8 @@ $(document).on('pageinit', '#liveTvSettingsPage', function () {
});
});
$('#btnSelectPostProcessorPath', page).on('click.selectDirectory', function () {
- import('../components/directorybrowser/directorybrowser').then(({default: directoryBrowser}) => {
- const picker = new directoryBrowser();
+ import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
diff --git a/src/controllers/livetvtuner.js b/src/controllers/livetvtuner.js
index 261fbae345..4d2ecb738e 100644
--- a/src/controllers/livetvtuner.js
+++ b/src/controllers/livetvtuner.js
@@ -212,8 +212,8 @@ export default function (view, params) {
});
});
view.querySelector('.btnSelectPath').addEventListener('click', function () {
- import('../components/directorybrowser/directorybrowser').then(({default: directorybrowser}) => {
- const picker = new directorybrowser();
+ import('../components/directorybrowser/directorybrowser').then(({default: DirectoryBrowser}) => {
+ const picker = new DirectoryBrowser();
picker.show({
includeFiles: true,
callback: function (path) {
diff --git a/src/scripts/clientUtils.js b/src/scripts/clientUtils.js
index 042be403bb..b7e41a48dc 100644
--- a/src/scripts/clientUtils.js
+++ b/src/scripts/clientUtils.js
@@ -6,6 +6,10 @@ import baseAlert from '../components/alert';
import baseConfirm from '../components/confirm/confirm';
import globalize from '../scripts/globalize';
import * as webSettings from './settings/webSettings';
+import datetime from '../scripts/datetime';
+import DirectoryBrowser from '../components/directorybrowser/directorybrowser';
+import dialogHelper from '../components/dialogHelper/dialogHelper';
+import itemIdentifier from '../components/itemidentifier/itemidentifier';
export function getCurrentUser() {
return window.ApiClient.getCurrentUser(false);
@@ -94,6 +98,12 @@ export function getPluginUrl(name) {
return 'configurationpage?name=' + encodeURIComponent(name);
}
+export function getConfigurationResourceUrl(name) {
+ return ApiClient.getUrl('web/ConfigurationPage', {
+ name: name
+ });
+}
+
export function navigate(url, preserveQueryString) {
if (!url) {
throw new Error('url cannot be null or empty');
@@ -204,6 +214,7 @@ const Dashboard = {
capabilities,
confirm,
getPluginUrl,
+ getConfigurationResourceUrl,
getCurrentUser,
getCurrentUserId,
hideLoadingMsg,
@@ -215,7 +226,11 @@ const Dashboard = {
processServerConfigurationUpdateResult,
selectServer,
serverAddress,
- showLoadingMsg
+ showLoadingMsg,
+ datetime,
+ DirectoryBrowser,
+ dialogHelper,
+ itemIdentifier
};
// This is used in plugins and templates, so keep it defined for now.
diff --git a/src/scripts/serverNotifications.js b/src/scripts/serverNotifications.js
index c7fda8a12e..e4395c9c29 100644
--- a/src/scripts/serverNotifications.js
+++ b/src/scripts/serverNotifications.js
@@ -211,4 +211,6 @@ Events.on(ServerConnections, 'apiclientcreated', function (e, newApiClient) {
bindEvents(newApiClient);
});
+window.ServerNotifications = serverNotifications;
+
export default serverNotifications;
diff --git a/src/scripts/site.js b/src/scripts/site.js
index c30311cf82..232f29a167 100644
--- a/src/scripts/site.js
+++ b/src/scripts/site.js
@@ -37,6 +37,7 @@ import SyncPlayNoActivePlayer from '../components/syncPlay/ui/players/NoActivePl
import SyncPlayHtmlVideoPlayer from '../components/syncPlay/ui/players/HtmlVideoPlayer';
import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudioPlayer';
import { currentSettings } from './settings/userSettings';
+import taskButton from '../scripts/taskbutton';
// TODO: Move this elsewhere
window.getWindowLocationSearch = function(win) {
@@ -83,6 +84,10 @@ function loadCoreDictionary() {
}
function init() {
+ // This is used in plugins
+ window.Events = Events;
+ window.TaskButton = taskButton;
+
serverAddress().then(server => {
if (server) {
ServerConnections.initApiClient(server);
diff --git a/src/scripts/taskbutton.js b/src/scripts/taskbutton.js
index bd08463e0d..7e80760898 100644
--- a/src/scripts/taskbutton.js
+++ b/src/scripts/taskbutton.js
@@ -5,7 +5,7 @@ import globalize from '../scripts/globalize';
import '../elements/emby-button/emby-button';
import ServerConnections from '../components/ServerConnections';
-export default function (options) {
+function taskbutton(options) {
function pollTasks() {
ServerConnections.getApiClient(serverId).getScheduledTasks({
IsEnabled: true
@@ -120,3 +120,5 @@ export default function (options) {
Events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
}
}
+
+export default taskbutton;