mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
34 lines
890 B
TypeScript
34 lines
890 B
TypeScript
import { CE } from "@utils/html";
|
|
import { onChangeVideoPlayerType } from "../stream/stream-settings-utils";
|
|
import { StreamSettings } from "../stream/stream-settings";
|
|
|
|
|
|
export function localRedirect(path: string) {
|
|
const url = window.location.href.substring(0, 31) + path;
|
|
|
|
const $pageContent = document.getElementById('PageContent');
|
|
if (!$pageContent) {
|
|
return;
|
|
}
|
|
|
|
const $anchor = CE<HTMLAnchorElement>('a', {
|
|
href: url,
|
|
class: 'bx-hidden bx-offscreen'
|
|
}, '');
|
|
$anchor.addEventListener('click', e => {
|
|
// Remove element after clicking on it
|
|
window.setTimeout(() => {
|
|
$pageContent.removeChild($anchor);
|
|
}, 1000);
|
|
});
|
|
|
|
$pageContent.appendChild($anchor);
|
|
$anchor.click();
|
|
}
|
|
|
|
|
|
export function setupStreamUi() {
|
|
StreamSettings.getInstance();
|
|
onChangeVideoPlayerType();
|
|
}
|