您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
remove fbclid on you mouse down the link(讓點下去連結短一點)
// ==UserScript== // @name 不要長FB連結(No FB long url) // @namespace http://tampermonkey.net/ // @version 0.8 // @description remove fbclid on you mouse down the link(讓點下去連結短一點) // @author You // @match https://*.facebook.com/* // @grant none // @require https://code.jquery.com/jquery-3.6.0.min.js // @license MIT // ==/UserScript== (function() { 'use strict'; document.body.addEventListener('mousedown', function () { // 兼容处理 var target = event.target || event.srcElement; // 判断是否匹配目标元素console.log('当前点击的 a 标签: ', target); // 处理完 a 标签的内容,重新触发跳转,根据原来 a 标签页 target 来判断是否需要新窗口打开 function getTopA(node){ //console.log(node) if(node.nodeName.toLocaleLowerCase() === 'a'){ return node; }else{ if(node.parentElement==null){ return null; }else{ return getTopA(node.parentElement); } } } function prevent(){ if (event.preventDefault) { event.preventDefault(); } else { window.event.returnValue = true; } } function noMenu(e) { // do something here... e.preventDefault(); window.removeEventListener('contextmenu',noMenu , false); } //console.log(target); //if(target.nodeName.toLocaleLowerCase() === 'i' || target.nodeName.toLocaleLowerCase() === 'div'){ //alert(target.nodeName) //console.log(target) if(target.nodeName.toLocaleLowerCase() === 'i'){ }else{ if(target.childNodes.length>=1){ target=getTopA(target.childNodes[0]); }else{ target=getTopA(target); } if(target!=null){ var url = target.getAttribute("href"); if(url!=null) { if(url.includes("https://l.facebook.com/l.php?u=")){ url=decodeURIComponent(url.substring("https://l.facebook.com/l.php?u=".length)); } if(url.match(/&*fbclid=.*&/)){ url=url.replace(/&*fbclid=.*&/,"") }else{ url=url.replace(/&*fbclid=.*/,"") } url=url.replace(/\?$/,"") target.setAttribute("href",url); if (target.getAttribute("target") === '_blank') { if(event.buttons==1){ prevent() window.open(url) } } //hack 改url if(event.button==2 && event.ctrlKey){ prevent() window.addEventListener('contextmenu',noMenu , false); navigator.clipboard.writeText(url) target.onmousdown=null; target.onmouseup=null; target.click=null; //window.open(url).close() //alert("複製連結成功") } } } } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址