Skip to content

Instantly share code, notes, and snippets.

@tocky
Created September 9, 2016 08:56
Show Gist options
  • Select an option

  • Save tocky/ef4f98fbf5978b9847e8cb0f866c484a to your computer and use it in GitHub Desktop.

Select an option

Save tocky/ef4f98fbf5978b9847e8cb0f866c484a to your computer and use it in GitHub Desktop.
NAVITIME (https://www.navitime.co.jp) の路線バス時刻表をテキスト形式にフォーマットして console.log に出力するスニペットです。
/**
* 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