mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 04:08:39 +01:00
add cpu warning
This commit is contained in:
parent
fdb2c1d12e
commit
b25841a667
1 changed files with 30 additions and 20 deletions
48
css/app.js
48
css/app.js
|
@ -331,28 +331,38 @@ loopOption.addEventListener("click", function() {
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
speedOption.addEventListener("click", function() {
|
speedOption.addEventListener("click", function() {
|
||||||
|
var currentSpeed = video.playbackRate;
|
||||||
|
var newSpeed = getNextSpeed(currentSpeed);
|
||||||
|
|
||||||
var currentSpeed = video.playbackRate;
|
if (navigator.hardwareConcurrency < 3) {
|
||||||
var newSpeed = getNextSpeed(currentSpeed);
|
var userChoice = confirm(
|
||||||
video.playbackRate = newSpeed;
|
"Your system has less than 3 CPU cores ;_; Increasing the video speed will CPU usage and affect performance - Do u want to continue?"
|
||||||
document.getElementById("aud").playbackRate = newSpeed;
|
);
|
||||||
speedOption.innerHTML = "<i class='fa-light fa-gauge'></i> Speed: " + newSpeed.toFixed(2) + "x";
|
|
||||||
});
|
|
||||||
|
|
||||||
function getNextSpeed(currentSpeed) {
|
if (!userChoice) {
|
||||||
if (currentSpeed === 2) {
|
return;
|
||||||
return 0.25;
|
|
||||||
} else if (currentSpeed === 0.25) {
|
|
||||||
return 0.5;
|
|
||||||
} else if (currentSpeed === 0.5) {
|
|
||||||
return 0.75;
|
|
||||||
} else if (currentSpeed === 0.75) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
video.playbackRate = newSpeed;
|
||||||
|
document.getElementById("aud").playbackRate = newSpeed;
|
||||||
|
speedOption.innerHTML = "<i class='fa-light fa-gauge'></i> Speed: " + newSpeed.toFixed(2) + "x";
|
||||||
|
});
|
||||||
|
|
||||||
|
function getNextSpeed(currentSpeed) {
|
||||||
|
if (currentSpeed === 2) {
|
||||||
|
return 0.25;
|
||||||
|
} else if (currentSpeed === 0.25) {
|
||||||
|
return 0.5;
|
||||||
|
} else if (currentSpeed === 0.5) {
|
||||||
|
return 0.75;
|
||||||
|
} else if (currentSpeed === 0.75) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const GoogleTranslateEndpoint = "https://translate.google.com/_/TranslateWebserverUi/data/batchexecute?rpcids=MkEWBc&rt=c"
|
const GoogleTranslateEndpoint = "https://translate.google.com/_/TranslateWebserverUi/data/batchexecute?rpcids=MkEWBc&rt=c"
|
||||||
// @license-end
|
// @license-end
|
Loading…
Reference in a new issue