您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Decode the Bing URLs to get the direct result page URL
当前为
// ==UserScript== // @name Bing URL Decoder // @namespace https://github.com/Auncaughbove17/my-userscripts/ // @version 0.1 // @description Decode the Bing URLs to get the direct result page URL // @author Alistair1231 // @icon https://icons.duckduckgo.com/ip2/bing.com.ico // @grant none // @match https://www.bing.com/* // @license GPL-3.0 // ==/UserScript== (function() { 'use strict'; function decodeBingUrl(url) { // Remove the leading "a1" characters from the value of the "u" parameter const uParamValue = url.searchParams.get('u').substring(2); // Decode the URL-safe Base64-encoded value const decodedValue = decodeURIComponent( atob(uParamValue.replace(/_/g, '/').replace(/-/g, '+')) ); return decodedValue; } function decodeBingUrls(links) { links.forEach(link => { const decodedUrl = decodeBingUrl(new URL(link.href)); link.href = decodedUrl; }); } // Decode all "u" parameters in Bing URLs on the page const links = document.querySelectorAll('main a[href*="bing.com"][href*="&u="]'); decodeBingUrls(links); // Use MutationObserver to detect new links added to the page const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { if (mutation.type === 'childList') { const newLinks = mutation.addedNodes; decodeBingUrls(newLinks); } }); }); // Observe changes in the main content area of the page const mainContent = document.querySelector('main'); observer.observe(mainContent, { childList: true, subtree: true }); })();