mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
In Settings, replace the "Remote Play" button with the "Help" button
This commit is contained in:
parent
32422e5a62
commit
7e6800b3ef
@ -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: '<path d="M29.5 6.182h-27m9.818 7.363v9.818m7.364-9.818v9.818"/><path d="M27.045 6.182V29.5c0 .673-.554 1.227-1.227 1.227H6.182c-.673 0-1.227-.554-1.227-1.227V6.182m17.181 0V3.727a2.47 2.47 0 0 0-2.455-2.455h-7.364a2.47 2.47 0 0 0-2.455 2.455v2.455"/>',
|
||||
CURSOR_TEXT: '<path d="M16 7.3a5.83 5.83 0 0 1 5.8-5.8h2.9m0 29h-2.9a5.83 5.83 0 0 1-5.8-5.8"/><path d="M7.3 30.5h2.9a5.83 5.83 0 0 0 5.8-5.8V7.3a5.83 5.83 0 0 0-5.8-5.8H7.3"/><path d="M11.65 16h8.7"/>',
|
||||
INFO: '<g transform="matrix(.153399 0 0 .153398 -3.63501 -3.635009)"><g fill="none" stroke="#fff" stroke-width="16"><circle cx="128" cy="128" r="96"/><path d="M120 120c4.389 0 8 3.611 8 8v40c0 4.389 3.611 8 8 8"/></g><circle cx="124" cy="84" r="12" stroke-width="6"/></g>',
|
||||
BOOK: '<path d="M3.715 29.513c0-2.022 1.664-3.685 3.685-3.685h20.884V1.258H7.401c-2.022 0-3.685 1.664-3.685 3.685v24.569z"/><path d="M3.715 29.513v1.228h22.112"/>',
|
||||
|
||||
REMOTE_PLAY: '<g transform="matrix(.492308 0 0 .581818 -14.7692 -11.6364)"><clipPath id="A"><path d="M30 20h65v55H30z"/></clipPath><g clip-path="url(#A)"><g transform="matrix(.395211 0 0 .334409 11.913 7.01124)"><g transform="matrix(.555556 0 0 .555556 57.8889 -20.2417)" fill="none" stroke="#fff" stroke-width="13.88"><path d="M200 140.564c-42.045-33.285-101.955-33.285-144 0M168 165c-23.783-17.3-56.217-17.3-80 0"/></g><g transform="matrix(-.555556 0 0 -.555556 200.111 262.393)"><g transform="matrix(1 0 0 1 0 11.5642)"><path d="M200 129c-17.342-13.728-37.723-21.795-58.636-24.198C111.574 101.378 80.703 109.444 56 129" fill="none" stroke="#fff" stroke-width="13.88"/></g><path d="M168 165c-23.783-17.3-56.217-17.3-80 0" fill="none" stroke="#fff" stroke-width="13.88"/></g><g transform="matrix(.75 0 0 .75 32 32)"><path d="M24 72h208v93.881H24z" fill="none" stroke="#fff" stroke-linejoin="miter" stroke-width="9.485"/><circle cx="188" cy="128" r="12" stroke-width="10" transform="matrix(.708333 0 0 .708333 71.8333 12.8333)"/><path d="M24.358 103.5h110" fill="none" stroke="#fff" stroke-linecap="butt" stroke-width="10.282"/></g></g></g></g>',
|
||||
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user