Last active
April 20, 2017 16:56
-
-
Save bradbeattie/8d346acda2d737ef23ccf9cc78fd80d7 to your computer and use it in GitHub Desktop.
PyCon Preference Recorder
This file contains 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
// 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