Created
September 9, 2016 08:56
-
-
Save tocky/ef4f98fbf5978b9847e8cb0f866c484a to your computer and use it in GitHub Desktop.
NAVITIME (https://www.navitime.co.jp) の路線バス時刻表をテキスト形式にフォーマットして console.log に出力するスニペットです。
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
| /** | |
| * NAVITIME (https://www.navitime.co.jp) の路線バス時刻表をテキスト形式にフォーマットして console.log に出力するスニペットです。 | |
| * このスクリプトは Pebble アプリの Time Table (http://www.sw-sandbox.info/) 用にフォーマットする目的で作られました。 | |
| */ | |
| var time = ''; | |
| $('#d_1_0>.dl_0').each(function(i, dl){ | |
| var hour = $(dl).children('dt').text(); | |
| var mins = []; | |
| $(dl).find('div:not([class])').each(function(j, div){ | |
| mins.push($(div).text()); | |
| }); | |
| time += (hour + ':' + mins.join(' ') + '\n'); | |
| }); | |
| console.log(time); | |
| copy(time); | |
| console.log('The result has been copied to clipboard!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment