Created
October 3, 2011 15:01
-
-
Save justone/1259298 to your computer and use it in GitHub Desktop.
dotjs script to allow picking your schedule on http://events.jquery.org/2011/boston/schedule/ (stick amplify.store.js into default.js)
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
(function(amplify) { | |
var selected_color = '#9E9E9E'; | |
var unselected_color = '#E9E9E9'; | |
var schedule_data = amplify.store('mySchedule'); | |
if (schedule_data == null) { | |
schedule_data = {}; | |
} | |
//console.log(schedule_data); | |
jQuery('a.talk-link') | |
.parent() | |
.each(function() { // color based on stored data | |
var data = $('a.talk-link', this).data(); | |
$(this).css('background-color', (schedule_data[data.slug] ? selected_color : unselected_color)); | |
}) | |
.click(function () { // flip when clicked | |
var data = $('a.talk-link', this).data(); | |
schedule_data[data.slug] = !schedule_data[data.slug]; | |
$(this).css('background-color', (schedule_data[data.slug] ? selected_color : unselected_color)); | |
amplify.store('mySchedule', schedule_data); | |
}); | |
})(this.amplify); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment