mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Remove getWindowLocationSearch global and duplicate implementation
This commit is contained in:
parent
891c63a3da
commit
8e66ba315a
5 changed files with 16 additions and 29 deletions
|
@ -194,7 +194,6 @@ module.exports = {
|
||||||
'DashboardPage': 'writable',
|
'DashboardPage': 'writable',
|
||||||
'Emby': 'readonly',
|
'Emby': 'readonly',
|
||||||
'getParameterByName': 'writable',
|
'getParameterByName': 'writable',
|
||||||
'getWindowLocationSearch': 'writable',
|
|
||||||
'Globalize': 'writable',
|
'Globalize': 'writable',
|
||||||
'Hls': 'writable',
|
'Hls': 'writable',
|
||||||
'dfnshelper': 'writable',
|
'dfnshelper': 'writable',
|
||||||
|
|
|
@ -12,6 +12,7 @@ import Dashboard from '../scripts/clientUtils';
|
||||||
import ServerConnections from './ServerConnections';
|
import ServerConnections from './ServerConnections';
|
||||||
import alert from './alert';
|
import alert from './alert';
|
||||||
import reactControllerFactory from './reactControllerFactory';
|
import reactControllerFactory from './reactControllerFactory';
|
||||||
|
import { getWindowLocationSearch } from '../utils/url.ts';
|
||||||
|
|
||||||
class AppRouter {
|
class AppRouter {
|
||||||
allRoutes = [];
|
allRoutes = [];
|
||||||
|
@ -678,19 +679,6 @@ class AppRouter {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getWindowLocationSearch() {
|
|
||||||
const currentPath = this.currentRouteInfo ? (this.currentRouteInfo.path || '') : '';
|
|
||||||
|
|
||||||
const index = currentPath.indexOf('?');
|
|
||||||
let search = '';
|
|
||||||
|
|
||||||
if (index !== -1) {
|
|
||||||
search = currentPath.substring(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
return search || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
showGuide() {
|
showGuide() {
|
||||||
Dashboard.navigate('livetv.html?tab=1');
|
Dashboard.navigate('livetv.html?tab=1');
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import datetime from '../scripts/datetime';
|
||||||
import DirectoryBrowser from '../components/directorybrowser/directorybrowser';
|
import DirectoryBrowser from '../components/directorybrowser/directorybrowser';
|
||||||
import dialogHelper from '../components/dialogHelper/dialogHelper';
|
import dialogHelper from '../components/dialogHelper/dialogHelper';
|
||||||
import itemIdentifier from '../components/itemidentifier/itemidentifier';
|
import itemIdentifier from '../components/itemidentifier/itemidentifier';
|
||||||
|
import { getWindowLocationSearch } from '../utils/url.ts';
|
||||||
|
|
||||||
export function getCurrentUser() {
|
export function getCurrentUser() {
|
||||||
return window.ApiClient.getCurrentUser(false);
|
return window.ApiClient.getCurrentUser(false);
|
||||||
|
|
|
@ -26,6 +26,7 @@ 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';
|
||||||
|
@ -41,21 +42,6 @@ import SyncPlayHtmlAudioPlayer from '../components/syncPlay/ui/players/HtmlAudio
|
||||||
import { currentSettings } from './settings/userSettings';
|
import { currentSettings } from './settings/userSettings';
|
||||||
import taskButton from './taskbutton';
|
import taskButton from './taskbutton';
|
||||||
|
|
||||||
// TODO: Move this elsewhere
|
|
||||||
window.getWindowLocationSearch = function(win) {
|
|
||||||
let search = (win || window).location.search;
|
|
||||||
|
|
||||||
if (!search) {
|
|
||||||
const index = window.location.href.indexOf('?');
|
|
||||||
|
|
||||||
if (index != -1) {
|
|
||||||
search = window.location.href.substring(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return search || '';
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: Move this elsewhere
|
// TODO: Move this elsewhere
|
||||||
window.getParameterByName = function(name, url) {
|
window.getParameterByName = function(name, url) {
|
||||||
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
|
|
13
src/utils/url.ts
Normal file
13
src/utils/url.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
export const getWindowLocationSearch = (win: Window | null | undefined) => {
|
||||||
|
let search = (win || window).location.search;
|
||||||
|
|
||||||
|
if (!search) {
|
||||||
|
const index = window.location.href.indexOf('?');
|
||||||
|
|
||||||
|
if (index != -1) {
|
||||||
|
search = window.location.href.substring(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return search || '';
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue