1
0
Fork 0
This commit is contained in:
magnolia-fan 2011-11-27 01:30:43 +04:00
parent 589f0512bf
commit 6fa215cb2a
5 changed files with 10 additions and 2 deletions

View File

@ -44,6 +44,8 @@ class window.Ajax
return false if @previous_page == _ajax.getAnchor()
@previous_page = _ajax.getAnchor()
log "Ajax controller is detecting page ..."
if m = _ajax.getAnchor().match /\/artist\/(.+)\//
_search.loadArtistData m[1]
else if _ajax.getAnchor().match /\/settings\//

View File

@ -9,11 +9,14 @@ window._search = null
window._page = null
window._settings = null
$ ->
jQuery ->
l = document.location
if l.hostname not in ['beathaven.org', 'dev.beathaven.org']
l.href = 'http://beathaven.org/'+ l.hash
window.log = (str) ->
console.log(str) if console?
$.ajaxSetup
beforeSend: (xhr) ->
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))

View File

@ -30,6 +30,7 @@ class window.Session
false
reloadSession: ->
log "Reloading session ..."
_session.query '/user/auth', {}, (ar) ->
_session.setUser ar.user
false

View File

@ -19,6 +19,7 @@ class window.Settings
false
updateLastfmLogin: ->
log "Updating Last.fm info ..."
if window.lastfm_popup.closed
_session.query '/user/auth', {}, (ar) ->
_session.setUser ar.user

View File

@ -18,9 +18,10 @@ class window.Vkontakte
, 0
authInfo: (response) ->
if typeof response isnt 'undefined' and response.session
if typeof response isnt 'undefined' and response.session?
_session = new Session(response.session)
_session.query '/user/auth', {}, (ar) ->
log "Authenticating user ..."
if ar.newbie
VK.Api.call 'getVariable', key: 1281, (r) ->
_session.query '/user/update', params: { name: r.response }, (ar2) ->