Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name 綠色共產互聯網中介法審查創造安全和諧網路環境
- // @namespace https://www.plurk.com/SpyMomiji
- // @version 0.1
- // @description 將"此文章/討論串不存在或已被刪除" 替換成 "由於此訊息不符合國家網路中介法,已被屏蔽"
- // @author SpyMomiji
- // @match https://forum.gamer.com.tw/C.php?*
- // @match https://forum.gamer.com.tw/Co.php?*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- function busyPromise(waitFor,timeout=0){
- return new Promise((a,b)=>{
- var r,i,t;
- if(Boolean(r=waitFor())){
- return a(r);
- }
- i = setInterval(function(){
- try{
- if(Boolean(r=waitFor())){
- clearInterval(i);
- clearTimeout(t);
- a(r);
- }
- } catch(e){
- clearInterval(i);
- clearTimeout(t);
- b(e)
- }
- },1);
- if(timeout) t = setTimeout(function(){
- clearInterval(i);
- try{a(waitFor())}
- catch(e){b(e)}
- },timeout);
- })
- }
- function getTag(what, src = document.body){
- return Array.from(src.getElementsByTagName(what));
- }
- (async function(){
- await busyPromise(()=>document.readyState=='complete',2000);
- if( getTag('title', document.head)[0].innerText
- != '巴哈姆特電玩資訊站 - 系統訊息')
- return;
- var dom =
- getTag('div')
- .filter( dom => dom.className == 'frame' )[0];
- dom =
- getTag('p',dom)
- .filter( d => d.innerText == '此文章/討論串不存在或已被刪除' )[0];
- dom.innerText = '由於此訊息不符合國家網路中介法,已被屏蔽';
- })()
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement