Smart authorized content display
This commit is contained in:
@@ -63,6 +63,5 @@ $ ->
|
||||
_ajax.go $(this).attr("href")
|
||||
false
|
||||
$('.foreign-link').live 'click', (e) ->
|
||||
# window.open($(this).attr('href'))
|
||||
e.preventDefault();
|
||||
window.open($(this).attr('href'))
|
||||
false
|
||||
@@ -21,10 +21,6 @@ class window.Search
|
||||
if data.status in ['ok', 'loading']
|
||||
_page.render data
|
||||
_search.hideSpinner()
|
||||
if _session.getUser().id?
|
||||
$('.authorized-action').show()
|
||||
else
|
||||
$('.authorized-action').hide()
|
||||
if data.status is 'loading'
|
||||
setTimeout () ->
|
||||
_search.loadArtistData name
|
||||
|
||||
@@ -12,6 +12,10 @@ class window.Session
|
||||
@vk_params = _params
|
||||
|
||||
setUser: (user) ->
|
||||
if user.id?
|
||||
$("body").addClass("authorized")
|
||||
else
|
||||
$("body").removeClass("authorized")
|
||||
log "Setting user ..."
|
||||
@user = user
|
||||
log "Hello, #{if user.name? then user.name else "%username%"}!"
|
||||
@@ -38,15 +42,3 @@ class window.Session
|
||||
_session.setUser ar.user
|
||||
false
|
||||
false
|
||||
|
||||
displayAuthorizedContent: ->
|
||||
$('.playlist, .player').show()
|
||||
$('.ad_here, #login').hide()
|
||||
$('.authorized-action').show()
|
||||
$('#authorized').css display: 'block'
|
||||
|
||||
hideAuthorizedContent: ->
|
||||
$('.playlist, .player, #authorized').hide()
|
||||
$('.ad_here').show()
|
||||
$('.authorized-action').hide()
|
||||
$('#login').css display: 'block'
|
||||
|
||||
@@ -30,7 +30,6 @@ class window.Vkontakte
|
||||
_session.setUser ar2.user
|
||||
window._session = _session
|
||||
_ajax.detectPage()
|
||||
_session.displayAuthorizedContent()
|
||||
$('#authorized').css display: 'block'
|
||||
if ar.ok_reload
|
||||
window.location.reload()
|
||||
@@ -40,7 +39,6 @@ class window.Vkontakte
|
||||
false
|
||||
else
|
||||
_session.setUser ar.user
|
||||
_session.displayAuthorizedContent()
|
||||
window._session = _session
|
||||
_ajax.detectPage()
|
||||
$('.fullscreen').hide();
|
||||
@@ -58,7 +56,6 @@ class window.Vkontakte
|
||||
else
|
||||
_session = new Session({})
|
||||
_session.setUser {}
|
||||
_session.hideAuthorizedContent()
|
||||
window._session = _session
|
||||
_ajax.detectPage()
|
||||
$('.fullscreen').hide();
|
||||
|
||||
Reference in New Issue
Block a user