diff --git a/main_view.html b/main_view.html index 04c6c2c..5ed1539 100644 --- a/main_view.html +++ b/main_view.html @@ -141,6 +141,12 @@ selectNotch(ROOT_ID, await getCPUs() - 1, 8); } + async function onSlideCPUNotch(e) { + const ROOT_ID = "cpuThreadsNotch"; + let closest = closestNotch(e, ROOT_ID, 8); + await setCPUNotch(closest); + } + const TOGGLE_ON_CLASS = "gamepaddialog_On_3ld7T"; function setToggleState(toggle, state) { @@ -185,12 +191,24 @@ selectNotch(ROOT_ID, await getMaxBoost(), 3); } + async function onSlideBoostNotch(e) { + const ROOT_ID = "frequencyNotch"; + let closest = closestNotch(e, ROOT_ID, 8); + await setBoostNotch(closest); + } + async function onSetFanNotch(index) { const ROOT_ID = "fanNotch"; await setFanTick(index); selectNotch(ROOT_ID, index, 8); } + async function onSlideFanNotch(e) { + const ROOT_ID = "fanNotch"; + let closest = closestNotch(e, ROOT_ID, 8); + await onSetFanNotch(closest); + } + async function onReadyGPU() { let power1_cap = await getGPUPower(1); let power2_cap = await getGPUPower(2); @@ -228,6 +246,12 @@ selectNotch(ROOT_ID, index, 3); } + async function onSlideSlowPPTNotch(e) { + const ROOT_ID = "slowPPTNotch"; + let closest = closestNotch(e, ROOT_ID, 3); + onSetSlowPPTNotch(closest); + } + async function onSetFastPPTNotch(index) { const ROOT_ID = "fastPPTNotch"; document.getElementById("fastPPTAutoDefault").innerText = "Default"; @@ -241,6 +265,12 @@ selectNotch(ROOT_ID, index, 3); } + async function onSlideFastPPTNotch(e) { + const ROOT_ID = "fastPPTNotch"; + let closest = closestNotch(e, ROOT_ID, 3); + await onSetFastPPTNotch(closest); + } + function selectNotch(rootId, index, elements) { // WARNING: this yeets any style in div of slider const ENABLED_CLASS = "gamepadslider_TickActive_1gnUV"; @@ -257,6 +287,19 @@ } } + function closestNotch(e, rootId, elements) { + let root = document.getElementById(rootId); + let val = e.x / root.scrollWidth; + let closest_notch = Math.round(val * elements); + if (closest_notch > elements) { + closest_notch = elements; + } else if (closest_notch < 0) { + closest_notch = 0; + } + return closest_notch + //selectNotch(closest_notch); + } + async function updateBatteryStats() { //console.log("Updating battery stats"); let batCapacityNow = document.getElementById("batCapacityNow"); @@ -330,7 +373,7 @@
Threads
-
+