Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PyCon Preference Recorder
// To be used on https://us.pycon.org/2017/schedule/talks/list/
// Hide who's giving the talk and when
$("h2 + p").remove()
// On left and right click, increase or decrease the recorded preference for the talk
function process(event, element, left) {
event.preventDefault()
event.stopPropagation()
var href = element.prev().find("a").attr("href")
localStorage[href] = parseInt(localStorage[href] || 0) + (left ? 1 : -1)
element.css("background", "hsl(" + ((parseInt(localStorage[href]) + 5) * 10) + ", 50%, 50%)")
}
$(".presentation-description").on("click", function(event) {
process(event, $(this), true)
}).contextmenu(function(event) {
process(event, $(this), false)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.