Created
August 24, 2014 13:59
-
-
Save akouryy/7ade4e5544b71e1c3aa2 to your computer and use it in GitHub Desktop.
eachの引数の関数でfalseを返すとbreakの代わりと見なされるのでfalse以外の値を返しますよ
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
$ -> | |
include '/jQuery.cookie.js' | |
checkList = [] | |
updateControl = -> | |
$('#save-anime').attr 'disabled', true | |
link = "http://akouryy.net/anime/?year=2014&season=3&by_param" | |
console.log checkList | |
$('.show-anime').each (i) -> | |
if $(this).is ':checked' | |
$("[data-anime=\"#{$(this).attr 'data-anime-for'}\"]").show 0 | |
link += "&#{encodeURI $(this).attr 'data-anime-for'}" | |
else | |
$("[data-anime=\"#{$(this).attr 'data-anime-for'}\"]").hide 0 | |
if checkList[i] != $(this).is ':checked' | |
$('#save-anime').attr 'disabled', false | |
$('#share-link').val link | |
$('.twitter-share-button').attr 'data-url', link | |
`!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs')` | |
$('.week-style.all-week').click -> | |
$('.week-style.all-week').addClass 'selected' | |
$('.week-style.each-week').removeClass 'selected' | |
$('.anime-timetable.all-week').show 0 | |
$('.anime-timetable.each-week').hide 0 | |
$('.week-style.each-week').click -> | |
$('.week-style.all-week').removeClass 'selected' | |
$('.week-style.each-week').addClass 'selected' | |
$('.anime-timetable.all-week').hide 0 | |
$('.anime-timetable.each-week').show 0 | |
### | |
$ '.select-anime' | |
.change -> | |
if $(this).is ':checked' | |
$ "[data-anime=\"#{$(this).attr 'data-anime-for'}\"]" | |
.addClass 'highlighted' | |
else | |
$ "[data-anime=\"#{$(this).attr 'data-anime-for'}\"]" | |
.removeClass 'highlighted' | |
### | |
$('.show-anime').change -> | |
updateControl() | |
$('#save-anime').click -> | |
$('.show-anime').each (i) -> | |
$.cookie $(this).attr('data-anime-for'), $(this).is ':checked' | |
checkList[i] = $(this).is ':checked' | |
'DO NOT BREAK' | |
location.href = "http://akouryy.net/anime/?year=2014&season=3" | |
$('.show-anime').each (i) -> | |
s = $.cookie $(this).attr 'data-anime-for' | |
checkList[i] = if s? then s == "true" else $(this).attr('data-show-default') == "true" | |
unless $(this).attr 'data-fixed' | |
$(this).attr 'checked', checkList[i] | |
'DO NOT BREAK' | |
$('.week-style.all-week').click() | |
updateControl() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment