mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove getParameterByName global
This commit is contained in:
parent
8e66ba315a
commit
67169e2a6a
12 changed files with 23 additions and 15 deletions
|
@ -193,7 +193,6 @@ module.exports = {
|
||||||
'DlnaProfilePage': 'writable',
|
'DlnaProfilePage': 'writable',
|
||||||
'DashboardPage': 'writable',
|
'DashboardPage': 'writable',
|
||||||
'Emby': 'readonly',
|
'Emby': 'readonly',
|
||||||
'getParameterByName': 'writable',
|
|
||||||
'Globalize': 'writable',
|
'Globalize': 'writable',
|
||||||
'Hls': 'writable',
|
'Hls': 'writable',
|
||||||
'dfnshelper': 'writable',
|
'dfnshelper': 'writable',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { appHost } from './apphost';
|
||||||
import imageLoader from './images/imageLoader';
|
import imageLoader from './images/imageLoader';
|
||||||
import globalize from '../scripts/globalize';
|
import globalize from '../scripts/globalize';
|
||||||
import layoutManager from './layoutManager';
|
import layoutManager from './layoutManager';
|
||||||
|
import { getParameterByName } from '../utils/url.ts';
|
||||||
import '../assets/css/scrollstyles.scss';
|
import '../assets/css/scrollstyles.scss';
|
||||||
import '../elements/emby-itemscontainer/emby-itemscontainer';
|
import '../elements/emby-itemscontainer/emby-itemscontainer';
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import dom from '../../../scripts/dom';
|
||||||
import '../../../elements/emby-input/emby-input';
|
import '../../../elements/emby-input/emby-input';
|
||||||
import '../../../elements/emby-button/emby-button';
|
import '../../../elements/emby-button/emby-button';
|
||||||
import Dashboard from '../../../scripts/clientUtils';
|
import Dashboard from '../../../scripts/clientUtils';
|
||||||
|
import { getParameterByName } from '../../../utils/url.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import '../../../elements/emby-checkbox/emby-checkbox';
|
||||||
import '../../../components/listview/listview.scss';
|
import '../../../components/listview/listview.scss';
|
||||||
import Dashboard from '../../../scripts/clientUtils';
|
import Dashboard from '../../../scripts/clientUtils';
|
||||||
import toast from '../../../components/toast/toast';
|
import toast from '../../../components/toast/toast';
|
||||||
|
import { getParameterByName } from '../../../utils/url.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import escapeHtml from 'escape-html';
|
||||||
import 'jquery';
|
import 'jquery';
|
||||||
import '../../../../elements/emby-checkbox/emby-checkbox';
|
import '../../../../elements/emby-checkbox/emby-checkbox';
|
||||||
import Dashboard from '../../../../scripts/clientUtils';
|
import Dashboard from '../../../../scripts/clientUtils';
|
||||||
|
import { getParameterByName } from '../../../../utils/url.ts';
|
||||||
|
|
||||||
function fillItems(elem, items, cssClass, idPrefix, currentList, isEnabledList) {
|
function fillItems(elem, items, cssClass, idPrefix, currentList, isEnabledList) {
|
||||||
let html = '<div class="checkboxList paperList" style="padding: .5em 1em;">';
|
let html = '<div class="checkboxList paperList" style="padding: .5em 1em;">';
|
||||||
|
|
|
@ -7,6 +7,7 @@ import '../../../elements/emby-input/emby-input';
|
||||||
import '../../../elements/emby-button/emby-button';
|
import '../../../elements/emby-button/emby-button';
|
||||||
import '../../../elements/emby-select/emby-select';
|
import '../../../elements/emby-select/emby-select';
|
||||||
import confirm from '../../../components/confirm/confirm';
|
import confirm from '../../../components/confirm/confirm';
|
||||||
|
import { getParameterByName } from '../../../utils/url.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Events } from 'jellyfin-apiclient';
|
||||||
import loading from '../components/loading/loading';
|
import loading from '../components/loading/loading';
|
||||||
import globalize from '../scripts/globalize';
|
import globalize from '../scripts/globalize';
|
||||||
import Dashboard, { pageIdOn } from '../scripts/clientUtils';
|
import Dashboard, { pageIdOn } from '../scripts/clientUtils';
|
||||||
|
import { getParameterByName } from '../utils/url.ts';
|
||||||
|
|
||||||
function onListingsSubmitted() {
|
function onListingsSubmitted() {
|
||||||
Dashboard.navigate('livetvstatus.html');
|
Dashboard.navigate('livetvstatus.html');
|
||||||
|
|
|
@ -6,6 +6,7 @@ import '../elements/emby-button/emby-button';
|
||||||
import '../elements/emby-checkbox/emby-checkbox';
|
import '../elements/emby-checkbox/emby-checkbox';
|
||||||
import '../elements/emby-select/emby-select';
|
import '../elements/emby-select/emby-select';
|
||||||
import Dashboard from '../scripts/clientUtils';
|
import Dashboard from '../scripts/clientUtils';
|
||||||
|
import { getParameterByName } from '../utils/url.ts';
|
||||||
|
|
||||||
function isM3uVariant(type) {
|
function isM3uVariant(type) {
|
||||||
return ['nextpvr'].indexOf(type || '') !== -1;
|
return ['nextpvr'].indexOf(type || '') !== -1;
|
||||||
|
|
|
@ -3,6 +3,7 @@ import 'jquery';
|
||||||
import globalize from './globalize';
|
import globalize from './globalize';
|
||||||
import 'material-design-icons-iconfont';
|
import 'material-design-icons-iconfont';
|
||||||
import Dashboard from './clientUtils';
|
import Dashboard from './clientUtils';
|
||||||
|
import { getParameterByName } from '../utils/url.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import '../assets/css/flexstyles.scss';
|
||||||
import Dashboard, { pageClassOn } from './clientUtils';
|
import Dashboard, { pageClassOn } from './clientUtils';
|
||||||
import ServerConnections from '../components/ServerConnections';
|
import ServerConnections from '../components/ServerConnections';
|
||||||
import Headroom from 'headroom.js';
|
import Headroom from 'headroom.js';
|
||||||
|
import { getParameterByName } from '../utils/url.ts';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import './routes';
|
||||||
import '../components/themeMediaPlayer';
|
import '../components/themeMediaPlayer';
|
||||||
import './autoBackdrops';
|
import './autoBackdrops';
|
||||||
import { pageClassOn, serverAddress } from './clientUtils';
|
import { pageClassOn, serverAddress } from './clientUtils';
|
||||||
import { getWindowLocationSearch } from '../utils/url.ts';
|
|
||||||
import './screensavermanager';
|
import './screensavermanager';
|
||||||
import './serverNotifications';
|
import './serverNotifications';
|
||||||
import '../components/playback/playerSelectionMenu';
|
import '../components/playback/playerSelectionMenu';
|
||||||
|
@ -43,18 +42,6 @@ import { currentSettings } from './settings/userSettings';
|
||||||
import taskButton from './taskbutton';
|
import taskButton from './taskbutton';
|
||||||
|
|
||||||
// TODO: Move this elsewhere
|
// TODO: Move this elsewhere
|
||||||
window.getParameterByName = function(name, url) {
|
|
||||||
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
|
||||||
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
|
||||||
const regex = new RegExp(regexS, 'i');
|
|
||||||
const results = regex.exec(url || getWindowLocationSearch());
|
|
||||||
|
|
||||||
if (results == null) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return decodeURIComponent(results[1].replace(/\+/g, ' '));
|
|
||||||
};
|
|
||||||
|
|
||||||
function loadCoreDictionary() {
|
function loadCoreDictionary() {
|
||||||
const languages = ['af', 'ar', 'be-by', 'bg-bg', 'bn_bd', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'eo', 'es', 'es-419', 'es-ar', 'es_do', 'es-mx', 'fa', 'fi', 'fil', 'fr', 'fr-ca', 'gl', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'ja', 'kk', 'ko', 'lt-lt', 'mr', 'ms', 'nb', 'nl', 'pl', 'pr', 'pt', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sq', 'sv', 'ta', 'th', 'tr', 'uk', 'ur_pk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
const languages = ['af', 'ar', 'be-by', 'bg-bg', 'bn_bd', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'eo', 'es', 'es-419', 'es-ar', 'es_do', 'es-mx', 'fa', 'fi', 'fil', 'fr', 'fr-ca', 'gl', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'ja', 'kk', 'ko', 'lt-lt', 'mr', 'ms', 'nb', 'nl', 'pl', 'pr', 'pt', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sq', 'sv', 'ta', 'th', 'tr', 'uk', 'ur_pk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export const getWindowLocationSearch = (win: Window | null | undefined) => {
|
export const getWindowLocationSearch = (win?: Window | null | undefined) => {
|
||||||
let search = (win || window).location.search;
|
let search = (win || window).location.search;
|
||||||
|
|
||||||
if (!search) {
|
if (!search) {
|
||||||
|
@ -11,3 +11,16 @@ export const getWindowLocationSearch = (win: Window | null | undefined) => {
|
||||||
|
|
||||||
return search || '';
|
return search || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getParameterByName = (name: string, url?: string | null | undefined) => {
|
||||||
|
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
|
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||||
|
const regex = new RegExp(regexS, 'i');
|
||||||
|
const results = regex.exec(url || getWindowLocationSearch());
|
||||||
|
|
||||||
|
if (results == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue