Last active
August 29, 2015 14:27
-
-
Save fukajun/b313ae599d5279f10587 to your computer and use it in GitHub Desktop.
YAPC のスケージュールのページでchrome developperツールから流すとハイライトできるようになります。( http://yapcasia.org/2015/talk/schedule?date=2015-08-21 ) だからなに?
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
var render = function() { | |
$('.talk').css('background-color', 'white') | |
result = '' | |
Object.keys(list).map(function(id) { | |
var $el = $('.talk').has('#' + id) | |
$el.css('background-color', 'pink') | |
result += $el.find('.title').text() + '\n' | |
}) | |
console.log(result) | |
localStorage.wanted = JSON.stringify(list); | |
} | |
var toggle = function($el) { | |
var id = $el.find('a').get(0).id; | |
console.log(id in list) | |
if(id in list) { | |
delete(list[id]) | |
$el.css('background-color', 'white') | |
} else { | |
list[id] = true | |
}; | |
console.log(list) | |
} | |
var list = localStorage.wanted ? JSON.parse(localStorage.wanted) : {}; | |
render() | |
$('.talk').each(function(){ $(this).click( function() { toggle($(this)); render() }) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment