diff --git a/better-xcloud.user.js b/better-xcloud.user.js index 06bbec0..b7524ee 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -112,7 +112,7 @@ const createSvgIcon = (icon, strokeWidth=2) => { const createButton = options => { - const $btn = CE('button', {'class': 'bx-button'}); + const $btn = CE(options.url ? 'a' : 'button', {'class': 'bx-button'}); options.isPrimary && $btn.classList.add('bx-primary'); options.isDanger && $btn.classList.add('bx-danger'); @@ -122,6 +122,11 @@ const createButton = options => { options.title && $btn.setAttribute('title', options.title); options.onClick && $btn.addEventListener('click', options.onClick); + if (options.url) { + $btn.href = options.url; + $btn.target = '_blank'; + } + return $btn; } @@ -1008,6 +1013,10 @@ const Translations = { "vi-VN": "Đang lấy danh sách các console...", "zh-CN": "正在获取控制台列表...", }, + "help": { + "en-US": "Help", + "vi-VN": "Trợ giúp", + }, "hide-idle-cursor": { "de-DE": "Mauszeiger bei Inaktivität ausblenden", "en-US": "Hide mouse cursor on idle", @@ -2727,6 +2736,7 @@ const Icon = { TRASH: '', CURSOR_TEXT: '', INFO: '', + BOOK: '', REMOTE_PLAY: '', @@ -6646,7 +6656,9 @@ setTimeout(() => { window.dispatchEvent(new Event('${BxEvent.JUMP_BACK_IN_READY} const $li = $list.firstElementChild.cloneNode(true); $li.classList.add('bx-jump-in-li'); - $li.addEventListener('click', e => { document.getElementById('bxRemotePlayBtn').click(); }); + $li.addEventListener('click', e => { + RemotePlay.showDialog(); + }); const $button = $li.querySelector('button'); $button.removeAttribute('id'); @@ -7213,6 +7225,7 @@ div[class^=HUDButton-module__hiddenContainer] ~ div:not([class^=HUDButton-module height: 32px; line-height: 32px; vertical-align: middle; + color: #fff; } .bx-settings-button { @@ -8868,7 +8881,6 @@ function injectSettingsButton($parent) { const PREF_PREFERRED_REGION = getPreferredServerRegion(); const PREF_LATEST_VERSION = PREFS.get(Preferences.LATEST_VERSION); - const PREF_REMOTE_PLAY_ENABLED = PREFS.get(Preferences.REMOTE_PLAY_ENABLED); // Setup Settings button const $button = CE('button', {'class': 'bx-settings-button'}, PREF_PREFERRED_REGION); @@ -8892,7 +8904,7 @@ function injectSettingsButton($parent) { }); let $updateAvailable; - let $remotePlayBtn; + const $wrapper = CE('div', {'class': 'bx-settings-wrapper'}, CE('div', {'class': 'bx-settings-title-wrapper'}, CE('a', { @@ -8900,7 +8912,7 @@ function injectSettingsButton($parent) { 'href': SCRIPT_HOME, 'target': '_blank', }, 'Better xCloud ' + SCRIPT_VERSION), - $remotePlayBtn = CE('button', {'id': 'bxRemotePlayBtn', 'class': 'bx-primary-button bx-no-margin'}, __('remote-play')), + createButton({icon: Icon.BOOK, label: __('help'), url: 'https://better-xcloud.github.io/features/'}), ) ); $updateAvailable = CE('a', { @@ -8909,17 +8921,6 @@ function injectSettingsButton($parent) { 'target': '_blank', }); - if (PREF_REMOTE_PLAY_ENABLED) { - $remotePlayBtn.addEventListener('click', e => { - RemotePlay.showDialog(); - - // Hide Settings - $container.classList.add('bx-gone'); - }); - } else { - $remotePlayBtn.classList.add('bx-gone'); - } - $wrapper.appendChild($updateAvailable); // Show new version indicator