Skip to content

Commit

Permalink
Merge pull request #2303 from agrpranjal07/master
Browse files Browse the repository at this point in the history
Rotate shortcut updated
  • Loading branch information
ImprovedTube authored May 25, 2024
2 parents 8223c7d + fadca70 commit c6f6fc8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
25 changes: 25 additions & 0 deletions js&css/web-accessible/www.youtube.com/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,3 +707,28 @@ ImprovedTube.shortcutPopupPlayer = function () {
}
};

/*------------------------------------------------------------------------------
4.7.30 ROTATE
------------------------------------------------------------------------------*/
ImprovedTube.shortcutRotateVideo= function (){
var player = this.elements.player,
video = this.elements.video,
rotate = Number(document.body.dataset.itRotate) || 0,
transform = '';

rotate += 90;

if (rotate === 360) {
rotate = 0;
}

document.body.dataset.itRotate = rotate;

transform += 'rotate(' + rotate + 'deg)';

if (rotate == 90 || rotate == 270) {
var is_vertical_video = video.videoHeight > video.videoWidth;

transform += ' scale(' + (is_vertical_video ? player.clientWidth : player.clientHeight) / (is_vertical_video ? player.clientHeight : player.clientWidth) + ')';
}
};
4 changes: 4 additions & 0 deletions menu/skeleton-parts/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ extension.skeleton.main.layers.section.shortcuts = {
shortcut_toggle_ambient_lighting: {
component: 'shortcut',
text: 'ambientLighting'
},
shortcut_rotate_video: {
component: 'shortcut',
text: 'rotate'
}
},
section: {
Expand Down

0 comments on commit c6f6fc8

Please sign in to comment.