Greasy Fork is available in English.

NGA调整

个人简陋制作 去除NGA无用信息 只保留帖子 去除广告 去除推荐 反跳转 重定向域名

// ==UserScript==
// @name         NGA调整
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  个人简陋制作 去除NGA无用信息 只保留帖子 去除广告 去除推荐 反跳转 重定向域名
// @author       Atail
// @include      *://*.nga.cn/*
// @include      *://ngabbs.com/*
// @include      *://g.nga.cn/*
// @include      *://*.ngacn.cc/*
// @include      *://nga.178.com/*
// @match       *bbs.nga.cn/thread.php?fid=*
// @match       *bbs.nga.cn/read.php?tid=*
// @match       *bbs.nga.cn/nuke.php?*
// @grant        none
// ==/UserScript==

(document.onreadystatechange = function() {
    if(document.location.href.indexOf("nga.178.com")>-1 || document.location.href.indexOf("ngacn.cc")>-1 || document.location.href.indexOf("ngabbs.com")>-1 ||  document.location.href.indexOf("g.nga.cn")>-1){
    	document.location.href = document.location.href.replace('nga.178.com', 'bbs.nga.cn').replace('ngabbs.com','bbs.nga.cn').replace('g.nga', 'bbs.nga').replace('ngacn.cc', 'nga.cn');
    }
	if(document.readyState == 'complete'){
	    'use strict';
	    //去除版头
	    try{
		    const toptopics = document.getElementById('toptopics');
		    toptopics.style.display = "none";
	    }catch(e){
	    	console.log(e);
	    }
		//去除推荐
		try{
		    const bbsads9add = document.getElementById('bbs_ads9_add');
		    bbsads9add.style.display = "none";
	    }catch(e){
	    	console.log(e);
	    }
	    //去除无class无id无妈广告
	    try{
		    const ad1 = document.getElementById('m_threads').childNodes[1].childNodes[3];
			ad1.style.display = "none";
			const ad2 = document.getElementById('b_nav').childNodes[4];
			ad2.style.display = "none";
			const ad3 = document.getElementById('fast_post_c').childNodes[0].childNodes[0].childNodes[0].childNodes[2].childNodes[0].childNodes[1];
			ad3.style.display = "none";
	    }catch(e){
	    	console.log(e);
	    }
	    try{
			const ad4 = document.getElementById('m_cate5').childNodes[1];
			ad4.style.display = "none";
			const ad5 = document.getElementById('m_cate5').childNodes[0].childNodes[1];
			ad5.style.display = "none";
	    }catch(e){
	    	console.log(e);
	    }
	    try{
			const ad6 = document.getElementById('m_posts').childNodes[1].childNodes[4];
			ad6.style.display = "none";
			const ad7 = document.getElementById('b_nav').childNodes[3];
			ad7.style.display = "none";
			const ad8 = document.getElementById('fast_post_c').childNodes[0].childNodes[0].childNodes[0].childNodes[2].childNodes[0].childNodes[1];
			ad8.style.display = "none";
	    }catch(e){
	    	console.log(e);
	    }
	    //反跳转
	    try{
			const ngaurl = window.location.href;
			const fakeurl = ngaurl.search("bbs.nga.cn/misc");
			const fakeurllength = 38 + fakeurl;
			const trueurl = ngaurl.substring(fakeurllength);
			if(fakeurl != -1){
				window.location.href = trueurl;
			}
	    }catch(e){
	    	console.log(e);
	    }
	}else{
		console.log("error");
	}
})();