Sleazy Fork is available in English.

MrCong全量加載

mrCong全量加載,啦啦啦

Fra og med 17.05.2022. Se den nyeste version.

// ==UserScript==
// @name         MrCong全量加載
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  mrCong全量加載,啦啦啦
// @author       LARA_SSR
// @match        https://mrcong.com/*/
// @exclude      https://mrcong.com/tag/*
// @exclude      https://mrcong.com/category/*
// @exclude      https://mrcong.com/sets/*
// @exclude      https://mrcong.com/top*/*
// @exclude      https://mrcong.com/tim-kiem/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// @require      https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
// ==/UserScript==

console.clear();

(function () {
    'use strict';
    let id = setInterval(async function () {
        if (Fancybox4) {
            //打印开关
            debugger
            isDebug = false;
            log("Fancybox4 --- isActive!\n");
            clearInterval(id);
            if (os.isAndroid || os.isPhone) //判断是否Android或Phone
            {

                addStyle(fancyBoxCss);
                let open = 'Default';
                switch (open) {
                    case 'Fullscreen':
                        addStyle(fancyBoxCssAdditon);
                        addScript(fancyboxFullJs);
                        break;
                    case 'Default':
                        addStyle(`a[data-fancybox] img{cursor:zoom-in;}`);
                        addScript(fancyboxDefaultJs);
                        break;
                };
                //获取页数
                let paginationClass = "div .page-link";
                let length = 0;
                let paginationExist = false;
                $(paginationClass).each(function () {
                    if (paginationExist == true) {
                        return false;
                    }
                    length = $(this).find("a").length;
                    paginationExist = true;
                    //console.log(linkArr);
                    console.log("页数:" + length);
                });

                //标题
                addStyle(`
                .titleHrefs,.postTagHrefs {
                    padding:1px 5px;
                }
                #title_info {
                    color:pink;
                    border:1px solid;
                    border-color:rgba(0,0,0,0);
                    border-bottom-color:pink;
                }
                #separate {
                    color:white;
                }
                #downHref>a {
                    color:pink;
                    border:1px solid;
                    border-color:rgba(0,0,0,0);
                    border-bottom-color:#815c94;
                }
                .titleHrefs>div,.postTagHrefs>div {
                    display:inline;
                }
                #spanitemdiv {
                    color:#FFFAF0;
                }
                #spanitem {
                    color:#FFFAF0;
                }
            `);
                let titleHrefs = $("<div class = titleHrefs></div>");
                let postTagHrefs = $("<div class = postTagHrefs></div>");

                await new Promise(function (resolve) {
                    $("#crumbs a").each(function (index, value) {
                        let hrefDiv = $("<div class = hrefDiv></div>")
                        let title = $(this).attr("id", "title_info");
                        hrefDiv.append(title)
                        titleHrefs.append(hrefDiv);
                        // console.log(title);
                        let p3 = $("<div id = separate>\xa0/\xa0</div>");
                        titleHrefs.append(p3);
                    });
                    $(".post-tag a").each(function (index, value) {
                        let hrefDiv = $("<div class = hrefDiv></div>")
                        let title = $(this).attr("id", "title_info");
                        hrefDiv.append(title)
                        postTagHrefs.append(hrefDiv);
                        // console.log(title);
                        let p3 = $("<div id = separate>\xa0/\xa0</div>");
                        postTagHrefs.append(p3);
                    });
                    resolve();
                });

                let password = $("strong+input[value]").attr('value');
                console.log("Password: " + password);

                let patt = /(?<=Dung lượng: )(\d+|([1-9]\d*\.?\d+))[A-Za-z]*(B|b)/g
                let inerBoxStr = $(".box-inner-block").text()
                // console.log(inerBoxStr);
                let imgSize = inerBoxStr.match(patt)[0];
                console.log(imgSize);
                let downHref;
                let p3;
                //let p3 =$("<b id = separate>\xa0/\xa0</b>")
                $("p[style] a").each(function (index, value) {

                    downHref = $("<div id = downHref></div>");
                    let itemTitleHref = $("<a>图片下载</a>").attr("href", $(this)[0].href).text(`图片下载链接[ ${index+1} ]`);

                    downHref.append(itemTitleHref);
                    titleHrefs.append(downHref);
                    p3 = $("<div id = separate>\xa0/\xa0</div>");
                    downHref.after(p3);
                })
                //titleHrefs.append(p3)
                p3 = $("<div id = separate>\xa0/\xa0</div>");
                titleHrefs.append($("<div id = spanitem></div>").text(`解压密码: (${password})`))
                p3 = $("<div id = separate>\xa0/\xa0</div>");
                titleHrefs.append(p3);
                titleHrefs.append($("<div id = spanitem></div>").text(`图片大小: (${imgSize})`))
                p3 = $("<div id = separate>\xa0/\xa0</div>");
                titleHrefs.append(p3);
                let SpanItemDiv = $("<div id = spanitemdiv></div>")
                let spanItem = $("span[itemprop]").text();
                // console.log(spanItem);
                SpanItemDiv.append(spanItem);
                titleHrefs.append(SpanItemDiv);


                addStyle(`
                ul li {
                    list-style-type:none;
                }
                body {
                    background:#4a4035;
                    // font-family:-apple-system,BlinkMacSystemFont,Tahoma,Arial,"Hiragino Sans GB","Microsoft YaHei",sans-serif;
                    font-family: fantasy,sans-serif;
                }
                #viewer {
                    padding:0px;
                    margin:0px;
                }
                .imgbox {
                    width:100%;
                    position:relative;
                    overflow:hidden;
                    box-sizing:border-box;
                    padding:1px;
                }
                .imgnum {
                    position:absolute;
                    font-size:90%;
                    left:5px;
                    top:5px;
                    background:#17A1FF;
                    background:rgba(23,161,255,0.5);
                    z-index:100;
                    padding:0px 5px 1px 5px;
                    color:#f9f9f9;
                    color:rgba(249,249,249,1);
                    border-radius:2px;
                }
                .imgs {
                    width:100%;
                    float:left;
                    border-radius:4px;
                }
            `);

                $("body").empty();
                let i = 1;
                let str3 = self.location.href;
                let newStr = str3.replace(/-anh.+/g, "");
                let link = "";
                let viewer2 = $('<ul id ="viewer"></ul>');
                $("body").append(viewer2);
                viewer2.append(titleHrefs);
                let n = 0;
                do {
                    link = newStr + "-anh/" + i;
                    let data = await Get(link);

                    let image = $(".content img", data);
                    image.each(function (index, item) {
                        n++;
                        let imgli = $('<li class = "imgbox"></li>');
                        let imageItem = '<a data-fancybox=\"images\" href=\"' + $(this)[0].src + '\"><img class=\"imgs\" src=\"' + $(this)[0].src + '\" ></a>';

                        //序号
                        let stringNum = "<div class = 'imgnum'>{imgnum}</div>";
                        let newStringNum = stringNum.replace('{imgnum}', `${n}`)
                        imgli = imgli.prepend($(newStringNum));

                        imgli = imgli.append(imageItem);
                        viewer2.append(imgli)
                    });

                    i = i + 1;
                    if (i === (length + 2)) {
                        $(document).ready(function () {
                            $("#viewer").after(postTagHrefs);
                        });
                    }
                } while (i < length + 2);


                let imgCount = $("#viewer img").length;
                console.log("imgCount: " + imgCount);

                $(".imgnum").each(function (index, value) {
                    if (index < imgCount) {
                        // console.log($(this));
                        $(this).text(`[${index+1}/${imgCount}]`)
                    } else {
                        return false;
                    }
                })

                //删除标题最后一个"/"
                $(document).ready(function () {
                    // $(".titleHrefs div").eq(-1).remove();
                    $(".postTagHrefs #separate").eq(-1).remove();
                });

            }
        }
    }, 100);
})();