summaryrefslogtreecommitdiff
path: root/public/assets/js/index.js
blob: 51c222619e8f8282778abccb7061136560a84adf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var app = (function(){
  var app = {}
  
  app.init = function(){
    app.debug = !! window.location.search.match('debug')
    app.router = new SiteRouter ()
    app.view = null

    $(window).on("focus", app.focus)
    $(window).on("blur", app.blur)
    
    set_background_color_from_time()
    
    auth.init(app.ready)
    sdk.init()
  }
  
  app.ready = function(){
    app.router.route()
  }
  
  app.focused = true
  app.typing = false
  
  app.focus = function(){
    app.focused = true
  }

  app.blur = function(){
    app.focused = false
  }
  
  document.addEventListener('DOMContentLoaded', app.init)  
  
  return app
})()