Last active
December 26, 2015 04:58
-
-
Save dribble13/7096913 to your computer and use it in GitHub Desktop.
ブラウザ側で日時指定で、リダイレクト先を切り替えるスクリプト ref: http://qiita.com/dribble13/items/cd5aa40d87d1e993bb51
This file contains hidden or 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
| $(document).ready(function() { | |
| $('a.location_timer').each(function(index, target) { | |
| var startDate = $(this).attr('data-start-date'); | |
| var endDate = $(this).attr('data-end-date'); | |
| var nowDate = new Date(); | |
| startDate = startDate ? new Date(startDate) : nowDate; | |
| endDate = endDate ? new Date(endDate) : null; | |
| if (startDate <= nowDate && (!endDate || nowDate <= endDate)) { | |
| location.href = $(this).attr('href'); | |
| } | |
| }); | |
| }); |
This file contains hidden or 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
| <a class="location_timer" href="http://qiita.com" data-start-date="2013/10/22 16:00" data-end-date="2013/10/30 23:59"></a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment