Blur Sensitive Data on Speedtest.net

Blur IPs, host info, sponsor links/names, survey params on speedtest.com

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Blur Sensitive Data on Speedtest.net
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Blur IPs, host info, sponsor links/names, survey params on speedtest.com
// @match        https://www.speedtest.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const ipRegex = /\b\d{1,3}(?:\.\d{1,3}){3}\b/;
    const blurStyle = 'filter: blur(12px) !important; user-select: none !important; pointer-events: none !important;';

    function blurSensitive() {
        // blur IPs and labels
        document.querySelectorAll('.result-data').forEach(el => {
            if (ipRegex.test(el.textContent)) {
                [el.previousElementSibling, el].forEach(e => {
                    if (e) e.style.cssText += blurStyle;
                });
            }
        });
        // blur server-host blocks
        document.querySelectorAll('.result-item-host').forEach(host => {
            host.style.cssText += blurStyle;
        });
        // blur sponsor link text
        document.querySelectorAll('a.js-data-sponsor').forEach(a => {
            a.style.cssText += blurStyle;
        });
        // blur sponsor name divs
        document.querySelectorAll('div.result-data.js-sponsor-name').forEach(div => {
            div.style.cssText += blurStyle;
        });
        // blur survey parameter
        document.querySelectorAll('p.audience-survey-parameter').forEach(p => {
            p.style.cssText += blurStyle;
        });
    }

    blurSensitive();
    new MutationObserver(blurSensitive).observe(document.body, { childList: true, subtree: true });
})();