Skip to content

Instantly share code, notes, and snippets.

@pastak
Last active September 25, 2015 16:08
Show Gist options
  • Save pastak/948521 to your computer and use it in GitHub Desktop.
Save pastak/948521 to your computer and use it in GitHub Desktop.
/*load jQuery*/
var s=document.createElement("script");
thisyear=(new Date()).getFullYear();
s.src="https://raw.github.com/jquery/jquery/master/speed/jquery-basis.js";
s.addEventListener("load",function(){
var month,day,subject,year,data="Subject,Start Date,Start Time\n";
$(".hyo_table").each(function(m,table){
month=(m+4)%12 ? (m+4)%12 : 12;
year=month>3 ? thisyear : (thisyear+1);
$(table).children().children().each(function(i,tr){
day=parseInt($(tr).children(".hyo_date:last").text());
subject=$(tr).children(".hyo_subject").text();
subjects=subject.split("/");
for(i in subjects){
data+=(subjects[i]+","+year+"/"+month+"/"+day+",TRUE \n");
}
})
})
console.log(data);
/*download file and save as csv
window.open("data:plain/text,"+data,null);
*/
},true)
document.body.appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment