河南专技在线脚本
当前为
// ==UserScript==
// @name 河南专技在线辅助
// @version 0.1
// @description 河南专技在线脚本
// @author huangdi
// @match *://*.ghlearning.com/*
// @require http://code.jquery.com/jquery-1.12.4.min.js
// @namespace https://greasyfork.org/users/360494
// ==/UserScript==
(function() {
//'use strict';
// Your code here...
// For more, refer to http://dev.polyv.net/2013/videoproduct/v-playerapi/v-playerapi-event/jsbf0001/
function resume()
{
player.j2s_resumeVideo();
}
function pause()
{
player.j2s_pauseVideo();
}
function seek(sec)
{
player.j2s_seekVideo(sec);
}
function stop()
{
player.j2s_stopVideo();
}
function vol(v)
{
player.j2s_setVolume(v);
}
function nextVideo(vid)
{
player.changeVid(vid);
}
function toNext(){
setTimeout(function(){
var text=$('li[id][class=active]')[0].innerText;
console.log(text.match(/[0-9]+%/)[0]);
if(text.match(/[0-9]+%/)[0]=="100%"){
seek(player.j2s_getDuration()-1);
resume();
console.log(text+'播放结束,即将播放下一个视频');
}else if(text.match(/[0-9]+%/)[0]=="50%"){
location.reload();//每个视频刷新一次页面,避免页面死掉。
}else{
setTimeout(arguments.callee, 5000);
}}, 5000);
}
function pauseFuc (){
window.s2j_onVideoPause = function () {
console.log('修改暂停函数,暂停时继续计时ing...');
}
}
function start(){
console.log('播放器初始化完成');
player=document.getElementsByClassName("polyvFlashObject")[0];
setTimeout(resume,3000);
setTimeout(function (){vol(0);},3500);
setTimeout(pauseFuc,4000);
setTimeout(pause,5000);
setTimeout(toNext,6000);
}
var player;
window.s2j_onPlayerInitOver=start;
})();