Greasy Fork

Greasy Fork is available in English.

殁漂遥无用元素清理[JS]

mpyit.com 浏览体验优化

当前为 2021-04-05 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         殁漂遥无用元素清理[JS]
// @icon         https://www.mpyit.com/favicon.ico
// @namespace    mpyitOptimizing
// @version      1.18.3
// @description  mpyit.com 浏览体验优化
// @author       殁漂遥
// @include      *://*mpyit.com/*
// @grant        GM_addStyle
// @require      https://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function () {
    let verify_code_string = "";
    let complete_url = window.location.href;
    let valiable = complete_url.split("?")[0];
    let btwaf = getUrlParam("btwaf");
    $("body").append("<input value='" + btwaf +"' id='btwaf' type='hidden'><input value='2' id='page-number' type='hidden'>");
    $("#topnav").find("div:visible img").first().parent().remove(); $("#post:hidden").remove(); $(".footer_top").remove(); $(".link").remove(); $(".link_b").remove(); $("div[class*='footer_bottom']").remove();
    $(".menu a:contains('支持')").parent().html('<a target="_blank" href="http://greasyfork.icu/zh-CN/scripts/422943-%E6%AE%81%E6%BC%82%E9%81%A5/feedback">脚本问题反馈</a>');
    let ad_list = ["#s2b"]; for (let x in ad_list) $(ad_list[x]).remove();
    let is_home = (window.location.pathname.length <= 2);
    window.history.pushState({},0,valiable);
    if (is_home) { $("#pagenavi").remove(),$(".scroll").remove(),adTag(),feedback(),rubbishRemove(),$("#wrapper > div").each(function(e,a){let r=$(this).attr("class"),t=$(this).attr("id");null==r&&null==t&&$(this).remove()}); }
    else { $(".entry_title_box").css("padding","0"),$(".entry_box_s").children("div").last().remove(),$("div[class='top'][id='top']").remove();let verify_code=$("#entry input[type='password']");verify_code.length>0&&$.ajax({url:"https://api.axzjl.com/se7en/public/mpyit",success:function(e){if(verify_code_string=e.data.verify,verify_code_string.length>0){let e={};e[verify_code.attr("name")]=verify_code_string,$.ajax({url:window.location.href+$("#btwaf").val()?"?btwaf="+$("#btwaf").val():"",type:"POST",data:e,success:function(e){let t=e.search(/\<\!--wechatfans start--\>/),a=e.search(/\<\!--wechatfans end--\>/),r=verify_code.parent().parent(),o="border:2px dashed #06a0ff; padding:10px;margin:10px 0;line-height:200%;overflow:hidden;clear:both;background-position: 100% 50%;background-repeat: repeat-x;background-size: 30.904%;background-attachment: scroll;box-sizing: border-box;";r.attr("style",o+"background-color:#FFBED0;"),r.html("加载中"),t==a?(r.attr("style",o+"background-color:#FFCBCB;"),r.html("加载失败")):(r.attr("style",o+"background-color:#EBF7FF;"),r.html(e.slice(t,a)))}})}}}); }
})();
GM_addStyle();
let scroll_allow = true; $(".entry img").click(function () { return false; });
$(window).scroll(function () {
    if ($(document).scrollTop() + $(window).height() >= $(document).height()) {
        if (scroll_allow == false) { return; } let this_url = window.location.href; let reg = /\.html/; let page_div = "";
        if (reg.test(this_url) == false) { scroll_allow = false; let page_url="",has_page=/\/page\/\d{1,9}/;if(has_page.test(this_url)){let e=this_url.match(has_page)[0],a=parseInt(e.match(/\d{1,9}/)[0])+1;page_div="page-"+a,page_url=this_url.replace(e,"/page/"+a)}else{let e=parseInt($("#page-number").val());page_div="page-"+e,page_url=this_url+"/page/"+e,$("#page-number").val(e+1)}$("#wrapper").append("<div id='post' class='"+page_div+"'></div>"),page_url+="?btwaf="+$("#btwaf").val(),$.ajax({url:page_url,type:"GET",success:function(e){let a,p=e.search(/\<div id\=\"post\"\>/);-1==p?(p=e.search(/\<div id\=\"content\"\>/),a=e.search(/\<div id\=\"sidebar\"\>/)):a=e.search(/\<div id\=\"pagenavi/),$("."+page_div).css({margin:" 0 auto",float:"none"}),$("."+page_div).html(e.slice(p,a)),$("."+page_div+" #map").remove(),$("."+page_div+" #words").remove(),$("."+page_div+" #pagenavi").remove(),$("."+page_div+" #post").find("div").first().remove(),$("."+page_div+" #post > div").each(function(e,a){/post-\S{1,} post/.test($(this).attr("class"))||$(this).remove()}),$("."+page_div+" #post p a[href*='cdn/html/helppay']").parents("p").remove(),scroll_allow=!0},error:function(e){window.reload()}}); }
    }
});

document.body.oncopy = function () { return; };
function getUrlParam(t){let e=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),n=window.location.search.substr(1).match(e);return null!=n?unescape(n[2]):""}function adTag(){$("div[class*='post'] .info").each(function(t,e){let n=$(this).contents();/正牌/.test(n[3].data)&&$(this).prev().append('&nbsp;<span style="font-size:10px;border-radius:5px;background:#F00;padding: 0.25em 0.25em;font-weight:400;color:#FFF;">广告</span>')})}function feedback(){let t=$("#post a[href*='cdn/s1b']");0==t.length&&(t=$("#post > div a:contains('谨防上当')")),t.parent().html('<span style="color:#009900;">在使用该脚本时遇到问题请及时到 <a href="http://greasyfork.icu/zh-CN/scripts/422943-%E6%AE%81%E6%BC%82%E9%81%A5/feedback" target="_blank" style="color:#FB7299;font-weight:700;">这里</a> 反馈</span>')}function rubbishRemove(){$("#post > div > p").remove(),$("#post").nextAll().remove()}