Greasy Fork is available in English.

人人影视自动跳转编辑页面

体验完美人生

Ekde 2018/04/08. Vidu La ĝisdata versio.

// ==UserScript==
// @name         人人影视自动跳转编辑页面
// @namespace    http://www.lujunzhao.cn/
// @version      0.1.2
// @description  体验完美人生
// @author       aimei5544
// @match        *://www.zimuzu.tv/*
// @match        *://oabt004.com/*
// @match        *://*.cili001.com/*
// @grant        GM_AddStyle
// @note            v0.2重复自动跳转通过if解决和匹配域名解决
// @note            v0.3添加更新缓存按钮在编辑资源页面
// @note            v0.4添加离线地址搜索按钮
// @note            v0.5专为68更新一下版本号
// @note            v0.6修改编辑页面内的选择框图案
// @note            v0.7修复选择框超过两位数错位的情况
// @note            v0.8增加更新缓存图标,随窗口运动一直在右下角方便点击
// @note            v0.9去除 离线Bt站alert提示框 控制台输出
// @note            v1.0微云自动填充 离线搜索当前的剧名 更新缓存后获得反馈右下角变黑
// @note            v1.1修复遨游css样式颜色不显示问题:background换成background-color  遨游真是个垃圾浏览器啊!居然不支持透明的设置还是我的CHrome好用
// @note            v1.2修复空白页面无资源异常
// ==/UserScript==

