-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.coffee
59 lines (52 loc) · 1.71 KB
/
index.coffee
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Environment
process.env.APP= 'nicolive.io'
# Dependencies
app= require './app'
require './root/header.coffee'
require './root/footer.coffee'
require './root/setting.coffee'
require './root/view.coffee'
require './viewer'
# Routes
app.config ($urlRouterProvider)->
$urlRouterProvider.when '','/'
app.config ($stateProvider)->
$stateProvider.state 'root',
views:
header:
template: require './root/header.jade'
controller: 'headerController as header'
footer:
template: require './root/footer.jade'
controller: 'footerController as footer'
app.config ($stateProvider)->
$stateProvider.state 'root.top',
url: '/'
views:
'container@':
template: require './top/index.jade'
app.config ($stateProvider)->
$stateProvider.state 'root.viewer',
url: '/:id?sessionId'
resolve:
server:
($q,$localStorage,$stateParams,socket,$rootScope)->
$q.when()
.then ->
$q (resolve)->
socket.emit 'auth',$localStorage.session
socket.removeAllListeners 'authorized'
socket.on 'authorized',resolve
.then ->
$q (resolve)->
socket.emit 'view',decodeURIComponent($stateParams.id),{res_from:100}
socket.removeAllListeners 'getplayerstatus'
socket.on 'getplayerstatus',(playerStatus)->
$rootScope.title= playerStatus.title
$rootScope.picture_url= playerStatus.picture_url
$rootScope.default_community= playerStatus.default_community
resolve socket
views:
'container@':
template: require './viewer/index.jade'
controller: 'viewerController as viewer'