您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect some fakeptt pages which couldn't replace by regular expression to Ptt
// ==UserScript== // @name Redirect fakeptt to Ptt // @namespace Violentmonkey Scripts // @description Redirect some fakeptt pages which couldn't replace by regular expression to Ptt // @match https://ptthito.com/* // @match https://pttview.com/* // @match http://pttweb.com/* // @match https://pttweb.tw/* // @match http://pttread.com/* // @match http://hotptt.com/* // @version 0.2.4 // @grant none // @run-at document-start // ==/UserScript== "use strict" let url = window.location.href; let pattern = /https?:\/\/(?:(?:pttview|pttweb|ptthito|pttread)\.com|pttweb\.tw)\/([\w\-]+)\/m-(\d+)-a-([0-9a-z]{3}).*/i; let match_group = url.match(pattern); if (match_group !== null) { url = `https://www.ptt.cc/bbs/${match_group[1]}/M.${match_group[2]}.A.${match_group[3].toUpperCase()}.html`; window.location.replace(url); } document.addEventListener("DOMContentLoaded", function () { let pttUrl = ''; let elements = document.querySelectorAll(".f2"); for (let i = 0; i < elements.length; i++) { let pattern = /(https:\/\/www\.ptt\.cc\/bbs\/[\w\-]+\/M\.\d{10}\.A\.[0-9A-Z]{3}.html)/i; let match_group = elements[i].innerText.match(pattern); if (match_group) { pttUrl = match_group[0]; } } if (pttUrl) { window.location.replace(pttUrl); } })