一段自动运行的代码

// ==UserScript==
// @name         play
// @namespace   https://www.abc.com
// @version      0.2
// @description  play
// @author       reshuiping
// @match        https://www.abc.com
// @require     https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
// ==/UserScript==


(function() {
    'use strict';

    // Your code here...

    var sn=1;
    var i=1;

    $(document).ready(function(){

        var iframe = document.createElement('iframe');
        iframe.width=1024;
        iframe.height=500;
        iframe.id="d2gym"
        iframe.name="d2gym"
        iframe.align="middle"
        document.body.appendChild(iframe);

        setTimeout(function() {
            $("#content_page").append("<button id='btn1' οnclick='PagingJump(\"li\",2,80,0)'>00</button>");
            $("#btn1").trigger("click");
        },2000);

        autoplayvideo(1);

        function autoplayvideo(ii) {
            i=ii;
            (function(i) {
                console.log("starting play video");
                sn=i;
                setTimeout(function() {
                    console.log(i);
                    var course=$("#partail > div.NewCourseList > ul > li:nth-child(" + sn + ") > div.block4.fl > a");
                    course.attr("target","d2gym");
                    course.text("");
                    course.append("<span>cl</span>");
                    $("#partail > div.NewCourseList > ul > li:nth-child(" + sn + ") > div.block4.fl > a > span").trigger("click");
                },4000);

                $(document).ready(function(){
                    setTimeout(function(){
                        var jindu=$("#d2gym").contents().find("#cur_detail > table > tbody > tr:nth-child(5) > td.listtb2 > span").html();
                        if (jindu != "100%"){

                            $("#d2gym").contents().find("#cur_detail > table > tbody > tr:nth-child(5) > td.listtb3 > a").text("");
                            $("#d2gym").contents().find("#cur_detail > table > tbody > tr:nth-child(5) > td.listtb3 > a").append("<span>cl</span>");
                            $("#d2gym").contents().find("#cur_detail > table > tbody > tr:nth-child(5) > td.listtb3 > a").attr("target","d2gym");
                            $("#d2gym").contents().find("#cur_detail > table > tbody > tr:nth-child(5) > td.listtb3 > a > span").click();
                            setTimeout(function(){
                                var ref = "";
                                function mnop(){
                                    var currenttime,endtime;
                                    var videopage=$("#d2gym").contents().find("#mx-top").contents();
                                    currenttime=$("#d2gym").contents().find("#mx-top").contents().find("#div-video_controlbar_elapsed").html();
                                    //console.log(currenttime);
                                    endtime=$("#d2gym").contents().find("#mx-top").contents().find("#div-video_controlbar_duration").html();
                                    $("#d2gym").contents().find("#mx-top").contents().find("#show").remove();
                                    $("#d2gym").contents().find("#mx-top").contents().find("#show2").remove();
                                    $("#d2gym").contents().find("#mx-top").contents().find("#bg").remove();
                                    $("#d2gym").contents().find("#mx-top").contents().find("#div-video_view > span.jwvideo > video").trigger('play');

                                    if (currenttime==endtime) {
                                        clearInterval(ref);
                                        i=i+1;
                                        sn=sn+1;
                                        autoplayvideo(sn);
                                    } 

                                }
                                ref = setInterval(function(){
                                    mnop();
                                },2000);
                            },8000);
                        }  
                    },20000);
                });
            })(i);
        }
    });

})();
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值