mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-07-19 04:31:43 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
0c45a7705d | |||
5655c5f3b6 | |||
2a6713a038 |
@ -1,5 +1,5 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 3.0.2
|
// @version 3.0.2.1
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Better xCloud
|
// @name Better xCloud
|
||||||
// @namespace https://github.com/redphx
|
// @namespace https://github.com/redphx
|
||||||
// @version 3.0.2
|
// @version 3.0.2.1
|
||||||
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
// @description Improve Xbox Cloud Gaming (xCloud) experience
|
||||||
// @author redphx
|
// @author redphx
|
||||||
// @license MIT
|
// @license MIT
|
||||||
@ -13,7 +13,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const SCRIPT_VERSION = '3.0.2';
|
const SCRIPT_VERSION = '3.0.2.1';
|
||||||
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
|
||||||
|
|
||||||
const ENABLE_XCLOUD_LOGGER = false;
|
const ENABLE_XCLOUD_LOGGER = false;
|
||||||
@ -6626,57 +6626,6 @@ class Patcher {
|
|||||||
return funcStr.replace(text, `connectMode:window.BX_REMOTE_PLAY_CONFIG?"xhome-connect":"cloud-connect",remotePlayServerId:(window.BX_REMOTE_PLAY_CONFIG&&window.BX_REMOTE_PLAY_CONFIG.serverId)||''`);
|
return funcStr.replace(text, `connectMode:window.BX_REMOTE_PLAY_CONFIG?"xhome-connect":"cloud-connect",remotePlayServerId:(window.BX_REMOTE_PLAY_CONFIG&&window.BX_REMOTE_PLAY_CONFIG.serverId)||''`);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add a "Remote Play" button to the "Jump back in" list
|
|
||||||
remotePlayPatchHomeJumpBackIn: PREFS.get(Preferences.REMOTE_PLAY_ENABLED) && function(funcStr) {
|
|
||||||
const index = funcStr.indexOf('MruTitlesGamesRow-module__childContainer');
|
|
||||||
if (index === -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const startIndex = funcStr.indexOf('return(', index);
|
|
||||||
const newCode = `
|
|
||||||
setTimeout(() => { window.dispatchEvent(new Event('${BxEvent.JUMP_BACK_IN_READY}')); }, 1000);
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Add event listener
|
|
||||||
window.addEventListener(BxEvent.JUMP_BACK_IN_READY, e => {
|
|
||||||
const $list = document.querySelector('ol[class^=ItemRow-module__list]');
|
|
||||||
if (!$list) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($list.querySelector('.bx-jump-in-li')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const $li = $list.firstElementChild.cloneNode(true);
|
|
||||||
$li.classList.add('bx-jump-in-li');
|
|
||||||
|
|
||||||
$li.addEventListener('click', e => {
|
|
||||||
RemotePlay.showDialog();
|
|
||||||
});
|
|
||||||
|
|
||||||
const $button = $li.querySelector('button');
|
|
||||||
$button.removeAttribute('id');
|
|
||||||
$button.removeAttribute('aria-labelledby');
|
|
||||||
$button.setAttribute('aria-label', __('remote-play'));
|
|
||||||
|
|
||||||
// Remove card's info
|
|
||||||
const $cardInfo = $button.querySelector('div[class^=BaseItem]');
|
|
||||||
$cardInfo.parentElement.removeChild($cardInfo);
|
|
||||||
|
|
||||||
const $images = $button.querySelector('div[class^=WrappedResponsiveImage]');
|
|
||||||
$images.classList.add('bx-remote-play-icon-wrapper');
|
|
||||||
$images.innerHTML = '';
|
|
||||||
$images.appendChild(createSvgIcon(Icon.REMOTE_PLAY), 2);
|
|
||||||
|
|
||||||
$list.insertBefore($li, $list.firstElementChild);
|
|
||||||
});
|
|
||||||
|
|
||||||
funcStr = funcStr.substring(0, startIndex) + newCode + funcStr.substring(startIndex);
|
|
||||||
return funcStr;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Disable trackEvent() function
|
// Disable trackEvent() function
|
||||||
disableTrackEvent: PREFS.get(Preferences.BLOCK_TRACKING) && function(funcStr) {
|
disableTrackEvent: PREFS.get(Preferences.BLOCK_TRACKING) && function(funcStr) {
|
||||||
const text = 'this.trackEvent=';
|
const text = 'this.trackEvent=';
|
||||||
@ -6847,8 +6796,6 @@ if (window.BX_VIBRATION_INTENSITY && window.BX_VIBRATION_INTENSITY < 1) {
|
|||||||
|
|
||||||
['disableStreamGate'],
|
['disableStreamGate'],
|
||||||
|
|
||||||
['remotePlayPatchHomeJumpBackIn'],
|
|
||||||
|
|
||||||
['tvLayout'],
|
['tvLayout'],
|
||||||
|
|
||||||
['enableXcloudLogger'],
|
['enableXcloudLogger'],
|
||||||
@ -7130,35 +7077,6 @@ div[class^=HUDButton-module__hiddenContainer] ~ div:not([class^=HUDButton-module
|
|||||||
left: -9999px;
|
left: -9999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-jump-in-li {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bx-jump-in-li button {
|
|
||||||
width: 60px;
|
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bx-jump-in-li button:not(:focus) .bx-remote-play-icon-wrapper {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.bx-remote-play-icon-wrapper, .bx-jump-in-li button:hover .bx-remote-play-icon-wrapper {
|
|
||||||
background: #7b7b7b1a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bx-remote-play-icon-wrapper svg {
|
|
||||||
padding: 10px;
|
|
||||||
height: 100%;
|
|
||||||
filter: drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.5));
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bx-jump-in-li button:hover .bx-remote-play-icon-wrapper svg, .bx-jump-in-li button:focus .bx-remote-play-icon-wrapper svg {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.bx-button {
|
a.bx-button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
@ -7238,6 +7156,16 @@ a.bx-button {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bx-remote-play-button {
|
||||||
|
height: auto;
|
||||||
|
margin-right: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bx-remote-play-button svg {
|
||||||
|
width: 32px;
|
||||||
|
height: 46px;
|
||||||
|
}
|
||||||
|
|
||||||
.bx-settings-button {
|
.bx-settings-button {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
@ -7246,6 +7174,7 @@ a.bx-button {
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-settings-button:hover, .bx-settings-button:focus {
|
.bx-settings-button:hover, .bx-settings-button:focus {
|
||||||
@ -7690,7 +7619,7 @@ div[class*=StreamMenu-module__menuContainer] > div[class*=Menu-module] {
|
|||||||
|
|
||||||
.bx-dialog > button {
|
.bx-dialog > button {
|
||||||
padding: 8px 32px;
|
padding: 8px 32px;
|
||||||
margin: 20px auto 0;
|
margin: 10px auto 0;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
display: block;
|
display: block;
|
||||||
@ -8204,11 +8133,11 @@ div[class*=StreamMenu-module__menuContainer] > div[class*=Menu-module] {
|
|||||||
|
|
||||||
.bx-remote-play-device-wrapper {
|
.bx-remote-play-device-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-remote-play-device-wrapper:not(:last-child) {
|
.bx-remote-play-device-wrapper:last-child {
|
||||||
margin-bottom: 14px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bx-remote-play-device-info {
|
.bx-remote-play-device-info {
|
||||||
@ -8901,6 +8830,23 @@ function injectSettingsButton($parent) {
|
|||||||
const PREF_PREFERRED_REGION = getPreferredServerRegion();
|
const PREF_PREFERRED_REGION = getPreferredServerRegion();
|
||||||
const PREF_LATEST_VERSION = PREFS.get(Preferences.LATEST_VERSION);
|
const PREF_LATEST_VERSION = PREFS.get(Preferences.LATEST_VERSION);
|
||||||
|
|
||||||
|
// Remote Play button
|
||||||
|
if (PREFS.get(Preferences.REMOTE_PLAY_ENABLED)) {
|
||||||
|
const $remotePlayBtn = createButton({
|
||||||
|
icon: Icon.REMOTE_PLAY,
|
||||||
|
title: __('remote-play'),
|
||||||
|
isGhost: true,
|
||||||
|
isRound: true,
|
||||||
|
onClick: e => {
|
||||||
|
RemotePlay.showDialog();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$remotePlayBtn.classList.add('bx-remote-play-button', 'bx-focusable');
|
||||||
|
|
||||||
|
$parent.appendChild($remotePlayBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup Settings button
|
// Setup Settings button
|
||||||
const $button = CE('button', {'class': 'bx-settings-button'}, PREF_PREFERRED_REGION);
|
const $button = CE('button', {'class': 'bx-settings-button'}, PREF_PREFERRED_REGION);
|
||||||
$button.addEventListener('click', e => {
|
$button.addEventListener('click', e => {
|
||||||
|
Reference in New Issue
Block a user