PROJET AUTOBLOG


Shaarli - Les discussions de Shaarli

Archivé

Site original : Shaarli - Les discussions de Shaarli du 23/07/2013

⇐ retour index

[Firefox][Greasemonkey] - Supprimer les paramètres URL de Youtube - avoir une URL Youtube qui soit propre

dimanche 19 octobre 2014 à 13:36
Timo, le 19/10/2014 à 13:36

// ==UserScript==
// @name Youtube Parameters Stripper
// @namespace lehollandaisvolant.net
// @description Removes ?feature* parametes on Youtube
// @include http://*.youtube.com/watch*
// @include https://*.youtube.com/watch*
// @version 1
// ==/UserScript==

(function() {
var sp = window.location.search.replace(/^\?/,'').split('&'), sk = [];

for(var i =0; i < sp.length; i++) {
if(!/^(?:feature|annotation_id|src_vid|NR)$/i.test(sp[i].split('=')[0])) {
sk.push(sp[i]);
}
}

var newurl = window.location.protocol + '//' + window.location.host
+ window.location.pathname + (sk.length?'?'+sk.join('&'):'')
+ window.location.hash;

if(newurl != window.location.href) {
(!!(window.history && window.history.pushState)
?window.history.pushState(null,null, newurl)
:window.location.replace(newurl)
);
}
})();