logo

dotfiles

My dotfiles, one branch per machine, rebased on base git clone https://hacktivis.me/git/dotfiles.git

youtube_frame.user.js (575B)


  1. // Change YouTube iframes to a placeholder containing a link
  2. document.addEventListener("readystatechange", (event) => {
  3. const elems = document.getElementsByTagName("IFRAME");
  4. const src_re = new RegExp("^https?://(www\.)?youtube\.com/");
  5. console.debug(event.target.readyState, `${elems.length} Iframes found`, elems);
  6. Array.prototype.forEach.call(elems, (elem) => {
  7. console.debug(`Found iframe`, elem);
  8. const src = elem.getAttribute("src");
  9. if(src.match(src_re)) {
  10. elem.outerHTML = `<div><a href="${src}"><h3>Youtube Frame</h3>${src}</a></div>`;
  11. }
  12. });
  13. });