mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-25 17:03:03 +02:00
Update dists
This commit is contained in:
parent
222ad1c34e
commit
c89ebb78a4
28
dist/better-xcloud.lite.user.js
vendored
28
dist/better-xcloud.lite.user.js
vendored
@ -206,9 +206,12 @@ function createButton(options) {
|
|||||||
if (options.url) $btn = CE("a", { class: "bx-button" }), $btn.href = options.url, $btn.target = "_blank";
|
if (options.url) $btn = CE("a", { class: "bx-button" }), $btn.href = options.url, $btn.target = "_blank";
|
||||||
else $btn = CE("button", { class: "bx-button", type: "button" });
|
else $btn = CE("button", { class: "bx-button", type: "button" });
|
||||||
let style = options.style || 0;
|
let style = options.style || 0;
|
||||||
style && ButtonStyleIndices.forEach((index) => {
|
if (style) {
|
||||||
style & index && $btn.classList.add(ButtonStyleClass[index]);
|
let index;
|
||||||
}), options.classes && $btn.classList.add(...options.classes), options.icon && $btn.appendChild(createSvgIcon(options.icon)), options.label && $btn.appendChild(CE("span", {}, options.label)), options.title && $btn.setAttribute("title", options.title), options.disabled && ($btn.disabled = !0), options.onClick && $btn.addEventListener("click", options.onClick), $btn.tabIndex = typeof options.tabIndex === "number" ? options.tabIndex : 0;
|
for (index of ButtonStyleIndices)
|
||||||
|
style & index && $btn.classList.add(ButtonStyleClass[index]);
|
||||||
|
}
|
||||||
|
options.classes && $btn.classList.add(...options.classes), options.icon && $btn.appendChild(createSvgIcon(options.icon)), options.label && $btn.appendChild(CE("span", {}, options.label)), options.title && $btn.setAttribute("title", options.title), options.disabled && ($btn.disabled = !0), options.onClick && $btn.addEventListener("click", options.onClick), $btn.tabIndex = typeof options.tabIndex === "number" ? options.tabIndex : 0;
|
||||||
for (let key in options.attributes)
|
for (let key in options.attributes)
|
||||||
if (!$btn.hasOwnProperty(key)) $btn.setAttribute(key, options.attributes[key]);
|
if (!$btn.hasOwnProperty(key)) $btn.setAttribute(key, options.attributes[key]);
|
||||||
return $btn;
|
return $btn;
|
||||||
@ -2871,7 +2874,8 @@ class NavigationDialogManager {
|
|||||||
}).observe(this.$container, { childList: !0 });
|
}).observe(this.$container, { childList: !0 });
|
||||||
}
|
}
|
||||||
calculateSelectBoxes($root) {
|
calculateSelectBoxes($root) {
|
||||||
$root.querySelectorAll(".bx-select:not([data-calculated]) select").forEach(($select) => {
|
let selects = Array.from($root.querySelectorAll(".bx-select:not([data-calculated]) select"));
|
||||||
|
for (let $select of selects) {
|
||||||
let $parent = $select.parentElement;
|
let $parent = $select.parentElement;
|
||||||
if ($parent.classList.contains("bx-full-width")) {
|
if ($parent.classList.contains("bx-full-width")) {
|
||||||
$parent.dataset.calculated = "true";
|
$parent.dataset.calculated = "true";
|
||||||
@ -2882,7 +2886,7 @@ class NavigationDialogManager {
|
|||||||
if ($select.multiple) $label = $parent.querySelector(".bx-select-value"), width += 20;
|
if ($select.multiple) $label = $parent.querySelector(".bx-select-value"), width += 20;
|
||||||
else $label = $parent.querySelector("div");
|
else $label = $parent.querySelector("div");
|
||||||
$label.style.minWidth = width + "px", $parent.dataset.calculated = "true";
|
$label.style.minWidth = width + "px", $parent.dataset.calculated = "true";
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
@ -4958,13 +4962,14 @@ class StreamBadges {
|
|||||||
this.serverInfo.video ? this.badges.video.$element : ["video", "?"],
|
this.serverInfo.video ? this.badges.video.$element : ["video", "?"],
|
||||||
this.serverInfo.audio ? this.badges.audio.$element : ["audio", "?"]
|
this.serverInfo.audio ? this.badges.audio.$element : ["audio", "?"]
|
||||||
], $container = CE("div", { class: "bx-badges" });
|
], $container = CE("div", { class: "bx-badges" });
|
||||||
return BADGES.forEach((item) => {
|
for (let item of BADGES) {
|
||||||
if (!item) return;
|
if (!item) continue;
|
||||||
let $badge;
|
let $badge;
|
||||||
if (!(item instanceof HTMLElement)) $badge = this.renderBadge(...item);
|
if (!(item instanceof HTMLElement)) $badge = this.renderBadge(...item);
|
||||||
else $badge = item;
|
else $badge = item;
|
||||||
$container.appendChild($badge);
|
$container.appendChild($badge);
|
||||||
}), this.$container = $container, await this.start(), $container;
|
}
|
||||||
|
return this.$container = $container, await this.start(), $container;
|
||||||
}
|
}
|
||||||
async getServerStats() {
|
async getServerStats() {
|
||||||
let stats = await STATES.currentStream.peerConnection.getStats(), allVideoCodecs = {}, videoCodecId, videoWidth = 0, videoHeight = 0, allAudioCodecs = {}, audioCodecId, allCandidates = {}, candidateId;
|
let stats = await STATES.currentStream.peerConnection.getStats(), allVideoCodecs = {}, videoCodecId, videoWidth = 0, videoHeight = 0, allAudioCodecs = {}, audioCodecId, allCandidates = {}, candidateId;
|
||||||
@ -5821,8 +5826,9 @@ class StreamUiHandler {
|
|||||||
let $screen = document.querySelector("#PageContent section[class*=PureScreens]");
|
let $screen = document.querySelector("#PageContent section[class*=PureScreens]");
|
||||||
if (!$screen) return;
|
if (!$screen) return;
|
||||||
let observer = new MutationObserver((mutationList) => {
|
let observer = new MutationObserver((mutationList) => {
|
||||||
mutationList.forEach((item) => {
|
let item;
|
||||||
if (item.type !== "childList") return;
|
for (item of mutationList) {
|
||||||
|
if (item.type !== "childList") continue;
|
||||||
item.addedNodes.forEach(async ($node) => {
|
item.addedNodes.forEach(async ($node) => {
|
||||||
if (!$node || $node.nodeType !== Node.ELEMENT_NODE) return;
|
if (!$node || $node.nodeType !== Node.ELEMENT_NODE) return;
|
||||||
let $elm = $node;
|
let $elm = $node;
|
||||||
@ -5840,7 +5846,7 @@ class StreamUiHandler {
|
|||||||
if (!$elm || ($elm.id || "") !== "StreamHud") return;
|
if (!$elm || ($elm.id || "") !== "StreamHud") return;
|
||||||
StreamUiHandler.handleSystemMenu($elm);
|
StreamUiHandler.handleSystemMenu($elm);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
observer.observe($screen, { subtree: !0, childList: !0 }), StreamUiHandler.observer = observer;
|
observer.observe($screen, { subtree: !0, childList: !0 }), StreamUiHandler.observer = observer;
|
||||||
}
|
}
|
||||||
|
49
dist/better-xcloud.user.js
vendored
49
dist/better-xcloud.user.js
vendored
@ -208,9 +208,12 @@ function createButton(options) {
|
|||||||
if (options.url) $btn = CE("a", { class: "bx-button" }), $btn.href = options.url, $btn.target = "_blank";
|
if (options.url) $btn = CE("a", { class: "bx-button" }), $btn.href = options.url, $btn.target = "_blank";
|
||||||
else $btn = CE("button", { class: "bx-button", type: "button" });
|
else $btn = CE("button", { class: "bx-button", type: "button" });
|
||||||
let style = options.style || 0;
|
let style = options.style || 0;
|
||||||
style && ButtonStyleIndices.forEach((index) => {
|
if (style) {
|
||||||
style & index && $btn.classList.add(ButtonStyleClass[index]);
|
let index;
|
||||||
}), options.classes && $btn.classList.add(...options.classes), options.icon && $btn.appendChild(createSvgIcon(options.icon)), options.label && $btn.appendChild(CE("span", {}, options.label)), options.title && $btn.setAttribute("title", options.title), options.disabled && ($btn.disabled = !0), options.onClick && $btn.addEventListener("click", options.onClick), $btn.tabIndex = typeof options.tabIndex === "number" ? options.tabIndex : 0;
|
for (index of ButtonStyleIndices)
|
||||||
|
style & index && $btn.classList.add(ButtonStyleClass[index]);
|
||||||
|
}
|
||||||
|
options.classes && $btn.classList.add(...options.classes), options.icon && $btn.appendChild(createSvgIcon(options.icon)), options.label && $btn.appendChild(CE("span", {}, options.label)), options.title && $btn.setAttribute("title", options.title), options.disabled && ($btn.disabled = !0), options.onClick && $btn.addEventListener("click", options.onClick), $btn.tabIndex = typeof options.tabIndex === "number" ? options.tabIndex : 0;
|
||||||
for (let key in options.attributes)
|
for (let key in options.attributes)
|
||||||
if (!$btn.hasOwnProperty(key)) $btn.setAttribute(key, options.attributes[key]);
|
if (!$btn.hasOwnProperty(key)) $btn.setAttribute(key, options.attributes[key]);
|
||||||
return $btn;
|
return $btn;
|
||||||
@ -3152,7 +3155,8 @@ class NavigationDialogManager {
|
|||||||
}).observe(this.$container, { childList: !0 });
|
}).observe(this.$container, { childList: !0 });
|
||||||
}
|
}
|
||||||
calculateSelectBoxes($root) {
|
calculateSelectBoxes($root) {
|
||||||
$root.querySelectorAll(".bx-select:not([data-calculated]) select").forEach(($select) => {
|
let selects = Array.from($root.querySelectorAll(".bx-select:not([data-calculated]) select"));
|
||||||
|
for (let $select of selects) {
|
||||||
let $parent = $select.parentElement;
|
let $parent = $select.parentElement;
|
||||||
if ($parent.classList.contains("bx-full-width")) {
|
if ($parent.classList.contains("bx-full-width")) {
|
||||||
$parent.dataset.calculated = "true";
|
$parent.dataset.calculated = "true";
|
||||||
@ -3163,7 +3167,7 @@ class NavigationDialogManager {
|
|||||||
if ($select.multiple) $label = $parent.querySelector(".bx-select-value"), width += 20;
|
if ($select.multiple) $label = $parent.querySelector(".bx-select-value"), width += 20;
|
||||||
else $label = $parent.querySelector("div");
|
else $label = $parent.querySelector("div");
|
||||||
$label.style.minWidth = width + "px", $parent.dataset.calculated = "true";
|
$label.style.minWidth = width + "px", $parent.dataset.calculated = "true";
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
handleEvent(event) {
|
handleEvent(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
@ -4319,10 +4323,10 @@ true` + text;
|
|||||||
"native-mkb": "8fa264dd-124f-4af3-97e8-596fcdf4b486",
|
"native-mkb": "8fa264dd-124f-4af3-97e8-596fcdf4b486",
|
||||||
"most-popular": "e7590b22-e299-44db-ae22-25c61405454c"
|
"most-popular": "e7590b22-e299-44db-ae22-25c61405454c"
|
||||||
};
|
};
|
||||||
PREF_HIDE_SECTIONS.forEach((section) => {
|
for (let section of PREF_HIDE_SECTIONS) {
|
||||||
let galleryId = sections[section];
|
let galleryId = sections[section];
|
||||||
galleryId && siglIds.push(galleryId);
|
galleryId && siglIds.push(galleryId);
|
||||||
});
|
}
|
||||||
let newCode = `
|
let newCode = `
|
||||||
if (e && e.id) {
|
if (e && e.id) {
|
||||||
const siglId = e.id;
|
const siglId = e.id;
|
||||||
@ -4383,11 +4387,6 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
let index = str.indexOf('"ContextualCardActions-module__container');
|
let index = str.indexOf('"ContextualCardActions-module__container');
|
||||||
if (index >= 0 && (index = str.indexOf('addEventListener("touchstart"', index)), index >= 0 && (index = PatcherUtils.lastIndexOf(str, "return ", index, 50)), index < 0) return !1;
|
if (index >= 0 && (index = str.indexOf('addEventListener("touchstart"', index)), index >= 0 && (index = PatcherUtils.lastIndexOf(str, "return ", index, 50)), index < 0) return !1;
|
||||||
return str = PatcherUtils.replaceWith(str, index, "return", "return () => {};"), str;
|
return str = PatcherUtils.replaceWith(str, index, "return", "return () => {};"), str;
|
||||||
},
|
|
||||||
disableSendMetadata(str) {
|
|
||||||
let text = "this.sendMetadata(),this.isStreamActive()";
|
|
||||||
if (!str.includes(text)) return !1;
|
|
||||||
return str = str.replaceAll(text, "true; return;" + text), str;
|
|
||||||
}
|
}
|
||||||
}, PATCH_ORDERS = [
|
}, PATCH_ORDERS = [
|
||||||
...getPref("native_mkb_enabled") === "on" ? [
|
...getPref("native_mkb_enabled") === "on" ? [
|
||||||
@ -4443,9 +4442,6 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
|
|||||||
"patchStreamHud",
|
"patchStreamHud",
|
||||||
"playVibration",
|
"playVibration",
|
||||||
"alwaysShowStreamHud",
|
"alwaysShowStreamHud",
|
||||||
...getPref("block_tracking") ? [
|
|
||||||
"disableSendMetadata"
|
|
||||||
] : [],
|
|
||||||
getPref("audio_enable_volume_control") && !getPref("stream_combine_sources") && "patchAudioMediaStream",
|
getPref("audio_enable_volume_control") && !getPref("stream_combine_sources") && "patchAudioMediaStream",
|
||||||
getPref("audio_enable_volume_control") && getPref("stream_combine_sources") && "patchCombinedAudioVideoMediaStream",
|
getPref("audio_enable_volume_control") && getPref("stream_combine_sources") && "patchCombinedAudioVideoMediaStream",
|
||||||
getPref("stream_disable_feedback_dialog") && "skipFeedbackDialog",
|
getPref("stream_disable_feedback_dialog") && "skipFeedbackDialog",
|
||||||
@ -5546,12 +5542,12 @@ class ControllerShortcut {
|
|||||||
let gamepadIndex = gamepad.index, actions = ControllerShortcut.ACTIONS[gamepad.id];
|
let gamepadIndex = gamepad.index, actions = ControllerShortcut.ACTIONS[gamepad.id];
|
||||||
if (!actions) return !1;
|
if (!actions) return !1;
|
||||||
ControllerShortcut.buttonsCache[gamepadIndex] = ControllerShortcut.buttonsStatus[gamepadIndex].slice(0), ControllerShortcut.buttonsStatus[gamepadIndex] = [];
|
ControllerShortcut.buttonsCache[gamepadIndex] = ControllerShortcut.buttonsStatus[gamepadIndex].slice(0), ControllerShortcut.buttonsStatus[gamepadIndex] = [];
|
||||||
let pressed = [], otherButtonPressed = !1;
|
let pressed = [], otherButtonPressed = !1, entries = gamepad.buttons.entries();
|
||||||
return gamepad.buttons.forEach((button, index) => {
|
for (let [index, button] of entries)
|
||||||
if (button.pressed && index !== 16) {
|
if (button.pressed && index !== 16) {
|
||||||
if (otherButtonPressed = !0, pressed[index] = !0, actions[index] && !ControllerShortcut.buttonsCache[gamepadIndex][index]) setTimeout(() => ControllerShortcut.runAction(actions[index]), 0);
|
if (otherButtonPressed = !0, pressed[index] = !0, actions[index] && !ControllerShortcut.buttonsCache[gamepadIndex][index]) setTimeout(() => ControllerShortcut.runAction(actions[index]), 0);
|
||||||
}
|
}
|
||||||
}), ControllerShortcut.buttonsStatus[gamepadIndex] = pressed, otherButtonPressed;
|
return ControllerShortcut.buttonsStatus[gamepadIndex] = pressed, otherButtonPressed;
|
||||||
}
|
}
|
||||||
static runAction(action) {
|
static runAction(action) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
@ -6543,13 +6539,14 @@ class StreamBadges {
|
|||||||
this.serverInfo.video ? this.badges.video.$element : ["video", "?"],
|
this.serverInfo.video ? this.badges.video.$element : ["video", "?"],
|
||||||
this.serverInfo.audio ? this.badges.audio.$element : ["audio", "?"]
|
this.serverInfo.audio ? this.badges.audio.$element : ["audio", "?"]
|
||||||
], $container = CE("div", { class: "bx-badges" });
|
], $container = CE("div", { class: "bx-badges" });
|
||||||
return BADGES.forEach((item2) => {
|
for (let item2 of BADGES) {
|
||||||
if (!item2) return;
|
if (!item2) continue;
|
||||||
let $badge;
|
let $badge;
|
||||||
if (!(item2 instanceof HTMLElement)) $badge = this.renderBadge(...item2);
|
if (!(item2 instanceof HTMLElement)) $badge = this.renderBadge(...item2);
|
||||||
else $badge = item2;
|
else $badge = item2;
|
||||||
$container.appendChild($badge);
|
$container.appendChild($badge);
|
||||||
}), this.$container = $container, await this.start(), $container;
|
}
|
||||||
|
return this.$container = $container, await this.start(), $container;
|
||||||
}
|
}
|
||||||
async getServerStats() {
|
async getServerStats() {
|
||||||
let stats = await STATES.currentStream.peerConnection.getStats(), allVideoCodecs = {}, videoCodecId, videoWidth = 0, videoHeight = 0, allAudioCodecs = {}, audioCodecId, allCandidates = {}, candidateId;
|
let stats = await STATES.currentStream.peerConnection.getStats(), allVideoCodecs = {}, videoCodecId, videoWidth = 0, videoHeight = 0, allAudioCodecs = {}, audioCodecId, allCandidates = {}, candidateId;
|
||||||
@ -7553,7 +7550,8 @@ class GameBar {
|
|||||||
this.clearHideTimeout(), this.$container.classList.replace("bx-show", "bx-hide");
|
this.clearHideTimeout(), this.$container.classList.replace("bx-show", "bx-hide");
|
||||||
}
|
}
|
||||||
reset() {
|
reset() {
|
||||||
this.actions.forEach((action) => action.reset());
|
for (let action of this.actions)
|
||||||
|
action.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class XcloudApi {
|
class XcloudApi {
|
||||||
@ -7771,8 +7769,9 @@ class StreamUiHandler {
|
|||||||
let $screen = document.querySelector("#PageContent section[class*=PureScreens]");
|
let $screen = document.querySelector("#PageContent section[class*=PureScreens]");
|
||||||
if (!$screen) return;
|
if (!$screen) return;
|
||||||
let observer = new MutationObserver((mutationList) => {
|
let observer = new MutationObserver((mutationList) => {
|
||||||
mutationList.forEach((item2) => {
|
let item2;
|
||||||
if (item2.type !== "childList") return;
|
for (item2 of mutationList) {
|
||||||
|
if (item2.type !== "childList") continue;
|
||||||
item2.addedNodes.forEach(async ($node) => {
|
item2.addedNodes.forEach(async ($node) => {
|
||||||
if (!$node || $node.nodeType !== Node.ELEMENT_NODE) return;
|
if (!$node || $node.nodeType !== Node.ELEMENT_NODE) return;
|
||||||
let $elm = $node;
|
let $elm = $node;
|
||||||
@ -7790,7 +7789,7 @@ class StreamUiHandler {
|
|||||||
if (!$elm || ($elm.id || "") !== "StreamHud") return;
|
if (!$elm || ($elm.id || "") !== "StreamHud") return;
|
||||||
StreamUiHandler.handleSystemMenu($elm);
|
StreamUiHandler.handleSystemMenu($elm);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
observer.observe($screen, { subtree: !0, childList: !0 }), StreamUiHandler.observer = observer;
|
observer.observe($screen, { subtree: !0, childList: !0 }), StreamUiHandler.observer = observer;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user