/*
Youtube Video Flipper & Rotater
This code is released under the CC0 1.0 Universal license.
You can copy, modify, distribute and use it, even for commercial purposes,
without asking for permission.
https://creativecommons.org/publicdomain/zero/1.0/
The code is written to run on a Mac computer. On Windows, it calls the Start Menu. For use on Windows, see the appropriate comment in the code.
*/
let isMirrored = false; // Mirroring status
let rotation = 0; // Current angle of rotation in degrees
document.addEventListener('keydown', function(event) {
const videos = document.querySelectorAll('video');
const shortvideo = document.querySelector('#reel-video-renderer')
// ~: tükrözés
if (event.key === '~') {
if (isMirrored) {
// Töröljük a tükrözést
videos.forEach(video => {
video.style.transform = '';
});
} else {
// We mirror it horizontally
videos.forEach(video => {
video.style.transform = 'rotateY(180deg)';
});
}
isMirrored = !isMirrored; // We reverse the situation
}
// Cmd-Alt-0: 90 fokkal elforgatás
if (event.metaKey && event.altKey && event.key === '+') { // Replace event.metaKey to event.ctrlKey for Windows usage
rotation = (rotation + 90);
shortvideo.style.transform = `rotateZ(${rotation}deg)`;
// We disable the default browser functionality if necessary
event.preventDefault();
}
if (event.metaKey && event.altKey && event.key === '-') { // Replace event.metaKey to event.ctrlKey for Windows usage
rotation = (rotation - 90);
shortvideo.style.transform = `rotateZ(${rotation}deg)`;
// We disable the default browser functionality if necessary
event.preventDefault();
}
});