Greasy Fork is available in English.

视频跳过广告和 VIP 视频解析

也许是风格最贴近原视频网站的 VIP 视频解析脚本了,添加的解析按钮样式跟原视频网站已有的按钮一致,不会产生突兀感

Version au 2018-10-10 14:15:15 UTC. Voir la dernière version.

// ==UserScript==
// @name              视频跳过广告和 VIP 视频解析
// @name:en           Kill ADs and Watch VIP Videos
// @namespace         http://mofiter.com/
// @version           0.2
// @description       也许是风格最贴近原视频网站的 VIP 视频解析脚本了,添加的解析按钮样式跟原视频网站已有的按钮一致,不会产生突兀感
// @description:en    maybe it's the most similar VIP videos script to origin website
// @author            mofiter
// @create            2018-10-05
// @lastmodified      2018-10-10
// @require           https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// @match             http*://v.qq.com/x/cover/*
// @match             http*://www.iqiyi.com/v*
// @match             http*://v.youku.com/v_show/*
// @grant             unsafeWindow
// ==/UserScript==

(function() {
    'use strict';
    var $ = $ || window.$;
    var log_count = 1;

    //自定义 log 函数
    function mylog(param1,param2){
        param1 = param1 ? param1 : "";
        param2 = param2 ? param2 : "";
        console.log("#" + log_count++ + "-VIP-log:",param1,param2);
    }

    setTimeout(function(){
        var videoPlayer = $("<div style='width:100%;height:100%;z-index:2147483647;'><iframe frameborder='0' width='100%' height='100%' src='https://api.bbbbbb.me/jx/?url=" + location.href + "'></iframe></div>");
        if (location.href.indexOf("www.iqiyi.com") > -1){
            var qy_flash_func = $(".qy-flash-func");
            var iqiyi_jiexi = $("<article class='func-item' style='margin-top:9px;'><span class='func-inner'><span class='func-name'>解析</span></span></article>");
            qy_flash_func.prepend(iqiyi_jiexi);
            iqiyi_jiexi.click(()=>{
                document.getElementById("nav_LR").querySelector("a").click();
                var flashbox = $("#flashbox");
                flashbox.attr("z-index","400");
                flashbox.empty();
                flashbox.append(videoPlayer);
            });
            var iqiyi_jiexi_new = $("<div style='float:left;color:#999;cursor:pointer;'><span class='func-name'>解析</span></div>");
            var funcRight = $(".funcRight");
            funcRight.prepend(iqiyi_jiexi_new);
            iqiyi_jiexi_new.click(()=>{
                var vipFloatbgCls = $(".vipFloatbgCls").parent();
                $(vipFloatbgCls).css("display","none");
                $(".J_play-underFrame").css("display","none");
                document.getElementsByClassName("usrTx-register")[0].querySelector("a").click()
                $("#flashbox").empty();
                $("#flashbox").append(videoPlayer);
            });
            iqiyi_jiexi_new.on("mouseover",()=>{
                iqiyi_jiexi_new.css("color","#6ba430");
            });
            iqiyi_jiexi_new.on("mouseout",()=>{
                iqiyi_jiexi_new.css("color","#999");
            });
            setInterval(()=>{
                if($(".qy-player-vippay-popup") != null){
                    var qy_player_vippay_popup = $(".qy-player-vippay-popup").parent();
                    $(qy_player_vippay_popup).css("display","none");
                }
                var div = $("body").children("div");
                div.each((index,item)=>{
                    try{
                        if($(item).css("position") === "fixed"){
                            $(item).remove();
                        }
                    }catch(err){
                        mylog(err);
                    }
                });
            },500);
        }else if(location.href.indexOf("v.qq.com") > -1){
            var type_name = unsafeWindow.COVER_INFO.type_name;
            var vipPage = unsafeWindow.COVER_INFO.vipPage;
            var mod_player;
            if(type_name === "电影"){
                var list_item = $(".mod_figure_list .list_item");
                list_item.each(function(index,item){
                    item.addEventListener('click',()=>{
                        setTimeout(()=>{
                            location.reload();
                        },1000);
                    });
                });
            }else if(type_name === "电视剧"){
                var select_items = $('.mod_episode .item');
                select_items.each(function(index,item){
                    item.addEventListener('click',()=>{
                        setTimeout(()=>{
                            location.reload();
                        },1000);
                    });
                });
                var mod_episode_filter = $(".mod_episode_filter");
                mod_episode_filter.click(()=>{
                    var select_items = $('.mod_episode .item');
                    select_items.each(function(index,item){
                        item.addEventListener('click',()=>{
                            setTimeout(()=>{
                                location.reload();
                            },1000);
                        });
                    });
                });
            }
            var txp_right_controls = $(".txp_right_controls");
            var qq_jiexi = $("<txpdiv class='txp_btn txp_btn_definition' id='jiexi_btn'><txpdiv class='txp_label'>解析</txpdiv></txpdiv>");
            txp_right_controls.prepend(qq_jiexi);
            qq_jiexi.click(()=>{
                var mod_player;
                var txp_ad_skip_text = $(".txp_ad_inner .txp_ad_skip_text");
                if(txp_ad_skip_text.text() === "VIP可关闭广告"){
                    txp_ad_skip_text.click();
                    mod_player = $("#mod_player");
                    mod_player.empty();
                    mod_player.append(videoPlayer);
                }else if(txp_ad_skip_text.text() === "关闭广告"){
                    txp_ad_skip_text.click();
                }else if(type_name === "电视剧" || type_name === "电影" || type_name === "综艺" && vipPage === true){
                    var txp_btn_play = $(".txp_left_controls .txp_btn_play");
                    if(txp_btn_play.attr("data-status") === "pause"){
                        txp_btn_play.click();
                    }
                    mod_player = $("#mod_player");
                    mod_player.empty();
                    mod_player.append(videoPlayer);
                }
            });
            setInterval(()=>{
                $(".tvip_layer").css("display","none");
                $("#mask_layer").css("display","none");
            },500);
        }else if(location.href.indexOf("v.youku.com") > -1){
            setInterval(()=>{
                $(".yk-dmtxtbox").css("width","300px");
            },1000);
            var bpmodule_playpage_paction = $("#bpmodule-playpage-paction .play-fn");
            var youku_jiexi = $("<li><span class='text'>解析</span></li>");
            bpmodule_playpage_paction.append(youku_jiexi);
            youku_jiexi.click(()=>{
                var ykPlayer = $("#ykPlayer");
                ykPlayer.empty();
                ykPlayer.append(videoPlayer);
                $("#module_basic_player").css("height","100%");
                var player = $("#player");
                player.css("height","100%");
                player.empty();
                player.append(videoPlayer);
            });
        }
    },3000);
})();