Greasy Fork

Shined up real nice.

Greasy Fork is available in English.

Invidio.us embed

Replace YouTube embeds with Invidio.us embeds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// ==UserScript==
// @name        Invidio.us embed
// @namespace   Backend
// @description Replace YouTube embeds with Invidio.us embeds.
// @include     *
// @exclude https://www.youtube.com/*
// @version     2.3
// ==/UserScript==
 
var a = 0; //set to 1 to autoplay embedded videos present on initial page load (not recommended)
var b = 0; //set to 1 to autoplay embedded videos that appear on page interaction

var observer = new MutationObserver(mutate);
observer.observe(document,{childList:true,attributes:true,subtree:true});

function mutate(){
  go(b);
}
 
function go(auto){
  var filter = Array.filter || Benchmark.filter;  
  var frames = document.getElementsByTagName("iframe");
  frames = filter(frames, youtubeiFrame);
 
  for(var i=0; i<frames.length; i++){
    var frame = frames[i];
    var src = frame.getAttribute('src');
    var invid = src.
      replace('www.youtube.com', 'invidio.us').
      replace('youtu.be/', 'invidio.us/watch?v=');
    if(invid.indexOf('?') === -1){
      invid += '?autoplay=' + auto;
    }else{
      invid += '&autoplay=' + auto;
    }
    frame.setAttribute('src', invid);
  }
}
 
function youtubeiFrame(el) {
  if(el.hasAttribute('src')){
    return el.getAttribute('src').indexOf('youtube') !== -1;
  }
  return false;
}
 
go(a);