mirror of
https://codeberg.org/ashley/poke.git
synced 2025-02-17 01:48:10 +01:00
double-click
This commit is contained in:
parent
524715b393
commit
61428f2c5d
1 changed files with 53 additions and 42 deletions
19
css/app.js
19
css/app.js
|
@ -278,18 +278,30 @@ function fetchUrls(urls) {
|
||||||
var loopOption = document.getElementById("loopOption");
|
var loopOption = document.getElementById("loopOption");
|
||||||
var speedOption = document.getElementById("speedOption");
|
var speedOption = document.getElementById("speedOption");
|
||||||
|
|
||||||
|
let contextMenuTimer;
|
||||||
|
let doubleClickTimeout = 300;
|
||||||
|
|
||||||
video.addEventListener("contextmenu", function(event) {
|
video.addEventListener("contextmenu", function(event) {
|
||||||
// Check if the video is in fullscreen mode
|
|
||||||
if (!document.fullscreenElement && !document.webkitFullscreenElement && !document.mozFullScreenElement && !document.msFullscreenElement) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
clearTimeout(contextMenuTimer);
|
||||||
|
|
||||||
|
contextMenuTimer = setTimeout(function() {
|
||||||
|
if (!document.fullscreenElement && !document.webkitFullscreenElement && !document.mozFullScreenElement && !document.msFullscreenElement) {
|
||||||
popupMenu.style.display = "block";
|
popupMenu.style.display = "block";
|
||||||
popupMenu.style.left = event.pageX + "px";
|
popupMenu.style.left = event.pageX + "px";
|
||||||
popupMenu.style.top = event.pageY + "px";
|
popupMenu.style.top = event.pageY + "px";
|
||||||
}
|
}
|
||||||
|
}, doubleClickTimeout);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
video.addEventListener("dblclick", function(event) {
|
||||||
|
if (event.button === 2) {
|
||||||
|
clearTimeout(contextMenuTimer);
|
||||||
|
popupMenu.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Hide the popup menu when clicking outside of it
|
// Hide the popup menu when clicking outside of it
|
||||||
window.addEventListener("click", function(event) {
|
window.addEventListener("click", function(event) {
|
||||||
|
@ -299,7 +311,6 @@ video.addEventListener("contextmenu", function(event) {
|
||||||
});
|
});
|
||||||
|
|
||||||
var loopedIndicator = document.getElementById("loopedIndicator");
|
var loopedIndicator = document.getElementById("loopedIndicator");
|
||||||
|
|
||||||
loopedIndicator.style.display = "none"; // Initially hide the indicator
|
loopedIndicator.style.display = "none"; // Initially hide the indicator
|
||||||
|
|
||||||
loopOption.addEventListener("click", function() {
|
loopOption.addEventListener("click", function() {
|
||||||
|
@ -332,7 +343,6 @@ loopOption.addEventListener("click", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
speedOption.addEventListener("click", function() {
|
speedOption.addEventListener("click", function() {
|
||||||
|
|
||||||
var currentSpeed = video.playbackRate;
|
var currentSpeed = video.playbackRate;
|
||||||
var newSpeed = getNextSpeed(currentSpeed);
|
var newSpeed = getNextSpeed(currentSpeed);
|
||||||
video.playbackRate = newSpeed;
|
video.playbackRate = newSpeed;
|
||||||
|
@ -354,5 +364,6 @@ loopOption.addEventListener("click", function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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