WME Link Layer Settings Blocker

Prevent WME links from changing your layer settings

Από την 26/01/2024. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

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

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

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

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name            WME Link Layer Settings Blocker
// @description     Prevent WME links from changing your layer settings
// @version         2024.01.26.002
// @namespace       https://greasyfork.org/en/scripts/485691-wme-link-layer-settings-blocker
// @author          Brandon28AU
// @license         MIT
// @match           *://*.waze.com/*editor*
// @exclude         *://*.waze.com/user/editor*
// @grant           none
// ==/UserScript==

(function() {
    'use strict';
    var url = window.location.href;

    if (url.match(/([&?]s=[0-9]+)/)) {
        // If URL contains settings, redirect
        window.location.replace(url.replace(/([&?])(s=[0-9]+)/, function(match, prefix) {return prefix + "llsblocked=true"}));

    } else if (url.match(/([&?]llsblocked=true)/)) {
        // If user has been redirected, notify

        const toastContainer = document.createElement('div');
        toastContainer.style.position = 'fixed';

        toastContainer.style.bottom = '50px';
        toastContainer.style.left = '50%';
        toastContainer.style.transform = 'translate(-50%, 50%)';
        toastContainer.style.backgroundColor = '#fff';
        toastContainer.style.color = '#333';
        toastContainer.style.padding = '10px 20px';
        toastContainer.style.borderRadius = '9999px';
        toastContainer.style.display = 'flex';
        toastContainer.style.gap = '10px';
        toastContainer.style.border = "solid 1px #10b981";
        toastContainer.style.alignItems = 'center';
        toastContainer.style.opacity = '0';
        toastContainer.style.transition = 'opacity 0.5s ease-out, transform 0.5s ease-out';

        toastContainer.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#10b981" width="30px" height="30px"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z" /></svg>Link Layer Settings Blocked';

        document.body.appendChild(toastContainer);

        // Trigger a reflow to apply styles and initiate the fade-in animation
        toastContainer.offsetHeight;

        // Show the toast
        toastContainer.style.opacity = '1';
        toastContainer.style.transform = 'translate(-50%, 0%)';

        // Automatically hide after 5 seconds
        setTimeout(() => {
            // Initiate the fade-out animation
            toastContainer.style.transition = 'opacity 0.5s ease-in, transform 0.5s ease-in';
            toastContainer.style.opacity = '0';
            toastContainer.style.transform = 'translate(-50%, 50%)';

            // Remove the element from the DOM after the animation completes
            setTimeout(() => {
                document.body.removeChild(toastContainer);
            }, 500);
        }, 5000);
    }
})();