Skip to content

Instantly share code, notes, and snippets.

@justone
Created October 3, 2011 15:01
Show Gist options
  • Save justone/1259298 to your computer and use it in GitHub Desktop.
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)
(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