mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-07 10:34:46 -04:00
Hopefully fixed #106 by being super conservative about whether G+, FB, and Twitter can be loaded.
This commit is contained in:
parent
b098515a3b
commit
e2414f7c5a
4 changed files with 12 additions and 12 deletions
app
|
@ -62,11 +62,11 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
|
||||
renderLoginButtons: ->
|
||||
$('.share-buttons, .partner-badges').addClass('fade-in').delay(10000).removeClass('fade-in', 5000)
|
||||
setTimeout(FB.XFBML.parse, 10) if FB? # Handles FB login and Like
|
||||
twttr?.widgets?.load()
|
||||
setTimeout(FB.XFBML.parse, 10) if FB?.XFBML?.parse # Handles FB login and Like
|
||||
twttr?.widgets?.load?()
|
||||
|
||||
return unless gapi?.plusone?
|
||||
gapi.plusone.go() # Handles +1 button
|
||||
gapi.plusone.go?() # Handles +1 button
|
||||
for gplusButton in $('.gplus-login-button')
|
||||
params = {
|
||||
callback:"signinCallback",
|
||||
|
@ -75,7 +75,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
scope:"https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email",
|
||||
size:"medium",
|
||||
}
|
||||
if gapi.signin
|
||||
if gapi.signin?.render
|
||||
gapi.signin.render(gplusButton, params)
|
||||
else
|
||||
console.warn "Didn't have gapi.signin to render G+ login button. (DoNotTrackMe extension?)"
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = class Tracker
|
|||
return if me.get("anonymous")
|
||||
olark 'api.visitor.updateEmailAddress', emailAddress: me.get("email")
|
||||
olark 'api.chat.updateVisitorNickname', snippet: me.displayName()
|
||||
|
||||
|
||||
updatePlayState: (level, session) ->
|
||||
link = "codecombat.com/play/level/#{level.get('slug') or level.id}?session=#{session.id}"
|
||||
snippet = [
|
||||
|
@ -32,10 +32,10 @@ module.exports = class Tracker
|
|||
"User ID: #{me.id}"
|
||||
"Session ID: #{session.id}"
|
||||
"Level: #{level.get('name')}"
|
||||
|
||||
|
||||
]
|
||||
olark 'api.chat.updateVisitorStatus', snippet: snippet
|
||||
|
||||
olark 'api.chat.updateVisitorStatus', snippet: snippet
|
||||
|
||||
trackPageView: ->
|
||||
return unless @isProduction and analytics?
|
||||
url = Backbone.history.getFragment()
|
||||
|
|
|
@ -27,7 +27,7 @@ module.exports.loginUser = (userObject, failure=genericFailure) ->
|
|||
jqxhr.fail(failure)
|
||||
|
||||
module.exports.logoutUser = ->
|
||||
FB.logout()
|
||||
FB?.logout?()
|
||||
res = $.post('/auth/logout', {}, ->
|
||||
saveObjectToStorage(CURRENT_USER_KEY, null)
|
||||
window.location.reload()
|
||||
|
|
|
@ -92,9 +92,9 @@ module.exports = class VictoryModal extends View
|
|||
afterInsert: ->
|
||||
super()
|
||||
Backbone.Mediator.publish 'play-sound', trigger: "victory"
|
||||
gapi?.plusone.go @$el[0]
|
||||
FB?.XFBML.parse @$el[0]
|
||||
twttr?.widgets?.load()
|
||||
gapi?.plusone?.go? @$el[0]
|
||||
FB?.XFBML?.parse? @$el[0]
|
||||
twttr?.widgets?.load?()
|
||||
|
||||
onHidden: ->
|
||||
Backbone.Mediator.publish 'level:victory-hidden'
|
||||
|
|
Loading…
Add table
Reference in a new issue