mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-30 00:28:42 +01:00
Update html/poketube.ejs
This commit is contained in:
parent
6ca3d6a716
commit
ffa846d96d
1 changed files with 45 additions and 43 deletions
|
@ -630,6 +630,51 @@ background-color: #0000;
|
||||||
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
localStorage.setItem(`progress-${new URLSearchParams(window.location.search).get('v')}`, 0);
|
||||||
|
|
||||||
if (qua !== "medium") {
|
if (qua !== "medium") {
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener('keydown', function(event) {
|
||||||
|
// Toggle play/pause with the Spacebar and prevent control activation
|
||||||
|
if (event.key === ' ' || event.key === 'Spacebar') {
|
||||||
|
event.preventDefault(); // Prevent default action, like activating buttons
|
||||||
|
if (video.paused()) {
|
||||||
|
video.play();
|
||||||
|
} else {
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle fullscreen with the F key
|
||||||
|
if (event.key === 'f' || event.key === 'F') {
|
||||||
|
event.preventDefault();
|
||||||
|
if (video.isFullscreen()) {
|
||||||
|
video.exitFullscreen();
|
||||||
|
} else {
|
||||||
|
video.requestFullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggle mute with the M key
|
||||||
|
if (event.key === 'm' || event.key === 'M') {
|
||||||
|
event.preventDefault();
|
||||||
|
video.muted(!video.muted());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.ctrlKey || event.metaKey || event.altKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ewhich = event.which || event.keyCode;
|
||||||
|
|
||||||
|
// Number keys from 0-9 skip to a percentage of the video. 0 is 0% and 9 is 90%
|
||||||
|
if ((ewhich >= 48 && ewhich <= 57) || (ewhich >= 96 && ewhich <= 105)) {
|
||||||
|
var sub = ewhich >= 96 ? 96 : 48;
|
||||||
|
var number = ewhich - sub;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
video.currentTime(video.duration * number * 0.1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const audio = document.getElementById('aud');
|
const audio = document.getElementById('aud');
|
||||||
|
|
||||||
// Sync volume between audio and video
|
// Sync volume between audio and video
|
||||||
|
@ -720,49 +765,6 @@ background-color: #0000;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('keydown', function(event) {
|
|
||||||
// Toggle play/pause with the Spacebar and prevent control activation
|
|
||||||
if (event.key === ' ' || event.key === 'Spacebar') {
|
|
||||||
event.preventDefault(); // Prevent default action, like activating buttons
|
|
||||||
if (video.paused()) {
|
|
||||||
video.play();
|
|
||||||
} else {
|
|
||||||
video.pause();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toggle fullscreen with the F key
|
|
||||||
if (event.key === 'f' || event.key === 'F') {
|
|
||||||
event.preventDefault();
|
|
||||||
if (video.isFullscreen()) {
|
|
||||||
video.exitFullscreen();
|
|
||||||
} else {
|
|
||||||
video.requestFullscreen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toggle mute with the M key
|
|
||||||
if (event.key === 'm' || event.key === 'M') {
|
|
||||||
event.preventDefault();
|
|
||||||
video.muted(!video.muted());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ewhich = event.which || event.keyCode;
|
|
||||||
|
|
||||||
// Number keys from 0-9 skip to a percentage of the video. 0 is 0% and 9 is 90%
|
|
||||||
if ((ewhich >= 48 && ewhich <= 57) || (ewhich >= 96 && ewhich <= 105)) {
|
|
||||||
var sub = ewhich >= 96 ? 96 : 48;
|
|
||||||
var number = ewhich - sub;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
video.currentTime(video.duration * number * 0.1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% if(dm) { %>
|
<% if(dm) { %>
|
||||||
|
|
Loading…
Reference in a new issue