diff --git a/.eslintrc.js b/.eslintrc.js index a7ee00886..aabfd633f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -78,7 +78,6 @@ module.exports = { // Dependency globals '$': 'readonly', 'jQuery': 'readonly', - 'requirejs': 'readonly', // Jellyfin globals 'ApiClient': 'writable', 'chrome': 'writable', diff --git a/src/components/pluginManager.js b/src/components/pluginManager.js index 66d7fcd65..9f6a054b3 100644 --- a/src/components/pluginManager.js +++ b/src/components/pluginManager.js @@ -70,14 +70,6 @@ import globalize from '../scripts/globalize'; const separatorIndex = Math.max(pluginSpec.lastIndexOf('/'), pluginSpec.lastIndexOf('\\')); plugin.baseUrl = pluginSpec.substring(0, separatorIndex); - const paths = {}; - paths[plugin.id] = plugin.baseUrl; - - requirejs.config({ - waitSeconds: 0, - paths: paths - }); - this.#registerPlugin(plugin).then(Promise.resolve).catch(Promise.reject); }); } else if (pluginSpec.then) { @@ -87,7 +79,7 @@ import globalize from '../scripts/globalize'; return this.#registerPlugin(plugin); }); } else { - const err = new TypeError('Plugins have to be a Promise that resolves to a plugin builder function or a RequireJS url (deprecated)'); + const err = new TypeError('Plugins have to be a Promise that resolves to a plugin builder function'); console.error(err); return Promise.reject(err); } diff --git a/src/components/require/requirecss.js b/src/components/require/requirecss.js deleted file mode 100644 index ca6910e31..000000000 --- a/src/components/require/requirecss.js +++ /dev/null @@ -1,72 +0,0 @@ -define(function () { - 'use strict'; - - const requireCss = {}; - - requireCss.normalize = function (name, normalize) { - if (name.substr(name.length - 4, 4) === '.css') { - name = name.substr(0, name.length - 4); - } - - return normalize(name); - }; - - let importedCss = []; - - function isLoaded(url) { - return importedCss.indexOf(url) !== -1; - } - - function removeFromLoadHistory(url) { - url = url.toLowerCase(); - - importedCss = importedCss.filter(function (c) { - return url.indexOf(c.toLowerCase()) === -1; - }); - } - - requireCss.load = function (cssId, req, load, config) { - // Somehow if the url starts with /css, require will get all screwed up since this extension is also called css - const srch = 'components/require/requirecss'; - const index = cssId.indexOf(srch); - - if (index !== -1) { - cssId = 'css' + cssId.substring(index + srch.length); - } - - let url = cssId + '.css'; - - if (url.indexOf('://') === -1) { - url = config.baseUrl + url; - } - - if (!isLoaded(url)) { - importedCss.push(url); - - const link = document.createElement('link'); - - link.setAttribute('rel', 'stylesheet'); - link.setAttribute('type', 'text/css'); - link.onload = load; - - let linkUrl = url; - - if (config.urlArgs) { - linkUrl += config.urlArgs(cssId, url); - } - link.setAttribute('href', linkUrl); - document.head.appendChild(link); - } else { - load(); - } - }; - - window.requireCss = { - removeStylesheet: function (stylesheet) { - stylesheet.parentNode.removeChild(stylesheet); - removeFromLoadHistory(stylesheet.href); - } - }; - - return requireCss; -}); diff --git a/src/components/require/requiretext.js b/src/components/require/requiretext.js deleted file mode 100644 index 12822a29e..000000000 --- a/src/components/require/requiretext.js +++ /dev/null @@ -1,42 +0,0 @@ -define(function () { - 'use strict'; - - // hack to work around the server's auto-redirection feature - const addRedirectPrevention = window.dashboardVersion != null && window.Dashboard && !window.AppInfo.isNativeApp; - - return { - - load: function (url, req, load, config) { - if (url.indexOf('://') === -1) { - url = config.baseUrl + url; - } - - if (config.urlArgs) { - url += config.urlArgs(url, url); - } - - if (addRedirectPrevention) { - if (url.indexOf('?') === -1) { - url += '?'; - } else { - url += '&'; - } - - url += 'r=0'; - } - - const xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - - xhr.onload = function (e) { - load(this.response); - }; - - xhr.send(); - }, - - normalize: function (name, normalize) { - return normalize(name); - } - }; -});