您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
I try to pretend evil Facebook's method.
// ==UserScript== // @name Evil Link Converter triggered onmouse // @namespace http://tampermonkey.net/ // @version 0.1 // @description I try to pretend evil Facebook's method. // @author eggplants // @homepage https://github.com/eggplants // @match https://twitter.com/* // @grant none // @license MIT // ==/UserScript== /*jshint esversion: 6 */ (function () { "use strict"; const target = "https://google.com"; var buf = ""; function uuidv4() { return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => ( c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) ).toString(16) ); } function main(){ Array.from(document.getElementsByTagName("a")).forEach((elm) => { if (elm.onmousedown === null) { if(elm.id === ""){ elm.id = uuidv4(); } elm.onmousedown = ({elm: elm}) => { doChange(elm.id); }; if(elm.onmouseup === null) { elm.onmouseup = ({elm: elm}) => { undoChange(elm.id); }; } if(elm.onmouseleave===null){ elm.onmouseleave = ({elm: elm}) => { undoChange(elm.id); }; }} });} function doChange(id) { var e = document.getElementById(id); if (e.href !== target) { [buf, e.href] = [e.href, target]; } } function undoChange(id) { var e = document.getElementById(id); if (e.href === target) { e.href = buf; } } })();