Skip to content

Instantly share code, notes, and snippets.

@KumaTea
Created December 3, 2022 12:28
Show Gist options
  • Select an option

  • Save KumaTea/e687b819c8293209094cbc0ed0ad9d45 to your computer and use it in GitHub Desktop.

Select an option

Save KumaTea/e687b819c8293209094cbc0ed0ad9d45 to your computer and use it in GitHub Desktop.
Make Youtube fill the screen while in Discord Watch Together Activity
// ==UserScript==
// @name Discord 全屏一起看
// @name:zh Discord 全屏一起看
// @name:en Discord Watch Together Fullscreen
// @namespace https://github.com/KumaTea
// @namespace https://greasyfork.org/en/users/169784-kumatea
// @version 1.0
// @description 使 Discord 一起看 Youtube 时占满全屏
// @description:zh 使 Discord 一起看 Youtube 时占满全屏
// @description:en Make Youtube fill the screen while in Discord Watch Together Activity
// @author KumaTea
// @match https://discord.com/popout
// @icon https://www.google.com/s2/favicons?sz=64&domain=discord.com
// @license GPLv3
// @grant none
// ==/UserScript==
/* jshint esversion: 8 */
let SLEEP = 15;
let YOUTUBE_DIV = "pictureInPicture-1GQX91";
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function fullscreen() {
await sleep(SLEEP*1000);
console.log('Waited for ' + SLEEP + ' seconds.');
if (window.innerWidth == screen.width && window.innerHeight == screen.height) {
console.log('Fullscreen detected.');
document.querySelector("#app-mount > div > div > div > div." + YOUTUBE_DIV + " > div").style = "pointer-events: auto; transform: translateX(0px) translateY(0px) translateZ(0px);";
console.log('Moved.');
document.querySelector("#app-mount > div > div > div > div." + YOUTUBE_DIV + " > div > div").style = "width: " + window.innerWidth + "px; height: " + window.innerHeight + "px;";
console.log('Reized.');
}
}
fullscreen();
@KumaTea
Copy link
Author

KumaTea commented Dec 3, 2022

Description on Greasy Fork #455930


Discord 全屏一起看

Discord Watch Together Fullscreen

Before

before

After

after1

after2

console

如何恢复

退出全屏即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment