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() return false if @previous_page == _ajax.getAnchor()
@previous_page = _ajax.getAnchor() @previous_page = _ajax.getAnchor()
log "Ajax controller is detecting page ..."
if m = _ajax.getAnchor().match /\/artist\/(.+)\// if m = _ajax.getAnchor().match /\/artist\/(.+)\//
_search.loadArtistData m[1] _search.loadArtistData m[1]
else if _ajax.getAnchor().match /\/settings\// else if _ajax.getAnchor().match /\/settings\//

View File

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

View File

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

View File

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

View File

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