logo

dotfiles

My dotfiles, one branch per machine, rebased on base git clone https://hacktivis.me/git/dotfiles.git
commit: ff4ae9b88db975ba0318fcf4383d204e4a6eb29e
parent e2448759cbfb54ee2cd3f62f9bcd5ad3ff1fe555
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 17 Mar 2023 08:38:40 +0100

badwolf/scripts: Add youtube_frame.user.js

Diffstat:

A.local/share/badwolf/scripts/youtube_frame.user.js17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/.local/share/badwolf/scripts/youtube_frame.user.js b/.local/share/badwolf/scripts/youtube_frame.user.js @@ -0,0 +1,17 @@ +// Change YouTube iframes to a placeholder containing a link + +document.addEventListener("readystatechange", (event) => { + const elems = document.getElementsByTagName("IFRAME"); + const src_re = new RegExp("^https?://(www\.)?youtube\.com/"); + console.debug(event.target.readyState, `${elems.length} Iframes found`, elems); + + Array.prototype.forEach.call(elems, (elem) => { + console.debug(`Found iframe`, elem); + + const src = elem.getAttribute("src"); + + if(src.match(src_re)) { + elem.outerHTML = `<div><a href="${src}"><h3>Youtube Frame</h3>${src}</a></div>`; + } + }); +});