Created
January 23, 2017 22:47
-
-
Save benwong/5f3d2a45226960af3609ee338cf6ec7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
script to extract calendar data from basketball fixture | |
*/ | |
(function(){ | |
function writeEvent(date, time, venue, opponent) { | |
let data = ['Basketball',date.replace(' (Sun)', ''), time, venue.trim(), opponent]; | |
console.log(data.join(',')); | |
} | |
let headings = ['Subject', 'Start Date', 'Start Time', 'Description', 'Location']; | |
console.log(headings.join(',')); | |
$('tr:gt(1)').each(function () { | |
let $this = $(this); | |
let date = $this.find('td:eq(1)').text(); | |
let time = $this.find('td:eq(2)').text(); | |
let venue = $this.find('td:eq(3)').text(); | |
let opponent = $this.find('td:eq(6)').text(); | |
writeEvent(date, time, venue, opponent); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment