<commit_before># This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.

APP.init = ->
  console.log "application"

APP.segments =
  init: ->
    $ ->
      console.log "segments (controller)"

  index: ->
    $ ->
      console.log "enter segments#index"
      APP._initGoogleMaps()
      APP._initDataTables()
      console.log "exit segments#index"

  show: ->
    $ ->
      console.log "enter segments#show"
      console.log "exit segments#show"

APP._initGoogleMaps = ->
  kmlUrl = $('#map').data('kml-url')
  handler = Gmaps.build('Google')
  opts =
    # see https://developers.google.com/maps/documentation/javascript/reference?hl=fr#MapOptions
    provider: {
      scrollwheel: false,
      zoom: 16
    }
    internal: { id: 'map' }
  handler.buildMap(opts, ->
    kmls = handler.addKml(
      { url: kmlUrl }
    )
    # handler.bounds.extendWith(markers)
    # handler.fitMapToBounds()
  )

APP._initDataTables = ->
  $('#segments').dataTable
    dom: 'iflrpt'  # http://www.datatables.net/ref#sDom
    processing: true
    serverSide: true
    ajax: $('#segments').data('source')
    stateSave: true
    deferRender: true<commit_msg>Change map to TERRAIN. Don't save datatables state.<commit_after># This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.

APP.init = ->
  console.log "application"

APP.segments =
  init: ->
    $ ->
      console.log "segments (controller)"

  index: ->
    $ ->
      console.log "enter segments#index"
      APP._initGoogleMaps()
      APP._initDataTables()
      console.log "exit segments#index"

  show: ->
    $ ->
      console.log "enter segments#show"
      console.log "exit segments#show"

APP._initGoogleMaps = ->
  kmlUrl = $('#map').data('kml-url')
  handler = Gmaps.build('Google')
  opts =
    # see https://developers.google.com/maps/documentation/javascript/reference?hl=fr#MapOptions
    provider: {
      scrollwheel: false,
      zoom: 16,
      mapTypeId: google.maps.MapTypeId.TERRAIN
    }
    internal: { id: 'map' }
  handler.buildMap(opts, ->
    kmls = handler.addKml(
      { url: kmlUrl }
    )
    # handler.bounds.extendWith(markers)
    # handler.fitMapToBounds()
  )

APP._initDataTables = ->
  $('#segments').dataTable
    dom: 'iflrpt'  # http://www.datatables.net/ref#sDom
    processing: true
    serverSide: true
    ajax: $('#segments').data('source')
    stateSave: false
    deferRender: true
{'fraction_non_alphanumeric': 0.13982232522209348, 'fraction_numerical': 0.001544998068752414, 'mean_word_length': 2.8830584707646176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '811054', 'n_tokens_mistral': 867, 'n_tokens_neox': 841, 'n_words': 180}