WME Layers Link Remover

removes "&layers=#" from links clicked/opened in Waze

As of 2016-04-20. See the latest version.

// ==UserScript==
// @name            WME Layers Link Remover
// @description     removes "&layers=#" from links clicked/opened in Waze
// @namespace 	    vaindil
// @version         0.7.1
// @grant           none
// @include         https://www.waze.com/editor/*&layers=*
// @include         https://www.waze.com/editor/?layers=*
// @include         https://www.waze.com/*/editor*&layers=*
// @include         https://www.waze.com/*/editor/?layers=*
// @include         https://editor-beta.waze.com/*&layers=*
// @include         https://editor-beta.waze.com/?layers=*
// @include         https://editor-beta.waze.com/*/*&layers=*
// @include         https://editor-beta.waze.com/*/?layers=*
// @exclude         https://www.waze.com/user/*
// @exclude         https://www.waze.com/*/user/*
// @author          vaindil
// @run-at          document-start
// ==/UserScript==


/*******
 * Some users prefer to not have layers included in permalinks for various reasons.
 * This script removes the "&layers=#" string from the URL to circumvent this.
 * 
 * To the extent possible under law, I (vaindil) have waived all copyright and related
 * or neighboring rights to WME Layers Link Remover. This work is published from: United States.
 * More info: https://creativecommons.org/publicdomain/zero/1.0/
 * 
*******/

window.onload = function() {
    window.stop();
    document.write('<style type="text/undefined">');
    var str = window.location.href;
    window.location.href = str.replace(/&layers=\d*/g, '');
}