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

removed any reference to requirejs

This commit is contained in:
vitorsemeano 2020-11-09 22:28:23 +00:00
parent f26dbd7b2c
commit 67adeef131
4 changed files with 1 additions and 124 deletions

View file

@ -78,7 +78,6 @@ module.exports = {
// Dependency globals
'$': 'readonly',
'jQuery': 'readonly',
'requirejs': 'readonly',
// Jellyfin globals
'ApiClient': 'writable',
'chrome': 'writable',

View file

@ -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);
}

View file

@ -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;
});

View file

@ -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);
}
};
});