notes/EMS Jane GreaseMonkey Script v1-5f4866zz.sh
// ==UserScript==
// @name EMSJANE
// @namespace emsjane
// @include http://emsjane.com/viewcourse/*
// @version 1
// @grant none
// ==/UserScript==
//http://emsjane.com/logvideoplace?vid_pos=8.04&course_id=1723&length=1516.51&vid_complete=false&student_id=33181&student_course_id=2704027&_=1382715185364
test='<input type="radio" name="AnswerId" value="5768" id="answer_5768" checked> <label for="answer_5768">Correct Answer</label> <br><br>';
$(document).ready(function(){
$("input").each(function(){
l = String(window.location);
l = l.toString().split("/");
lc = l[5];
cid = l[4];
if (lc == "4#currentQuestionForm"){
n = "http://emsjane.com/viewcourse/" + l[4] + "/5";
window.location.href=n;
//alert(n);
}else if (lc == "5"){
console.log("video");
var data = {
vid_pos: lastpos,
course_id: playerData.course_id,
length: vidlen,
vid_complete: false,
student_id: playerData.student_id,
student_course_id: playerData.student_course_id
};
can_continue = true;
vid_complete = true;
data.vid_complete = true;
$.ajax({
url: '/logvideoplace',
data: data,
cache: false,
dataType: 'json',
success: function (response) {
n = "http://emsjane.com/viewcourse/" + l[4] + "/6";
window.location.href=n;
if (response != "true") {
showNotTrackingStatus("student seems to have logged-in in a different browser");
}else {
debugMessages.push(moment.utc().format() + ' - got back response: true');
}
errorCount = 0;
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status == 200) {
debugMessages.push(moment.utc().format() + ' - checkTracking - logged out');
showNotTrackingStatus(jqXHR.status + " - " + errorThrown);
} else {
errorCount++;
debugMessages.push(moment.utc().format() + ' - checkTracking - lost');
if (errorCount > 3) {
showNotTrackingStatus(jqXHR.status + " - " + errorThrown + " - " + jqXHR.responseText);
} else {
if (!can_continue) {
setTimeout("timeFunc()", interval);
}
}
}
}
});
// setTimeout(function(){
// },30000);
}else{
x = $(this).attr("value");
if (x=="Next >"){
n = $(this).attr("onclick");
n = n.toString().split("'");
window.location.href=n[1];
}
}
})
$("#currentQuestionForm").html(test);
$('#currentQuestionForm').submit();
l = String(window.location);
l = l.toString().split("/");
lc = l[3];
lc = lc.toString().split("?");
lc = lc[0];
cid = String(window.location);
cid = cid.toString().split("=");
cid = cid[1];
if(lc == "survey"){
$.post("survey",{ CourseId: cid,ConcatenatedAnswers:"1:3,2:8,3:13,4:18,5:23,6:28,7:33,8:38",SurveyId:"1",answer_1:"on",answer_2:"on",answer_3:"on",answer_4:"on",answer_5:"on",answer_6:"on",answer_7:"on",answer_8:"on"});
window.location.href="http://emsjane.com/viewcourse/" + cid;
}
});
syntax highlighted by Code2HTML, v. 0.9.1