<commit_before>'use strict'
## Main class
class MoonRider
  performance: null
  webSite: null
  client: null

  constructor: ->
    this.client = new Client()
    this.webSite = new WebSite()
    this.performance = new Performance()

  setPerformance: ->
    this.performance = new Performance()
    return


## Basic performances class
class Performance
  domContentReadableTime: 0
  serverLoadingTime: 0
  totalLoadingTime: 0
  loadEventTime: 0

  constructor: ->
    this.setLoadingTimes()

  setLoadingTimes: ->
    timing = window.performance.timing
    this.totalLoadingTime = timing.loadEventEnd - timing.navigationStart
    this.domContentLoadTime = timing.domContentLoadedEventEnd - timing.responseEnd
    this.serverLoadingTime = timing.responseEnd - timing.requestStart
    this.loadEventTime = timing.loadEventEnd - timing.responseEnd
    return

## WebSite info
class WebSite
  host: null

  constructor: ->
    this.setHost()

  setHost: ->
    windowHost = window.location.host
    if windowHost == 'localhost'
      pathArray = window.location.pathname.split('/')
      if pathArray[1]
        this.host = windowHost + '/' + pathArray[1]
      else
        this.host = windowHost
    else
      this.host = windowHost
    return

## Client info
class Client
  isTouch: false

  constructor: ->
    this.isTouch = 'ontouchstart' in window;


## MoonRider
window.onload = ->
  delay 0, ->
    # old browser, cancel analytics
    return  if not window.performance

    # init MoonRider
    moonRider = new MoonRider()

    atomic.post('http://localhost:8888/data', JSON.stringify(moonRider)).success(() ->
      # data sent
    ).error () ->
      console.log 'Error while sending data to server ...'
    return


## Usefull functions
delay = (ms, func) ->
  setTimeout func, ms

jsonp = (url, data) ->
  script = document.createElement('script');
  script.src = url + '?data=' + 'test';
  document.body.appendChild(script);

__parseJSONPResponse = (data) ->
  # now you have access to your data
  console.log 'parsed'

<commit_msg>Remove useless func<commit_after>'use strict'
## Main class
class MoonRider
  performance: null
  webSite: null
  client: null

  constructor: ->
    this.client = new Client()
    this.webSite = new WebSite()
    this.performance = new Performance()

  setPerformance: ->
    this.performance = new Performance()
    return


## Basic performances class
class Performance
  domContentReadableTime: 0
  serverLoadingTime: 0
  totalLoadingTime: 0
  loadEventTime: 0

  constructor: ->
    this.setLoadingTimes()

  setLoadingTimes: ->
    timing = window.performance.timing
    this.totalLoadingTime = timing.loadEventEnd - timing.navigationStart
    this.domContentLoadTime = timing.domContentLoadedEventEnd - timing.responseEnd
    this.serverLoadingTime = timing.responseEnd - timing.requestStart
    this.loadEventTime = timing.loadEventEnd - timing.responseEnd
    return

## WebSite info
class WebSite
  host: null

  constructor: ->
    this.setHost()

  setHost: ->
    windowHost = window.location.host
    if windowHost == 'localhost'
      pathArray = window.location.pathname.split('/')
      if pathArray[1]
        this.host = windowHost + '/' + pathArray[1]
      else
        this.host = windowHost
    else
      this.host = windowHost
    return

## Client info
class Client
  isTouch: false

  constructor: ->
    this.isTouch = 'ontouchstart' in window;


## MoonRider
window.onload = ->
  delay 0, ->
    # old browser, cancel analytics
    return  if not window.performance

    # init MoonRider
    moonRider = new MoonRider()

    atomic.post('http://localhost:8888/data', JSON.stringify(moonRider)).success(() ->
      # data sent
    ).error () ->
      console.log 'Error while sending data to server ...'
    return


## Usefull functions
delay = (ms, func) ->
  setTimeout func, ms
{'fraction_non_alphanumeric': 0.10430721328489881, 'fraction_numerical': 0.005708354955889984, 'mean_word_length': 3.0493697478991595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '7281646', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1118, 'n_words': 293}