Greasy Fork

Greasy Fork is available in English.

殁漂遥

mpyit.com 浏览体验优化

当前为 2021-03-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         殁漂遥
// @icon         https://www.mpyit.com/favicon.ico
// @namespace    mpyitOptimizing
// @version      1.03
// @description  mpyit.com 浏览体验优化
// @author       殁漂遥
// @include      *://*mpyit.com/*
// @grant        none
// @require      https://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function () {
    let complete_url = window.location.href;
    let valiable = complete_url.split("?")[0];
    window.history.pushState({},0,valiable);
    $("#pagenavi").remove();
    $(".scroll").remove();
    $("body").append("<input value='2' id='page-number' type='hidden'>");
    let verify_code = $("#entry input[type=text]");
    if (verify_code.length > 0) {
        $.ajax({
            url: window.location.href,
            type: "POST",
            data: {huoduan_verifycode: "这里填写验证码"},
            success: function (result) {
                let start = result.search(/\<\!--wechatfans start--\>/);
                let end = result.search(/\<\!--wechatfans end--\>/);
                let that_div = verify_code.parent().parent();
                let div_style = "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;"
                that_div.attr("style", div_style + "background-color:#FFBED0;");
                that_div.html("加载中");
                if (start == end) {
                    that_div.attr("style", div_style + "background-color:#FFCBCB;");
                    that_div.html("加载失败");
                } else {
                    that_div.attr("style", div_style + "background-color:#EBF7FF;");
                    that_div.html(result.slice(start, end));
                }
            }
        });
    }
})();
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 = "";
            let has_page = /\/page\/\d{1,9}/;
            if (has_page.test(this_url)) {
                let page_str = this_url.match(has_page)[0];
                let page_number = parseInt(page_str.match(/\d{1,9}/)[0]) + 1;
                page_div = "page-" + page_number;
                page_url = this_url.replace(page_str, "/page/" + page_number);
            } else {
                let page_number = parseInt($("#page-number").val());
                page_div = "page-" + page_number;
                page_url = this_url + "/page/" + page_number;
                $("#page-number").val(page_number + 1);
            }
            $("#wrapper").append("<div id='post' class='" + page_div +"'></div>");
            $.ajax({
                url: page_url,
                type: "GET",
                success: function (result) {
                    let start = result.search(/\<div id\=\"post\"\>/);
                    let end;
                    if (start == -1) {
                        start = result.search(/\<div id\=\"content\"\>/);
                        end = result.search(/\<div id\=\"sidebar\"\>/);
                    } else { end = result.search(/\<div id\=\"pagenavi/); }
                    $("." + page_div).html(result.slice(start, end));
                    $("." + page_div + " .post-99999").remove();
                    $("." + page_div + " #map").remove();
                    $("." + page_div + " #pagenavi").remove();
                    scroll_allow = true;
                }
            });
        }
    }
});

document.body.oncopy = function () { return; };