YouTube Remove List from Watch URLs

Remove list parameter from watch links on pages under www.youtube.com/user/.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        YouTube Remove List from Watch URLs
// @author      Jefferson "jscher2000" Scher
// @namespace   JeffersonScher
// @description Remove list parameter from watch links on pages under www.youtube.com/user/.
// @version     0.1
// @copyright   Copyright 2014 Jefferson Scher
// @license     BSD 3-clause
// @include     http*://www.youtube.com/user/*
// @grant       GM_log
// ==/UserScript==

function cleanseURLs(el){
  var dirty, i, u;
  dirty = el.querySelectorAll("a[href*='/watch?v='][href*='&list=']");
  for (i=0; i<dirty.length; i++){
    u = dirty[i].href;
    dirty[i].href = u.substr(0, u.indexOf("&list="));
  }
}

// run initial cleanse
cleanseURLs(document.body);

// set up mutation observer to detect added videos
var YRLWU_MutOb = (window.MutationObserver) ? window.MutationObserver : window.WebKitMutationObserver;
if (YRLWU_MutOb){
  var YRLWU_chgMon = new YRLWU_MutOb(function(mutationSet){
    mutationSet.forEach(function(mutation){
      for (var i=0; i<mutation.addedNodes.length; i++){
        if (mutation.addedNodes[i].nodeType == 1){
          cleanseURLs(mutation.addedNodes[i]);
        }
      }
    });
  });
  // attach chgMon to document.body
  var opts = {childList: true, subtree: true};
  YRLWU_chgMon.observe(document.body, opts);
}