Sleazy Fork is available in English.

sexinsex download seeds

增加页面顶部底部按钮和一键下种按钮

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @name         sexinsex download seeds
// @namespace    websiteEnhancement
// @author   jimmly
// @version      2024.7.19
// @description  增加页面顶部底部按钮和一键下种按钮
// @create         2023-9-21
// @include        http://sexinsex.net/bbs/*
// @include        *sexinsex*
// @grant         GM_getValue
// @grant         GM_setValue
// @grant         GM.getValue
// @grant         GM.setValue
// @license MIT
// @run-at document-end
// ==/UserScript==
;
(async function (loadJS) {
    Array.prototype.push = function (...items) {
        let len = this.length >>> 0;
        let argCount = items.length >>> 0;
        if (len + argCount > 2 ** 53 - 1) {
            throw new TypeError("Invalid array length");
        }
        for (let i = 0; i < argCount; i++) {
            this[len + i] = items[i];
        }
        this.length = len + argCount;
        return this.length;
    };
    loadJS("https://update.greasyfork.org/scripts/483173/1301961/GM_config_cnjames.js")
        .then(v => loadJS("https://update.sleazyfork.org/scripts/476583/common_libs_of_array.js"))
        .then(v => {
            withJQuery(function ($, win) {

                $('table a').removeAttr('style')

                let w = 40, h = 40;
                addStyle(`
                    a:link{color:green;}
                    a:hover{color:red;}
                    a:active{color:yellow;}
                    a:visited{color:orange;}
                    .btn1   {   
                        opacity:0.8;-moz-transition-duration:0.2s;-webkit-transition-duration:0.2s;
                        padding:1px; margin-top:1px;
                        font-size: 10; text-align: center; vertical-align: middle; line-height:${h}px;
                        border-radius:5px 5px 5px 5px;cursor:pointer; left:0px;z-index:9999;
                        background:white;  
                        width:${w}px;height:${h}px;
                    }
                `);
                let container = $(document.createElement('div')).css({
                    'cssText': `position:fixed;top:15%;width:${w}px;height:${h * 7}px;left:0px;z-index:9999`
                });


                if (win.location.href.indexOf("thread") != -1) {
                    //下载按钮 
                    let downloadBtn = $(document.createElement('div')).text('下載').appendTo(container)
                        .click(function () {
                            $("dl.t_attachlist>dt>a").each((i, element) => {
                                let url = $(element).prop('href');
                                let filename = $(element).text().trim();
                                if (filename.indexOf('torrent') == -1)
                                    return true;
                                console.log("download file name:", filename)
                                createSuperLabel(url, url, filename, window)
                            });

                        });
                    console.log('win.__t', win.__t)
                    let //close
                        closeBtn = $(document.createElement('div')).text('關閉').appendTo(container)
                            .click(function () {
                                win.open("about:blank", "_self").close();
                            }),
                        //加速
                        fastBtn = $(document.createElement('div')).text('加速').attr('title', '加速').appendTo(container)
                            .click(function () {
                                if (win.__wait > 5) {
                                    win.__wait = win.__wait / 1.5
                                } else {
                                    win.__wait = 5
                                }
                                win.___reset()

                            }),
                        switchBtn = $(document.createElement('div')).text(!win.__t ? '啓' : '停').appendTo(container)
                            .click(function () {
                                if (!win.__t) {
                                    win.__startTimer();
                                } else {
                                    win.__stopTimer()
                                }
                            }),
                        slowBtn = $(document.createElement('div')).text('減速').attr('title', '減速').appendTo(container)
                            .click(function () {
                                win.__wait *= 1.5
                                win.___reset()
                            })

                    $(document).keydown(function (event) {
                        let e = event || win.event;
                        let k = e.keyCode || e.which;
                        if (k === 16) {
                            //  isCtrl = true;
                            switchBtn.click()
                        } else if (k === 38) {  //up
                            event.stopPropagation()
                            slowBtn.click()

                        } else if (k === 40) {//down
                            event.stopPropagation()
                            //fastBtn.click()
                        }
                    })
                    $(document).mousedown(function (e) {
                        if (e.which == 2) {
                            downloadBtn.click();
                        }
                    })
                    $(win).blur(function () {
                        win.__stopTimer()
                    }).focus(function () {
                        win.__startTimer();
                    })

                    win.__wait = 900
                    win.__step = 100;
                    win.__startTimer = function () {
                        win.______h = $(document).scrollTop() + win.__step;
                        if (win.______h >= $(document).height() - $(win).height()) {
                            win.__stopTimer()
                            // win.__t = setTimeout(win.__startTimer, 30000)
                        } else {
                            $(document).scrollTop(win.______h);
                            win.__t = setTimeout(win.__startTimer, win.__wait)
                        }
                        win.__syncState()
                    };
                    win.__stopTimer = function () {
                        clearTimeout(win.__t)
                        win.__t = 0
                        win.__syncState()
                    }
                    win.___reset = function () {
                        win.__stopTimer()
                        win.__startTimer();
                        win.__syncState()
                    }
                    win.__syncState = function () {
                        fastBtn.text(`${Math.floor(win.__wait)}`)
                        slowBtn.text(`${Math.floor(win.__wait)}`)
                        switchBtn.text(win.__t ? '停' : '啓')
                    }
                }
                else {
                    $('tr').hover(
                        function () {
                            $(this).find('*').css("background-color", "#9AAAC7")
                        }, function () {
                            $(this).find('*').css("background-color", '');
                        });
                }
                //最顶按钮  
                let
                    toTopBtn = $(document.createElement('div')).text('Top').appendTo(container)
                        .click(function () {
                            win.scrollTo(0, 0);
                        }), //最低按钮
                    toBottomBtn = $(document.createElement('div')).text('Bottom').appendTo(container)
                        .click(function () {
                            win.scrollTo(0, document.body.scrollHeight);
                        }),

                    setBtn = $(document.createElement('div')).attr('id', 'btnSet').text('設置').appendTo(container)
                        .click(function () {
                            win.gmc.open();
                        });
                container
                    .find('div')
                    .addClass('btn1')
                    .hover(function (e) {
                        let o = $(this)
                        o.data('old_opacity', o.css('opacity'))
                            .data('old_border', o.css('border'))
                        o.css('opacity', 1).css('border', '1px solid black')
                    }, function (e) {
                        let o = $(this)
                        o.css('opacity', o.data('old_opacity')).css('border', o.data('old_border'))
                    })
                container.appendTo('body');
                autoFind(() => win.location.href.indexOf('thread') == -1, 'sis', 'span>a', el => el.text(), $, setBtn, win);

            })
        })


})(function (FILE_URL, async = true) {
    return new Promise((resolve, reject) => {
        let scriptEle = document.createElement("script");
        scriptEle.setAttribute("src", FILE_URL);
        scriptEle.setAttribute("type", "text/javascript");
        scriptEle.setAttribute("async", async);
        // success event 
        scriptEle.addEventListener("load", () => {
            resolve(FILE_URL)
        });
        // error event
        scriptEle.addEventListener("error", (ev) => {
            reject(ev);
        });
        if (document.currentScript)
            document.currentScript.insertBefore(scriptEle)
        else
            (document.head || document.getElementsByTagName('head')[0]).appendChild(scriptEle);
    })
});