Sleazy Fork is available in English.

115艾薇预览

115登录后自动跳转到文件界面、文件界面放大、自动获取艾薇封面+标题(需文件或文件夹名含有番号,暂只支持有码番,数据来源:AVMOO)

От 06.01.2019. Виж последната версия.

// ==UserScript==
// @name              115艾薇预览
// @namespace     http://tampermonkey.net/
// @version           1.1
// @description     115登录后自动跳转到文件界面、文件界面放大、自动获取艾薇封面+标题(需文件或文件夹名含有番号,暂只支持有码番,数据来源:AVMOO)
// @author            kyay006
// @include           https://115.com/home/userhome
// @include           https://115.com/?*mode=wangpan*
// @domain           avmoo.xyz
// @grant              GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';
    if(window.location.href === "https://115.com/home/userhome")
        window.location = "https://115.com/?mode=wangpan";
    else
    {
        var node;
        var ifr = $("iframe[style='position: absolute; top: 0px;']");
        $("div#js-main_mode").css("display","none");
        $("div.main-core").css("left","0");
        ifr.load(
            function(){
                setCss();
                var ifrbody = ifr.contents().find("body");
                node = ifrbody.find("div#js_data_list");
                var a = `
                        <a id='quick_add' class='button btn-linear-blue' style="cursor:pointer;">
                            <span>添加磁力</span>
                        </a>
                        `;
                ifrbody.find("a#js_upload_btn").before(a);
                ifrbody.find("a#quick_add").click(function(){
                    ifrbody.find("i.illt-offline").click();
                });
                node.mouseenter(
                    function(){
                        if($("div.exph-loader").css("display") === "none" && !(node.find("div#isload").length))
                            itemFunction();
                    }
                );
            }
        );
    }

    function itemFunction(){
        node.append("<div id='isload'></div>");
        var item = node.find("li");
        item.mouseenter(
            function(f){
                var id = getVideoCode($(this).attr("title"));
                if(id){
                    if(!(node.find("div#"+id).length))
                        getVideoInfo(id);
                    showVideoInfo(node.find("div#"+id),f.clientX,f.clientY)
                }
            }
        );
        item.mouseleave(
            function(){
                var id = getVideoCode($(this).attr("title"));
                node.find("div#"+id).css("display","none");
            }
        );
        item.click(
            function(){
                var id = getVideoCode($(this).attr("title"));
                node.find("div#"+id).css("display","none");
            }
        );
    };

    function getVideoInfo(fanhao){
        var info = "<div id='"+ fanhao +"' class='item_info'></div>";
        node.append(info);
        GM_xmlhttpRequest({
            method: "GET",
            url: "https://avmoo.xyz/cn/search/" + fanhao,
            onload: xhr => {
                var xhr_data = $(xhr.responseText);
                if(!(xhr_data.find("div.alert").length)){
                    var title = xhr_data.find("div.photo-info span").html();
                    var item_info = node.find("#"+fanhao);
                    var info_html ="<div class='item_border'>"
                                          +"<h4>"+title+"</h4>"
                                          +"</div>";
                    item_info.append(info_html);
                    var p_url = xhr_data.find("div.photo-frame img").attr("src").replace("ps.j","pl.j");;
                    item_info.find(".item_border").append("<img src='"+p_url +"'>");
                }
            }
        });
    }

    function showVideoInfo(ele, x, y){
        if(x + 400 > ifr.width())
            x = x - 400;
        var ty = y + 326;
        if(ty > ifr.height())
            y = y - (ty - ifr.height());
        ele.css("left",x);
        ele.css("top",y);
        ele.css("display","block");
    }

    function setCss(){
    	ifr.contents().find("head").append(`
        	<style type='text/css'>
        		.item_info{
        			display:none;
        			width:400px;
        			position:fixed;
        			z-index:100;
        			border-radius:5px;
        			background:rgba(248,248,255,0.7);
        		}
        		.item_border{
                    margin:5px;
        			padding:5px 5px 0px 5px;
        			border:1px solid gray;
        			border-radius:5px;
        		}
        		.item_border h4{
        			margin-bottom:5px;
        		}
        		.item_border img{
        			width:100%;
        		}
        	</style>
        `);
    }

    function getVideoCode(title){
        var t = title.match(/[A-Za-z]+\-\d+/);
        if(!t){
            t = title.match(/[A-Za-z]+\d+/);
        }
        return t;
    }
})();