// ==UserScript== // @name NGA广告跳转 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 自动跳转NGA广告 // @include /^https?:\/\/(bbs\.ngacn\.cc|nga\.178\.com|bbs\.nga\.cn)/ // @author Endward // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Your code here... let currentURL = window.location.href; let adRegex = /adpage_insert/; if(adRegex.test(currentURL)){ let realRegex = [/https?:\/\/bbs.nga.cn\/read.*$/, /https?:\/\/bbs.ngacn.cc\/read.*$/, /https?:\/\/nga.178.com\/read.*$/]; for(let i = 0; i < realRegex.length; i++){ let realUrl = realRegex[i].exec(currentURL); if(realUrl){ window.location.href = realUrl; } } } })();