Fix forcing native MKB not working when mode = "default"

This commit is contained in:
redphx
2024-12-07 07:46:13 +07:00
parent fe98a1165f
commit 1ca2b771e7
7 changed files with 26 additions and 13 deletions

View File

@@ -1589,6 +1589,9 @@ class GlobalSettingsStorage extends BaseSettingsStore {
if (!setting.unsupported) setting.multipleOptions = GhPagesUtils.getNativeMkbCustomList(!0), window.addEventListener(BxEvent.GH_PAGES_FORCE_NATIVE_MKB_UPDATED, (e) => {
setting.multipleOptions = GhPagesUtils.getNativeMkbCustomList();
});
},
params: {
size: 6
}
},
"nativeMkb.scroll.sensitivityX": {
@@ -4871,7 +4874,7 @@ class SettingElement {
let $control = CE("select", {
multiple: !0,
tabindex: 0
}), size = params.size ? params.size : Object.keys(setting.multipleOptions).length;
}), totalOptions = Object.keys(setting.multipleOptions).length, size = params.size ? Math.min(params.size, totalOptions) : totalOptions;
$control.setAttribute("size", size.toString());
for (let value in setting.multipleOptions) {
let label = setting.multipleOptions[value], $option = CE("option", { value }, label);
@@ -5928,7 +5931,8 @@ class SettingsDialog extends NavigationDialog {
"nativeMkb.mode",
{
pref: "nativeMkb.forcedGames",
multiLines: !0
multiLines: !0,
note: CE("a", { href: "https://github.com/redphx/better-xcloud/discussions/574", target: "_blank" }, t("unofficial-game-list"))
},
"mkb.enabled",
"mkb.cursor.hideIdle"
@@ -9303,7 +9307,7 @@ window.addEventListener(BxEvent.CAPTURE_SCREENSHOT, (e) => {
ScreenshotManager.getInstance().takeScreenshot();
});
function main() {
if (GhPagesUtils.fetchLatestCommit(), getPref("nativeMkb.mode") === "on") {
if (GhPagesUtils.fetchLatestCommit(), getPref("nativeMkb.mode") !== "off") {
let customList = getPref("nativeMkb.forcedGames");
BX_FLAGS.ForceNativeMkbTitles.push(...customList);
}