// listen for new tabs
chrome.tabs.onCreated.addListener(function (tabId , info) {
  // info may be undefined when tab created
  if(typeof(info) != "undefined" && typeof(info.url) != "undefined"){
    url = info.url;

    if(isYouTubeUrl(url) && doesUrlNotContainField(url)){
      revertYT(tabId);
    }
  }
});

// listen for updated tabs
chrome.tabs.onUpdated.addListener(function (tabId , info) {
  // not all tab updates contain the URL (such as title, or status complete)
  if(typeof(info) != "undefined" && typeof(info.url) != "undefined"){
    url = info.url;

    if(isYouTubeUrl(url) && doesUrlNotContainField(url)){
      revertYT(tabId);
    }
  }
});

// enable old version
function revertYT(tabId){
  chrome.tabs.get(tabId, function(tab){
      if(tab.url.indexOf("?") !== -1){
        chrome.tabs.update(tabId, {
          url: tab.url + "&disable_polymer=true"
        });
      }else{
        chrome.tabs.update(tabId, {
          url: tab.url + "?disable_polymer=true"
        });
      }
  });
}

function doesUrlNotContainField(url){
  return url.indexOf("disable_polymer=true") === -1;
}

function isYouTubeUrl(url){
  return (url.indexOf("www.youtube.com") !== -1 || url.indexOf("https://youtube.com") !== -1);
}

@@ -1,20 +1,227 @@
+// When the field is set on a video, a brief reload is made removing the%0A// field from the URL but keeping the reverted setting. This set holds%0A// these urls before they are reset.%0AvideoUrlSet = new Set();%0A%0A
 // listen for new ta
@@ -327,16 +327,17 @@
 created%0A
+%0A
   if(typ
@@ -466,32 +466,59 @@
 ontainField(url)
+ && !videoUrlSet.has(tabId)
 )%7B%0A      revertY
@@ -524,32 +524,108 @@
 YT(tabId);%0A    %7D
+%0A%0A    if(info.status === %22complete%22)%7B%0A      videoUrlSet.delete(tabId);%0A    %7D
 %0A  %7D%0A%7D);%0A%0A// lis
@@ -697,27 +697,202 @@
 tabId , info
-) %7B
+, tab) %7B%0A  if(info.status === %22complete%22)%7B%0A    // wait until next reqeust has passed, then clear the set%0A    setTimeout(function()%7B%0A      videoUrlSet.clear();%0A    %7D, 2000);%0A%0A  %7D%0A
 %0A  // not al
@@ -1103,16 +1103,45 @@
 eld(url)
+ && !videoUrlSet.has(tab.url)
 )%7B%0A     
@@ -1261,16 +1261,49 @@
 n(tab)%7B%0A
+      videoUrlSet.add(tab.url);%0A%0A
       if

Fix bug causing videos to constantly reload on high speed connections