Skip to content

Commit

Permalink
Update denvis.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlan404 authored Jan 30, 2022
1 parent 8f84780 commit bbe6ac6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Extensions/denvis.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// @version 0.1
// @description Integrates DenVis to Youtube and other media
// @author TheAlan404 (Dennis)
// @updateURL https://github.com/TheAlan404/DenVis/raw/master/Extensions/denvis.user.js
// @downloadURL https://github.com/TheAlan404/DenVis/raw/master/Extensions/denvis.user.js
// @include http://*
// @include https://*
// ==/UserScript==
Expand Down Expand Up @@ -64,17 +66,19 @@ const denvis = (() => {

const injectYoutube = () => {
document.addEventListener("yt-navigate-finish", (e) => {
let info = e.detail.response.playerResponse.videoDetails;
document.getElementsByTagName("video")[0].addEventListener("play", () => {
let info = e.detail.response.playerResponse.videoDetails;

info.author = info.author.replace("- Topic", ""); // todo, replace with splice idk
info.author = info.author.replace("- Topic", ""); // todo, replace with splice idk

if(config.onlyWhenHidden && !document.hidden) return;
if(config.onlyWhenHidden && !document.hidden) return;

denvis.send("AddText", {
Text: musicEmoji + " Now Playing: " + info.title + "\nby: " + info.author,
Expire: 7 * 1000,
X: 20,
Y: 20
denvis.send("AddText", {
Text: musicEmoji + " Now Playing: " + info.title + "\nby: " + info.author,
Expire: 7 * 1000,
X: 20,
Y: 20
});
});
});
}
Expand All @@ -89,4 +93,4 @@ const denvis = (() => {

if(document.readyState === "complete") run();
else window.addEventListener("load", run);
})();
})();

0 comments on commit bbe6ac6

Please sign in to comment.