<commit_before># insert_stops.coffee


preferred_stops = []

$.getJSON('preferred_stops.json').done((data) ->
      console.log("read preferred_stops.json")
      $(document).ready(data.map (stop) -> preferred_stops.push(stop))
  ).done(

    $.getJSON 'bus_info.json', (bus_info) ->
      console.log("read bus_info.json")
      console.log("preferred stops: #{preferred_stops}")

      buses = (bus for bus of bus_info).sort()
      for bus in buses
        dir = (dir for dir of bus_info[bus].stops)
        for dir,label of bus_info[bus].direction_labels
          route = "#{bus} #{label}"

          text = "<div data-role=\"collapsible\">\n<h3>#{route}</h3>\n"
          text += "<ul data-role=\"listview\" data-theme=\"d\">"

          for stop in preferred_stops
            link = bus_info[bus].stops[dir][stop]
            text += "<li><a href=\"#{link}\" target=\"_blank\">#{stop}</a></li>\n" if link

          text += "<div data-role=\"collapsible\" data-inset=\"true\" data-theme=\"c\">\n"
          text += "<h3>More</h3><ul data-role=\"listview\">"

          for stop,link of bus_info[bus].stops[dir]
            text += "<li><a href=\"#{link}\" target=\"_blank\">#{stop}</a></li>\n"

          text += "</ul></div></ul></div>"
          text += "</ul></div>"

          $('div#insert_here').append(text)

      $('div[data-role=collapsible]').collapsible()
      $('ul[data-role=listview]').listview()<commit_msg>Web/insert_stops.coffee: remove console.log calls<commit_after># insert_stops.coffee


preferred_stops = []

$.getJSON('preferred_stops.json').done((data) ->
      $(document).ready(data.map (stop) -> preferred_stops.push(stop))
  ).done(

    $.getJSON 'bus_info.json', (bus_info) ->
      buses = (bus for bus of bus_info).sort()
      for bus in buses
        dir = (dir for dir of bus_info[bus].stops)
        for dir,label of bus_info[bus].direction_labels
          route = "#{bus} #{label}"

          text = "<div data-role=\"collapsible\">\n<h3>#{route}</h3>\n"
          text += "<ul data-role=\"listview\" data-theme=\"d\">"

          for stop in preferred_stops
            link = bus_info[bus].stops[dir][stop]
            text += "<li><a href=\"#{link}\" target=\"_blank\">#{stop}</a></li>\n" if link

          text += "<div data-role=\"collapsible\" data-inset=\"true\" data-theme=\"c\">\n"
          text += "<h3>More</h3><ul data-role=\"listview\">"

          for stop,link of bus_info[bus].stops[dir]
            text += "<li><a href=\"#{link}\" target=\"_blank\">#{stop}</a></li>\n"

          text += "</ul></div></ul></div>"
          text += "</ul></div>"

          $('div#insert_here').append(text)

      $('div[data-role=collapsible]').collapsible()
      $('ul[data-role=listview]').listview()
{'fraction_non_alphanumeric': 0.2188747731397459, 'fraction_numerical': 0.0029038112522686023, 'mean_word_length': 2.6358839050131926, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1966619', 'n_tokens_mistral': 945, 'n_tokens_neox': 937, 'n_words': 161}