mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Moved services into their own folder, and made no services run for both testing and demo pages.
This commit is contained in:
parent
1c671a3c25
commit
ee791da34c
8 changed files with 19 additions and 24 deletions
|
@ -18,11 +18,11 @@ definitionSchemas =
|
|||
'misc': require './schemas/definitions/misc'
|
||||
|
||||
init = ->
|
||||
# Don't initialize all the social scripts when visiting demo pages
|
||||
if not (/.*\/demo\/.*/).exec window.location.href
|
||||
initializeSocial()
|
||||
|
||||
initializeVendors()
|
||||
path = document.location.pathname
|
||||
testing = path.startsWith '/test'
|
||||
demoing = path.startsWith '/demo'
|
||||
initializeServices() unless testing or demoing
|
||||
|
||||
# Set up Backbone.Mediator schemas
|
||||
setUpDefinitions()
|
||||
setUpChannels()
|
||||
|
@ -33,7 +33,6 @@ init = ->
|
|||
|
||||
treemaExt = require 'treema-ext'
|
||||
treemaExt.setup()
|
||||
filepicker.setKey('AvlkNoldcTOU4PvKi2Xm7z')
|
||||
|
||||
$ -> init()
|
||||
|
||||
|
@ -66,22 +65,17 @@ setUpDefinitions = ->
|
|||
for definition of definitionSchemas
|
||||
Backbone.Mediator.addDefSchemas definitionSchemas[definition]
|
||||
|
||||
initializeVendors = ->
|
||||
initializers =
|
||||
filepicker: require './lib/filepicker'
|
||||
segmentio: require './lib/segmentio'
|
||||
initializeServices = ->
|
||||
services = [
|
||||
'./lib/services/filepicker'
|
||||
'./lib/services/segmentio'
|
||||
'./lib/services/olark'
|
||||
'./lib/services/facebook'
|
||||
'./lib/services/google'
|
||||
'./lib/services/twitter'
|
||||
'./lib/services/linkedin'
|
||||
]
|
||||
|
||||
for name, initializer of initializers
|
||||
initializer()
|
||||
|
||||
initializeSocial = ->
|
||||
initializers =
|
||||
|
||||
olark: require './lib/olark'
|
||||
facebook: require './lib/facebook'
|
||||
google: require './lib/google'
|
||||
twitter: require './lib/twitter'
|
||||
linkedin: require './lib/linkedin'
|
||||
|
||||
for name, initializer of initializers
|
||||
initializer()
|
||||
for service in services
|
||||
service = require service
|
||||
service()
|
||||
|
|
|
@ -23,6 +23,7 @@ module.exports = initializeFilepicker = ->
|
|||
while g < e.length
|
||||
d[e[g]] = f(e[g], d._queue)
|
||||
g++
|
||||
d.setKey('AvlkNoldcTOU4PvKi2Xm7z')
|
||||
window.filepicker = d
|
||||
return
|
||||
) document
|
Loading…
Reference in a new issue