(function aimei5544() {
    'use strict';


    //功能实现为访问资源页面后自动加载编辑页面
    var now_url=document.location.href;
    // 获取当前URL
    var url_=now_url.split("/");
    var url_yyets=url_[3];//判断元素
    var edit_url="http://www.zimuzu.tv/release/resource/app?rid="+url_[4];

    if (url_yyets == "resource"){
        //分割取第四个元素ID
        console.log("编辑url :"+edit_url);
        console.log("当前id为:"+url_[4]);
        window.location.href=edit_url;
    }
    if(url_[3]=="release"){ //跳转编辑页面添加按钮 更新缓存
        console.log("编辑页面");
        var get_edit_url=document.location.href;
        var edit_=get_edit_url.split("=");
        var edit_url_updata="http://www.zimuzu.tv/resource/updateCache?rid="+edit_[1];
        document.getElementsByTagName("table")[3].innerHTML="<td class='update_cache' style='height: 18px;line-height: 1.5;background-color: #2866bd;color: #fff;font-weight: bold;text-align: center;padding: 6px;border-radius: 5px;><a id='update_cache_a'>更新缓存</a></td><td class='yyets_lixian' style='height: 18px;line-height: 1.5;background-color: #2866bd;color: #fff;font-weight: bold;text-align: center;padding: 6px;border-radius: 5px;><a href='http://f.cili001.com/index/index?c=yyets' target='_blank' >离线地址搜索</a></td>";
        //加缓存
        setTimeout(addTop_updata,1000);
        $(".update_cache").click(function(){
            $.ajax({
                url:edit_url_updata+"&sid="+Math.random(),//加随机可以避免被服务器Ban
                type:'GET',
                dataType:'JSON',
                success: function(data){
                    GLOBAL.ShowMsg('成功刷新缓存');
                }
            });
            //使右下角变黑好区分是否更新过缓存
            addStyle(".actGotop{position:fixed; _position:absolute; bottom:30px; right:0px; width:150px; height:75px; display:none;}.actGotop a,.actGotop a:link{width:150px;height:195px;display:inline-block; background-color:#000000; outline:none;}.actGotop a:hover{width:150px; height:195px; background-color:#ff0000; outline:none;}");

        });
        //加离线
        $(".yyets_lixian").click(function(){
            var a=$("div.h").text();
            var b=a.split("=");
            if(b=="[E00]"||b==[E01]){
                window.open("http://f.cili001.com/index/index?c=yyets");
            }else{
                var c=b[1].split(".");
                var name=c[0];
                window.open("http://f.cili001.com/index/index?c=yyets&k="+name);
            }
        });
        //加节点选择框
        addNode();
        $(".btn1:not(#form_cancel)").click(addNode);
        //自动填充微云
        addWeyun();
        $(".btn1:not(#form_cancel)").click(addWeyun);
    }else{
        console.log("当前不会跳转");
        console.log("当前url_yyets为:"+url_[3]);
        console.log("当前id为:"+url_[4]);
        console.log("编辑url :"+edit_url);
        if(url_[4]=="index?c=yyets"){
            //去除alert
            setTimeout(location.href="javascript:alert=function(s){console.log(s)};void 0",console.log("alert已去除"),1000);
        }
    }

    function addStyle(css) { //添加CSS的代码--copy的
        var pi = document.createProcessingInstruction(
            'xml-stylesheet',
            'type="text/css" href="data:text/css;utf-8,' + encodeURIComponent(css) + '"'
        );
        console.log("CSS已加载");
        return document.insertBefore(pi, document.documentElement);
    }

    function addNode(){
        //加样式
        addStyle(".order_num span {position: relative;}.order_num strong {vertical-align: top;font-size: 18px;margin-left: 8px;}.order_num input {position: absolute;visibility: hidden;}.order_num label{display: inline-block;width: 20px;height: 20px;border: 1px solid #ff7e00; margin-left: -15px;} .order_num input:checked+label:after {content: ' ';position: absolute;left: 3px;bottom: 16px;width: 18px;height: 2px; border: 3px solid #2866bd;margin-left: -15px;border-top-color: transparent;border-right-color: transparent; -ms-transform: rotate(-60deg); -moz-transform: rotate(-60deg); -webkit-transform: rotate(-60deg); transform: rotate(-45deg);}");

        setTimeout(function(){
            var checkNodes = document.querySelectorAll(".order_num");
            console.log("节点长度"+checkNodes.length);
            for(var i = 0; i < checkNodes.length; i++){
                var insFaNode = document.createElement("span");//新建span
                insFaNode.className="span_me";
                var perNode = checkNodes[i];
                var inputNode = perNode.querySelector("input");
                perNode.insertBefore(insFaNode, inputNode.nextElementSibling);//insertBefore(newItem,existingItem) input前新建插入span
                insFaNode.appendChild(inputNode);//加入Input
                inputNode.id = "check"+i;//加入input-id
                var insLabelNode = document.createElement("label");//新建label
                insLabelNode.setAttribute("for", "check"+i);//加入label-id
                insFaNode.appendChild(insLabelNode);//向Span节点的子节点列表的末尾添加新的label节点
            }
        }, 1000);
    }

    function addTop_updata(){
        var DivCheckNodes = document.querySelectorAll("body");
        var perDivNode =DivCheckNodes[0].querySelectorAll("div");
        var NewdivNode = document.createElement("div");//新建div
        NewdivNode.className = "actGotop";
        var aNode=document.createElement("a");
        aNode.href="javascript:;";
        aNode.title="更新缓存";
        NewdivNode.appendChild(aNode);
        DivCheckNodes[0].insertBefore(NewdivNode,perDivNode[0]);
        console.log("加载DIV成功");
        addStyle(".actGotop{position:fixed; _position:absolute; bottom:30px; right:0px; width:150px; height:75px; display:none;}.actGotop a,.actGotop a:link{width:150px;height:195px;display:inline-block; background-color:#41c12f; outline:none;}.actGotop a:hover{width:150px; height:195px; background-color:#ff0000; outline:none;}");
        $(function(){
            //$(window).scroll(function() {
            //	if($(window).scrollTop() >= 0){ //向下滚动像素大于这个值时,即出现小火箭~
            $('.actGotop').fadeIn(300); //火箭淡入的时间,越小出现的越快~
            //}else{
            //	$('.actGotop').fadeOut(300); //火箭淡出的时间,越小消失的越快~
            //}
            //});
            $('.actGotop').click(function(){
                $.ajax({
                    url:edit_url_updata+"&sid="+Math.random(),//加随机可以避免被服务器Ban
                    type:'GET',
                    dataType:'JSON',
                    success: function(data){
                        GLOBAL.ShowMsg('成功刷新缓存');
                    }
                });
                //使右下角变黑好区分是否更新过缓存
                addStyle(".actGotop{position:fixed; _position:absolute; bottom:30px; right:0px; width:150px; height:75px; display:none;}.actGotop a,.actGotop a:link{width:150px;height:195px;display:inline-block; background-color:#000000; outline:none;}.actGotop a:hover{width:150px; height:195px; background-color:#ff0000; outline:none;}");

            }); //火箭动画停留时间,越小消失的越快~
        });
    }
    function addWeyun(){
        setTimeout(function(){

            var weyun_href_last=$(".download_way").children("a:last").attr("href");//获取微云href 最后一个
            var weyun_href_first=$(".download_way").children("a:last-child").attr("href");//第一个S01E01这样
            if(weyun_href_last!=null||weyun_href_first!=null){
                var weiyun_last=weyun_href_last.split("/");
                var weiyun_first=weyun_href_first.split("/");
                if(weiyun_last[2]=="share.weiyun.com"||weiyun_last[2]=="url.cn"){
                    console.log("weyun_href_last提取的标识符为"+weiyun_last[2]+"|||当前的链接为:"+weyun_href_last);
                    $(".f3.update").click(function(){
                        $("#app_115").val(weyun_href_last);//赋值
                    });
                }else if(weiyun_first[2]=="share.weiyun.com"||weiyun_first[2]=="url.cn"){
                    console.log("weyun_href_first提取的标识符为"+weiyun_first[2]+"|||当前的链接为:"+weyun_href_first);
                    $(".f3.update").click(function(){
                        $("#app_115").val(weyun_href_first);//赋值
                    });
                }else{
                    console.log("Opps~没有微云链接!!!");
                    console.log("weyun_href_last提取的标识符为"+weiyun_last[2]+"|||当前的链接为:"+weyun_href_last);
                    console.log("weyun_href_first提取的标识符为"+weiyun_first[2]+"|||当前的链接为:"+weyun_href_first);

                }
            }else{
                console.log("当前是空白页面");
            }
        },1000);

    }


})();