Skip to content

Instantly share code, notes, and snippets.

@bradbeattie
Last active April 20, 2017 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradbeattie/8d346acda2d737ef23ccf9cc78fd80d7 to your computer and use it in GitHub Desktop.
Save bradbeattie/8d346acda2d737ef23ccf9cc78fd80d7 to your computer and use it in GitHub Desktop.
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