Greasy Fork

Greasy Fork is available in English.

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

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

目前为 2020-12-31 提交的版本,查看 最新版本

// ==UserScript==
// @name         zd423|吾爱|果核|卡饭|殁漂遥 精简去推广
// @namespace    http://tampermonkey.net/
// @version      0.7
// @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();
   var url = window.location.href;
   //匹配殁漂遥帖子详情页面
   var mpyitPattern = new RegExp("https://www.mpyit.com/+[\u4E00-\u9FA5A-Za-z0-9]*.html");
   //去除zd置顶推广内容
   if (url == 'https://www.423down.com/') {
      var ul = document.querySelector("#hasfixed > div.wrapper > div.content-wrap > div > ul").children;
      for (var i = 0; i < ul.length; i++) {
         let a = ul[i].querySelectorAll('a');
         for (var j = 0; j < a.length; 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();
      var 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) {
      var sp = document.querySelector("#separatorline");
      var parent = document.querySelector("#threadlisttableid").children;
      var 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) {
      var se = document.querySelectorAll('section');
      for (var i = 1; i < 4; i++) {
         se[i].style.display = 'none';
      }
      var top = document.querySelectorAll('.sticky-post');
      for (i = 0; i < top.length; i++) {
         top[i].parentNode.parentNode.parentNode.parentNode.style.display = 'none';
      }
   }
   //卡饭自动签到,只去除软件下载板块的版规和一个无用置顶内容
   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) {
      document.getElementById('playBax').style.display = 'none';
      document.getElementById('sidebar').style.display = 'none';
      document.querySelector("#wrapper > div.keywords").remove();
      document.querySelector("#wrapper > div.footer_bottom").remove();
      document.querySelector("#map").remove();
      var post = document.getElementById('post');
      post.style.marginLeft = "15%";
      var ch = post.children;
      for (let i = 1; i < 5; i++) {
         ch[i].style.display = 'none';
      }
   }
   //殁漂遥帖子详情页面去除无用内容,布局居中
   else if (mpyitPattern.test(url)) {
      document.querySelector("#wrapper > div.keywords").remove();
      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%";
   }
})();