Last active
May 20, 2021 20:32
-
-
Save nmanumr/cf94810df13b5ff7d5bc6136a20ca3a5 to your computer and use it in GitHub Desktop.
Revisions
-
nmanumr revised this gist
May 20, 2021 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,7 +36,7 @@ function rotate(){ let $ = document.querySelector.bind(document); let stylesheet = document.createElement("style"); stylesheet.innerHTML=` [theater].rotate #player-theater-container.ytd-watch-flexy{ height:calc((16 / 9) * 100vw); } [theater].transform .html5-main-video { transform: scaleX(${conf.flipX ? -1 : 1}) scaleY(${conf.flipY ? -1 : 1}) rotate(${conf.angle || 0 }deg); }`; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ let conf = { flipX: false, flipY: true, angle: 180 }; function rotate(){let e=$(".ytp-size-button.ytp-button");if(e.title.includes("Theater"))return setTimeout(rotate,200),e.click();let t=$("ytd-watch-flexy[theater]"),n=$(".html5-main-video"),{width:l,height:a}=n.style;if(0!==conf.angle&&180!==Math.abs(conf.angle)){l=+l.slice(0,-2),a=+a.slice(0,-2);let e=window.innerHeight-169;l>e&&(l=e,a=e/16*9,n.style.width=l+"px",n.style.height=a+"px"),n.style.top=(l-a)/2+"px",t.classList.add("rotate")}t.classList.add("transform")}let $=document.querySelector.bind(document),stylesheet=document.createElement("style");stylesheet.innerHTML=`\n[theater].rotate #player-theater-container.ytd-watch-flexy{ height:calc((16 / 9) * 100vw); }\n[theater].transform .html5-main-video { transform: scaleX(${conf.flipX?-1:1}) scaleY(${conf.flipY?-1:1}) rotate(${conf.angle||0}deg); }`,document.body.appendChild(stylesheet),window.addEventListener("resize",()=>setTimeout(rotate,200)),rotate(); -
nmanumr revised this gist
May 20, 2021 . No changes.There are no files selected for viewing
-
nmanumr revised this gist
May 20, 2021 . 1 changed file with 44 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ let conf = { flipX: false, flipY: true, angle: 180, }; function rotate(){ let theaterButton = $('.ytp-size-button.ytp-button'); if (theaterButton.title.includes("Theater")) { setTimeout(rotate, 200); return theaterButton.click(); } let container = $("ytd-watch-flexy[theater]"); let video = $(".html5-main-video"); let {width,height} = video.style; if (conf.angle !== 0 && Math.abs(conf.angle) !== 180) { width = +width.slice(0, -2); height = +height.slice(0, -2); let maxWidth = window.innerHeight-169; if (width > maxWidth) { width = maxWidth; height = maxWidth / 16 * 9; video.style.width = width + 'px'; video.style.height = height + 'px' } video.style.top= (width - height) / 2 + 'px'; container.classList.add("rotate"); } container.classList.add("transform"); } let $ = document.querySelector.bind(document); let stylesheet = document.createElement("style"); sheet.innerHTML=` [theater].rotate #player-theater-container.ytd-watch-flexy{ height:calc((16 / 9) * 100vw); } [theater].transform .html5-main-video { transform: scaleX(${conf.flipX ? -1 : 1}) scaleY(${conf.flipY ? -1 : 1}) rotate(${conf.angle || 0 }deg); }`; document.body.appendChild(stylesheet); window.addEventListener("resize", () => setTimeout(rotate, 200)), rotate(); -
nmanumr revised this gist
May 20, 2021 . 1 changed file with 0 additions and 44 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,44 +0,0 @@ -
nmanumr revised this gist
May 20, 2021 . No changes.There are no files selected for viewing
-
nmanumr created this gist
May 20, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ let conf = { flipX: false, flipY: true, angle: 180, }; function rotate(){ let theaterButton = $('.ytp-size-button.ytp-button'); if (theaterButton.title.includes("Theater")) { setTimeout(rotate, 200); return theaterButton.click(); } let container = $("ytd-watch-flexy[theater]"); let video = $(".html5-main-video"); let {width,height} = video.style; if (conf.angle !== 0 && Math.abs(conf.angle) !== 180) { width = +width.slice(0, -2); height = +height.slice(0, -2); let maxWidth = window.innerHeight-169; if (width > maxWidth) { width = maxWidth; height = maxWidth / 16 * 9; video.style.width = width + 'px'; video.style.height = height + 'px' } video.style.top= (width - height) / 2 + 'px'; container.classList.add("rotate"); } container.classList.add("transform"); } let $ = document.querySelector.bind(document); let stylesheet = document.createElement("style"); sheet.innerHTML=` [theater].rotate #player-theater-container.ytd-watch-flexy{ height:calc((16 / 9) * 100vw); } [theater].transform .html5-main-video { transform: scaleX(${conf.flipX ? -1 : 1}) scaleY(${conf.flipY ? -1 : 1}) rotate(${conf.angle || 0 }deg); }`; document.body.appendChild(stylesheet); window.addEventListener("resize", () => setTimeout(rotate, 200)), rotate(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ let conf = { flipX: false, flipY: true, angle: 180 }; function rotate(){let e=$(".ytp-size-button.ytp-button");if(e.title.includes("Theater"))return setTimeout(rotate,200),e.click();let t=$("ytd-watch-flexy[theater]"),n=$(".html5-main-video"),{width:l,height:a}=n.style;if(0!==conf.angle&&180!==Math.abs(conf.angle)){l=+l.slice(0,-2),a=+a.slice(0,-2);let e=window.innerHeight-169;l>e&&(l=e,a=e/16*9,n.style.width=l+"px",n.style.height=a+"px"),n.style.top=(l-a)/2+"px",t.classList.add("rotate")}t.classList.add("transform")}let $=document.querySelector.bind(document),stylesheet=document.createElement("style");sheet.innerHTML=`\n[theater].rotate #player-theater-container.ytd-watch-flexy{ height:calc((16 / 9) * 100vw); }\n[theater].transform .html5-main-video { transform: scaleX(${conf.flipX?-1:1}) scaleY(${conf.flipY?-1:1}) rotate(${conf.angle||0}deg); }`,document.body.appendChild(stylesheet),window.addEventListener("resize",()=>setTimeout(rotate,200)),rotate();