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)
);
}
var t = setInterval(main, 1000);
function main() {
Array.from(document.getElementsByTagName("a")).forEach((elm) => {
if (elm.onmousedown === null) {
if (elm.id === "") {
elm.id = uuidv4();
}
elm.onmousedown = () => {
doChange(elm.id);
};
if (elm.onmouseup === null) {
elm.onmouseup = () => {
undoChange(elm.id);
};
}
if (elm.onmouseleave === null) {
elm.onmouseleave = () => {
undoChange(elm.id);
};
}
}
});
}
function doChange(id) {
e = document.getElementById(id);
if (e.href !== target) {
[buf, e.href] = [e.href, target];
}
}
function undoChange(id) {
e = document.getElementById(id);
if (e.href === target) {
e.href = buf;
}
}
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址