Greasy Fork

Greasy Fork is available in English.

zd423|吾爱|果核|卡饭|殁漂遥 精简去推广

页面精简去推广内容只留主内容,卡饭自动签到

目前为 2021-03-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         zd423|吾爱|果核|卡饭|殁漂遥 精简去推广
// @namespace    http://tampermonkey.net/
// @version      0.8.3.1
// @description  页面精简去推广内容只留主内容,卡饭自动签到
// @author       You
// @match        http://bbs.zhiyoo.net/search.php?mod=forum&adv=yes
// @match        https://www.423down.com/
// @match        https://www.52pojie.cn/search.php*
// @match        https://www.52pojie.cn/forum*
// @match        https://www.ghpym.com/*
// @match        https://www.ghpym.com/?btwaf*
// @match        https://bbs.kafan.cn/forum-65-1.html
// @match        https://www.mpyit.com/*
// @namespace    http://greasyfork.icu/zh-CN/scripts/417544
// @grant        none
// ==/UserScript==


(function () {
    'use strict';
    //每次进入前清除控制台信息
    console.clear();
    let url = window.location.href;
    //匹配殁漂遥帖子详情页面
    let mpyitPattern = new RegExp("https://www.mpyit.com/+[\u4E00-\u9FA5A-Za-z0-9]*.html");
    //去除zd置顶推广内容
    if (url == 'https://www.423down.com/') {
        let ul = document.querySelector("#hasfixed > div.wrapper > div.content-wrap > div > ul").children;
        for (let i = ul.length - 1; i > -1; i--) {
            let a = ul[i].querySelectorAll('a');
            for (let j = a.length - 1; j > -1; j--) {
                if (a[j].innerText.indexOf('优惠活动') != -1) {
                    ul[i].remove();
                    break;
                }
            }
        }
    }
    //智友搜索按发布时间排序,精简多余内容
    else if (url.indexOf('http://bbs.zhiyoo.net/search') != -1) {
        document.querySelector("#scform > tbody > tr > td:nth-child(1) > h1 > img").remove();
        document.querySelector("#ct > div > div > div.sttl.mbn").remove();
        let order = document.getElementById('orderby1');
        if (order != null) {
            order.options[1].selected = true;
        }
    }
    //吾爱搜索按发布时间排序
    else if (url.indexOf('/www.52pojie.cn/search') != -1) {
        document.getElementById('orderby1').options[1].selected = true;
    }
    //去除所有官方置顶帖子
    else if (url.indexOf('52pojie.cn/forum') != -1) {
        let sp = document.querySelector("#separatorline");
        let parent = document.querySelector("#threadlisttableid").children;
        let n = 0;
        while (sp = sp.previousElementSibling) {
            n++;
        }
        for (; n > -1; n--) {
            parent[n].remove();
        }
    }
    //去除果核置顶推广内容,精简页面无用内容
    else if (url == 'https://www.ghpym.com/' || url.indexOf('://www.ghpym.com/?btwaf') != -1) {
        document.querySelector("#modules-2 > aside").remove();
        let wrap = document.querySelector("#wrap").children;
        let len = wrap.length - 1;
        for (let i = len; i > -1; i--) {
            if (i != 0 && i != len) {
                wrap[i].remove();
            }
        }
        document.querySelector("body > footer").remove();
        let se = document.querySelectorAll('section');
        for (let i = 1; i < 4; i++) {
            se[i].style.display = 'none';
        }
        let top = document.querySelectorAll('.sticky-post');
        for (let i = 0; i < top.length; i++) {
            top[i].parentNode.parentNode.parentNode.parentNode.style.display = 'none';
        }
        document.querySelector("#modules-2 > div").style.marginLeft = "15%";
        document.querySelector("body > div.action.action-style-0.action-color-0.action-pos-0 > div.action-item.j-share").remove();
    }
    //精简果核帖子详情页面
    else if (url.indexOf('www.ghpym.com') != -1 && url.indexOf('.html') != -1) {
        document.querySelector("body > footer").remove();
        document.querySelector("#wpcom-post-thumb-2").remove();
        document.querySelector("body > div.action.action-style-0.action-color-0.action-pos-0 > div.action-item.j-share").remove();
    }
    //卡饭自动签到,只去除软件下载板块的版规和一个无用置顶内容
    else if (url.indexOf('https://bbs.kafan.cn/forum-65-1.html') != -1) {
        document.querySelector('.comeing_box').style.display = 'none';
        document.querySelectorAll('.bm')[2].style.display = 'none';
        document.getElementById('threadlisttableid').children[0].style.display = 'none';
        //签到
        if (document.querySelector("#pper_b").style.display == 'none') {
            document.querySelector("#pper_a").click();
        }
    }
    //去除殁漂遥主页置顶推广和其他无用内容,调整样式使其居中
    //傻逼殁漂遥,天天变来变去,你变我就更,狗逼玩意
    // else if (url == 'https://www.mpyit.com/' || url.indexOf('www.mpyit.com/?btwaf') != -1) {
    //      publishRemove();
    //     //顶部大字推广
    //     var bigAd = document.querySelector("#wrapper > div:nth-child(4)");
    //     isExitsRemove(bigAd);
    //     //右部广告声明等模块
    //     var rightAd = document.querySelector("#wrapper > div:nth-child(6)");
    //     isExitsRemove(rightAd);
    //     // 推广帖子,包含 现在位置: 首页 那一块div
    //     let post = document.getElementById('post');
    //     post.style.marginLeft = "15%";
    //     let ch = post.children;
    //     for (let i = 0; i < 4; i++) {
    //         ch[i].style.display = 'none';
    //     }
    //     //let clsKey = "#wrapper > div.key";
    //     // let key = document.querySelector(clsKey);
    //     // let keys = document.querySelector(clsKey + 's');
    //     // isExitsRemove(key,keys);
    //     // document.querySelector("#sidebar").remove();
    //     // document.querySelector("#map").remove();
    //     //   for (let i = 0; i < 50; i++) {
    //     //       let zbId = 'zb' + i;
    //     //       let zb = document.getElementById(zbId);
    //     //       if (zb) {
    //     //           zb.remove();
    //     //       }
    //     //   }
    //     //底部
    //     document.querySelector("#wrapper > div.footer_bottom").remove();
    // }
    // //殁漂遥帖子详情页面去除无用内容,布局居中
    // else if (mpyitPattern.test(url)) {
    //     publishRemove();
    //     var rightAd = document.querySelector("#wrapper > div:nth-child(8)");
    //     isExitsRemove(rightAd);
    //     document.querySelector("#sidebar").remove();
    //     document.querySelector("#content > h3:nth-child(3)").remove();
    //     document.querySelector("#content > div.entry_b").remove();
    //     document.querySelector("#wrapper > div.footer_bottom_a").remove();
    //     document.querySelector("#wrapper > div.footer_top").remove();
    //     document.querySelector("#content").style.marginLeft = "15%";
    // }
    //共用
    function publishRemove() {
        //顶部热门标签
        var hotTag = document.querySelector("#wrapper > div:nth-child(2)");
        isExitsRemove(hotTag);
        
    }

    //存在就删除
    function isExitsRemove(el1, el2) {
        if (el1) {
            el1.style.display = 'none';
        } else if (el2) {
            el2.style.display = 'none';
        }
    }
})();