Skip to content

Instantly share code, notes, and snippets.

@rattlion
Created November 29, 2012 02:14
Show Gist options
  • Save rattlion/4166341 to your computer and use it in GitHub Desktop.
Save rattlion/4166341 to your computer and use it in GitHub Desktop.
var config = {
testing : true, // testing?
parent : '#advent-calendar li', // parent selector
class_prefix : ' date-', // class selector
element : ' a', // element selector
punch : new Date() // date object
}
if (config.testing === true) { // testing. select all dates, enable modals
$(config.parent + config.element)
.attr('data-toggle', 'modal')
.addClass('open');
} else {
if (config.punch.getFullYear() >= 2012 && config.punch.getMonth() >= 11) { // it's december, proceed
for (var i = 1; i < Math.min(config.punch.getDate(), 25); i += 1) { // for every day up to today's date, enable their modal
$(config.parent + config.class_prefix + i + element)
.attr('data-toggle', 'modal')
.addClass('open');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment