WME Link Layer Settings Blocker

Prevent WME links from changing your layer settings

目前为 2024-01-26 提交的版本。查看 最新版本

// ==UserScript==
// @name            WME Link Layer Settings Blocker
// @description     Prevent WME links from changing your layer settings
// @version         2024.01.26.002
// @namespace       https://gf.qytechs.cn/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);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址