Update better-xcloud.user.js

This commit is contained in:
redphx 2024-06-23 17:30:00 +07:00
parent b7928ebe68
commit 52694d8f8e

View File

@ -2356,12 +2356,14 @@ class StreamBadges {
this.#interval && clearInterval(this.#interval), this.#interval = null; this.#interval && clearInterval(this.#interval), this.#interval = null;
} }
#secondsToHm(seconds) { #secondsToHm(seconds) {
const h = Math.floor(seconds / 3600), m = Math.floor(seconds % 3600 / 60) + 1, hDisplay = h > 0 ? `${h}h` : "", mDisplay = m > 0 ? `${m}m` : ""; let h = Math.floor(seconds / 3600), m = Math.floor(seconds % 3600 / 60) + 1;
return hDisplay + mDisplay; if (m === 60)
h += 1, m = 0;
const output = [];
return h > 0 && output.push(`${h}h`), m > 0 && output.push(`${m}m`), output.join(" ");
} }
#humanFileSize(size) { #humanFileSize(size) {
const units = ["B", "KB", "MB", "GB", "TB"]; const units = ["B", "KB", "MB", "GB", "TB"], i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
let i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(2) + " " + units[i]; return (size / Math.pow(1024, i)).toFixed(2) + " " + units[i];
} }
async render() { async render() {
@ -4431,17 +4433,17 @@ var setupStreamSettingsDialog = function() {
{ {
pref: PrefKey.CONTROLLER_ENABLE_VIBRATION, pref: PrefKey.CONTROLLER_ENABLE_VIBRATION,
unsupported: !VibrationManager.supportControllerVibration(), unsupported: !VibrationManager.supportControllerVibration(),
onChange: VibrationManager.updateGlobalVars onChange: () => VibrationManager.updateGlobalVars()
}, },
{ {
pref: PrefKey.CONTROLLER_DEVICE_VIBRATION, pref: PrefKey.CONTROLLER_DEVICE_VIBRATION,
unsupported: !VibrationManager.supportDeviceVibration(), unsupported: !VibrationManager.supportDeviceVibration(),
onChange: VibrationManager.updateGlobalVars onChange: () => VibrationManager.updateGlobalVars()
}, },
(VibrationManager.supportControllerVibration() || VibrationManager.supportDeviceVibration()) && { (VibrationManager.supportControllerVibration() || VibrationManager.supportDeviceVibration()) && {
pref: PrefKey.CONTROLLER_VIBRATION_INTENSITY, pref: PrefKey.CONTROLLER_VIBRATION_INTENSITY,
unsupported: !VibrationManager.supportDeviceVibration(), unsupported: !VibrationManager.supportDeviceVibration(),
onChange: VibrationManager.updateGlobalVars onChange: () => VibrationManager.updateGlobalVars()
} }
] ]
}, },