Fix "guideAchievementsDefaultLocked" patch

This commit is contained in:
redphx 2024-11-18 22:01:24 +07:00
parent f18c5c14ed
commit 5d177bd76c
3 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Better xCloud (Lite)
// @namespace https://github.com/redphx
// @version 5.9.5
// @version 5.9.6-beta
// @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx
// @license MIT
@ -105,7 +105,7 @@ class UserAgent {
});
}
}
var SCRIPT_VERSION = "5.9.5", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface;
var SCRIPT_VERSION = "5.9.6-beta", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface;
UserAgent.init();
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = {
supportedRegion: !0,

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Better xCloud
// @namespace https://github.com/redphx
// @version 5.9.5
// @version 5.9.6-beta
// @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx
// @license MIT
@ -107,7 +107,7 @@ class UserAgent {
});
}
}
var SCRIPT_VERSION = "5.9.5", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
var SCRIPT_VERSION = "5.9.6-beta", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface;
UserAgent.init();
var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = {
supportedRegion: !0,
@ -4399,9 +4399,9 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
},
guideAchievementsDefaultLocked(str) {
let index = str.indexOf("FilterButton-module__container");
if (index >= 0 && (index = PatcherUtils.lastIndexOf(str, ".All", index, 150)), index < 0) return !1;
if (str = PatcherUtils.replaceWith(str, index, ".All", ".Locked"), index = str.indexOf('"Guide_Achievements_Unlocked_Empty","Guide_Achievements_Locked_Empty"'), index >= 0 && (index = PatcherUtils.indexOf(str, ".All", index, 250)), index < 0) return !1;
return str = PatcherUtils.replaceWith(str, index, ".All", ".Locked"), str;
if (index >= 0 && (index = PatcherUtils.lastIndexOf(str, '"All"', index, 150)), index < 0) return !1;
if (str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"'), index = str.indexOf('"Guide_Achievements_Unlocked_Empty","Guide_Achievements_Locked_Empty"'), index >= 0 && (index = PatcherUtils.indexOf(str, '"All"', index, 250)), index < 0) return !1;
return str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"'), str;
},
disableTouchContextMenu(str) {
let index = str.indexOf('"ContextualCardActions-module__container');

View File

@ -942,20 +942,20 @@ if (this.baseStorageKey in window.BX_EXPOSED.overrideSettings) {
// Set Achievements list's filter default to "Locked"
guideAchievementsDefaultLocked(str: string) {
let index = str.indexOf('FilterButton-module__container');
index >= 0 && (index = PatcherUtils.lastIndexOf(str, '.All', index, 150));
index >= 0 && (index = PatcherUtils.lastIndexOf(str, '"All"', index, 150));
if (index < 0) {
return false;
}
str = PatcherUtils.replaceWith(str, index, '.All', '.Locked');
str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"');
index = str.indexOf('"Guide_Achievements_Unlocked_Empty","Guide_Achievements_Locked_Empty"');
index >= 0 && (index = PatcherUtils.indexOf(str, '.All', index, 250));
index >= 0 && (index = PatcherUtils.indexOf(str, '"All"', index, 250));
if (index < 0) {
return false;
}
str = PatcherUtils.replaceWith(str, index, '.All', '.Locked');
str = PatcherUtils.replaceWith(str, index, '"All"', '"Locked"');
return str;
},