YouTube Remove List from Watch URLs

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==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);
}