Created
December 26, 2015 07:01
-
-
Save anonymous/0373011a1236483b7ec9 to your computer and use it in GitHub Desktop.
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 next_story; | |
var next_day; | |
function gochiusa(year, month, day) { | |
now = new Date(); | |
start = new Date(year, month - 1, day); | |
msec = now.getTime() - start.getTime(); | |
next_story = Math.floor((msec / (1000 * 60 * 60 * 24) - 1) / 7) + 2; | |
// まだ放映開始前の場合は、羽数を第1羽にして、放送日は開始日にする | |
if (next_story < 1) { | |
next_story = 1; | |
next_day = start; | |
} else { | |
next = start.getTime() + (next_story - 1) * 7 * (1000 * 60 * 60 * 24); | |
next_day = new Date(); | |
next_day.setTime(next); | |
} | |
document.write('第' + next_story + '羽 (' + next_day.getFullYear() + '/' + (next_day.getMonth() + 1) + '/' + next_day.getDate() + ')'); | |
} | |
function gochiusa_twitter(title, url) { | |
str = '次回の' + title + 'は第' + next_story + '羽(' + (next_day.getMonth() + 1) + '月' + next_day.getDate() + '日)です。 @Naba0123 さんから'; | |
uri_str = encodeURI(str); | |
document.write('<a href="https://twitter.com/intent/tweet?button_hashtag=gochiusa&text=' + uri_str + '" class="twitter-hashtag-button" data-size="large" data-url="http://app.naba.biz/' + url + '/">#gochiusa をつぶやく</a>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment