From 62800befd467ea1475f99cdc37d7f08ef1131e59 Mon Sep 17 00:00:00 2001 From: Ealhad Date: Sat, 11 Aug 2018 00:29:24 +0200 Subject: [PATCH] Display link in a bottom banner rather than in the page flow --- src/youtube.js | 68 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/src/youtube.js b/src/youtube.js index ba33505..6a46654 100644 --- a/src/youtube.js +++ b/src/youtube.js @@ -27,7 +27,7 @@ function peertubeify(query) { }).then(video => { removeVideoLink(); const link = videoLink(video); - document.querySelector('.title').insertAdjacentElement('afterend', link); + document.querySelector('ytd-app').appendChild(link); }); } @@ -59,12 +59,58 @@ function videoLink(video) { const url = watchURL(video.account.host, video.uuid); return htmlToElement(` - - -

- ${video.account.host} -

-
+ `); } @@ -72,11 +118,3 @@ function removeVideoLink() { const existingLink = document.getElementById(LINK_ID); existingLink && existingLink.remove(); } - -function ready(fn) { - if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading") { - fn(); - } else { - document.addEventListener('DOMContentLoaded', fn); - } -}