Skip to content

Instantly share code, notes, and snippets.

@pingany
Last active October 20, 2015 08:39
Show Gist options
  • Select an option

  • Save pingany/46749da635b826b4db0f to your computer and use it in GitHub Desktop.

Select an option

Save pingany/46749da635b826b4db0f to your computer and use it in GitHub Desktop.
使用方法: 下载此文件保存成dfss_autoplay.user.js, 拖进chrome浏览器即可
// ==UserScript==
// @name 东方时尚课程自动播放
// @namespace http://your.homepage/
// @version 0.1
// @description enter something useful
// @author You
// @match *://dfss.anjia365.com/player.do*
// @grant none
// ==/UserScript==
// 作用: 自动学习完东方时尚科目一的课程, 不用再等待视频播放, 不用点下一步, 不用做题!
// 使用方法: 下载此文件保存成dfss_autoplay.user.js, 拖进chrome浏览器即可
alert('自动播放插件加载成功');
setInterval(function() {
var $ = jQuery;
var doExamIfNeeded = function() {
console.log('dfss.user.js doExamIfNeeded works');
var radios = $('input[type="radio"]');
if (radios.length > 0) {
radios.each(function() {
$(this).click();
var answerHints=$("#answerHints").first().html();
if(answerHints != '1'&& answerHints!='') {
// 错误
}else {
// 答对,退出循环
return false;
}
});
$('#btnNext').click();
}
};
var showNextCourseIfNeeded = function() {
console.log('dfss.user.js setInterval works');
if ($('#showNextWare').length > 0 && $('#showNextWare.dfss_no').length == 0) {
showNext();
}
}
var seekPlayerIfNeeded = function() {
var player = document.getElementById("playerswf");
if (player) {
var duration = player.spark_player_duration();
var position = player.spark_player_position();
if (position < duration) {
// start if needed
player.spark_player_start();
}
if (position < duration - 4) {
player.spark_player_seek(duration-2);
}
}
}
doExamIfNeeded();
seekPlayerIfNeeded();
showNextCourseIfNeeded();
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment