WME Clean permalink

Script removes S-parameters from a URL. Layer settings from PL do not change your own

// ==UserScript==
// @name         WME Clean permalink
// @description  Script removes S-parameters from a URL. Layer settings from PL do not change your own
// @version      2024.02.24.03
// @author       Sapozhnik
// @namespace    https://greasyfork.org/ru/users/160654-waze-ukraine
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAABYgAAAWIBXyfQUwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAxgSURBVHic5Zt5dFRFFsZ/3Z2kOwlZSIKERTFsASFKBghgIGAIQdYgCJ64MGJ0BhgGVITjgsMi6hkRFEUQEESSCASQRQTZF0EI+5qENYBsQgiBkHR30t01f1T3s7NB0ummj853zjun6716t+5Xr27dW7eq4a8PFTAUOALkA+lAH7dq9AChBpIBUc41xI16PRCogHlYCYeFhYmXXx4igoODbR2QB3i4U0FXQgXMxEo+PDxc7NmdLjIzssTUT6faj4In1O7U0oWYCgwDaNSoMfPmzScgIACA7Oxs+3pFD1411+NjrF+4QYMGYsf2X0RmRpbIzMgSn3wyRajVatvXP4YcKX8pjMdKvn79+mLrlq0K+c8/ny40Go2N/G0g0q2augBvYCUfWjtUbFi/USE/Z85c4eXlZSNfAHR2q6YuwEis5IODg8VPa9Yq5OfPmy+0Wq2NvAF42q2augCvABZABAUFiR9Xr1HIp6Z8L7y9vW3kjUBvt2rqAvwdMAPCz89fLF/2g0J+8aIlwtfX10beBAxyq6YuwLNAMSD8/PxEWtpShfyKH1YIf39/e/KJbtXUBXgGK3lvb2+RkpyikF+1crUIDAy0kbcAr7pVUxegN9KehU6nE8kLkxXyWzZvFcFBwfbk/3E/YX+2SDAeWAZ4abVaZn41kzZt2ioPDxw4wM3cm7biG8Cc+wmsbiQUBDQADlVTTmXQBfgJ8PH09GTGlzOIiSnpzg0G/eq2UW2PmEymE8ASVyvUEbiGHG59XdxWB+AOIDQaj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Hz47U5EOVm8LfvOM3PZfltxE9bdJnfCWSubW8AKpJsMSj9+has5d+kV3RiVNWOSl2+g56jF5OUbQE54vZHu7y+FUOA41hMdid1biOI97wrL3nHimS4lTnrc9xT3nxm1kXODAMRz3R4T45I62pNf6k7lHhRCgIOUPUeYhdx/+L9AILCbkucJK945/YvCH/gZ6e+j3axLufgfHygnlie6UxgAAAAASUVORK5CYII=
// @match        https://www.waze.com/editor*
// @match        https://waze.com/editor*
// @match        https://www.waze.com/*/editor*
// @match        https://waze.com/*/editor*
// @grant        none
// ==/UserScript==

(function () {
    'use strict'
    const regex = /&s=\d*/;             // прибираємо шари налаштувань
    const regex2 = /#[^&?]*/;           // прибираємо хеш і далі
   
    let url = window.location.href;

    if (regex.test(url) || regex2.test(url)) {
        url = url.replace(regex,'');
        url = url.replace(regex2,'');
        window.location.replace(url);
    }
})()