From fca3bee6dd5a4322f27ea441f948f14cb8849d29 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Sat, 4 May 2024 16:20:38 +0700 Subject: [PATCH] Update dist --- dist/better-xcloud.user.js | 73 +++++++++++++------------------------- 1 file changed, 24 insertions(+), 49 deletions(-) diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 9b4da34..516b04e 100644 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -4994,6 +4994,9 @@ var new_default = "\n \n\n"; +// src/assets/svg/refresh.svg +var refresh_default = "\n \n\n"; + // src/assets/svg/remote-play.svg var remote_play_default = "\n \n\n"; @@ -5019,6 +5022,7 @@ var BxIcon = { TRASH: trash_default, CURSOR_TEXT: cursor_text_default, QUESTION: question_default, + REFRESH: refresh_default, REMOTE_PLAY: remote_play_default }; @@ -5482,7 +5486,7 @@ function injectStreamMenuButtons() { $btnClose && $btnClose.click(); return; } - if ($elm.className.startsWith("StreamMenu")) { + if ($elm.className.startsWith("StreamMenu-module__container")) { BxEvent.dispatch(window, BxEvent.STREAM_MENU_SHOWN); const $btnCloseHud = document.querySelector("button[class*=StreamMenu-module__backButton]"); if (!$btnCloseHud) { @@ -5491,10 +5495,17 @@ function injectStreamMenuButtons() { $btnCloseHud && $btnCloseHud.addEventListener("click", (e) => { $quickBar.classList.add("bx-gone"); }); - const $btnQuit = $elm.querySelector("div[class^=StreamMenu] > div > button:last-child"); - new MouseHoldEvent($btnQuit, () => { + const $btnRefresh = $btnCloseHud.cloneNode(true); + const $svgRefresh = createSvgIcon(BxIcon.REFRESH); + $svgRefresh.setAttribute("class", $btnRefresh.firstElementChild.getAttribute("class") || ""); + $svgRefresh.style.fill = "none"; + $btnRefresh.classList.add("bx-stream-refresh-button"); + $btnRefresh.removeChild($btnRefresh.firstElementChild); + $btnRefresh.appendChild($svgRefresh); + $btnRefresh.addEventListener("click", (e) => { confirm(t("confirm-reload-stream")) && window.location.reload(); - }, 1000); + }); + $btnCloseHud.insertAdjacentElement("afterend", $btnRefresh); const $menu = document.querySelector("div[class*=StreamMenu-module__menuContainer] > div[class*=Menu-module]"); $menu?.appendChild(await StreamBadges.render()); hideQuickBarFunc(); @@ -5581,44 +5592,6 @@ function showStreamSettings(tabId) { } } -class MouseHoldEvent { - #isHolding = false; - #timeout; - #$elm; - #callback; - #duration; - #onMouseDown(e) { - const _this = this; - this.#isHolding = false; - this.#timeout && clearTimeout(this.#timeout); - this.#timeout = window.setTimeout(() => { - _this.#isHolding = true; - _this.#callback(); - }, this.#duration); - } - #onMouseUp(e) { - this.#timeout && clearTimeout(this.#timeout); - this.#timeout = null; - if (this.#isHolding) { - e.preventDefault(); - e.stopPropagation(); - } - this.#isHolding = false; - } - #addEventListeners = () => { - this.#$elm.addEventListener("mousedown", this.#onMouseDown.bind(this)); - this.#$elm.addEventListener("click", this.#onMouseUp.bind(this)); - this.#$elm.addEventListener("touchstart", this.#onMouseDown.bind(this)); - this.#$elm.addEventListener("touchend", this.#onMouseUp.bind(this)); - }; - constructor($elm, callback, duration = 1000) { - this.#$elm = $elm; - this.#callback = callback; - this.#duration = duration; - this.#addEventListeners(); - } -} - // src/modules/mkb/mkb-handler.ts var LOG_TAG = "MkbHandler"; @@ -6654,15 +6627,13 @@ class TouchController { layout: { id: "System.Standard", displayName: "System", - layoutFile: { - content: layout.content - } + layoutFile: layout } }); }, delay); } static setup() { - window.BX_EXPOSED.test_touch_control = (content) => { + window.BX_EXPOSED.test_touch_control = (layout) => { const { touch_layout_manager } = window.BX_EXPOSED; touch_layout_manager && touch_layout_manager.changeLayoutForScope({ type: "showLayout", @@ -6671,9 +6642,7 @@ class TouchController { layout: { id: "System.Standard", displayName: "Custom", - layoutFile: { - content - } + layoutFile: layout } }); }; @@ -8555,6 +8524,12 @@ div[class*=StreamMenu-module__menuContainer] > div[class*=Menu-module] { background-color: #2d2d2d !important; color: #000 !important; } +.bx-stream-refresh-button { + top: calc(env(safe-area-inset-top, 0px) + 10px + 50px) !important; +} +body[data-media-type=tv] .bx-stream-refresh-button { + top: calc(var(--gds-focus-borderSize) + 80px) !important; +} .bx-number-stepper span { display: inline-block; width: 40px;