1
0
Fork 0

Init spinner

This commit is contained in:
magnolia-fan 2011-06-30 06:05:57 +04:00
parent 4a2f793635
commit 124e9e481e
9 changed files with 71 additions and 18 deletions

View File

@ -44,8 +44,6 @@ class BeatHaven
_pages = new Pages() _pages = new Pages()
_settings = new Settings() _settings = new Settings()
_ajax.detectPage()
adjustSizes: -> adjustSizes: ->
$('.data-container').height $(window).height() - $('.header-container').height() $('.data-container').height $(window).height() - $('.header-container').height()

View File

@ -80,7 +80,7 @@ class Pages
false false
renderSettings: (data) -> renderSettings: (data) ->
unless _session.getUser().name? unless _session.getUser().id?
_ajax.go('/search/') _ajax.go('/search/')
return false return false
$('.data-container').css background: 'none' $('.data-container').css background: 'none'

View File

@ -37,12 +37,18 @@ class Vkontakte
_session.setUser ar2.user _session.setUser ar2.user
$('.header-container .hello .greating') $('.header-container .hello .greating')
.html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!' .html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();
else else
_session.setUser ar.user _session.setUser ar.user
$('.header-container .hello').show() $('.header-container .hello').show()
$('.header-container .hello .greating') $('.header-container .hello .greating')
.html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!' .html 'Tēnā koe, <span class="settings">' +(if _session.getUser().name then _session.getUser().name else '%username%')+ '</span>!'
window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();
if response.session.expire? if response.session.expire?
setTimeout -> setTimeout ->
@ -54,10 +60,12 @@ class Vkontakte
_session.setUser {} _session.setUser {}
$('#vk_login, .auth_notice').css display: 'block' $('#vk_login, .auth_notice').css display: 'block'
$('.header-container .hello').hide() $('.header-container .hello').hide()
window._session = _session window._session = _session
_ajax.detectPage()
$('.fullscreen').hide();
auth: -> auth: ->
VK.Auth.login (response) -> VK.Auth.getLoginStatus (response) ->
_vkontakte.authInfo(response) _vkontakte.authInfo(response)
false false
, 8 , 8
@ -121,7 +129,10 @@ class Vkontakte
false false
$('#vk_login').live 'click', -> $('#vk_login').live 'click', ->
_vkontakte.auth() VK.Auth.login (response) ->
_vkontakte.authInfo(response)
false
, 8
false false
$('#vk_logout').live 'click', -> $('#vk_logout').live 'click', ->
_ajax.go '/search/'; _ajax.go '/search/';

View File

@ -74,6 +74,11 @@
<div id="vk_api_transport"></div> <div id="vk_api_transport"></div>
<div class="auth_notice"><div class="arrow">&uarr;</div>Don't forget to log in, please. It's simple.</div> <div class="auth_notice"><div class="arrow">&uarr;</div>Don't forget to log in, please. It's simple.</div>
<div class="fullscreen">
<div class="inner">
<img src="/images/loader.gif" alt=""/>
</div>
</div>
<!-- Yandex.Metrika counter --> <!-- Yandex.Metrika counter -->
<script type="text/javascript">var yaParams = {};</script><div style="display:none;"><script type="text/javascript">(function(w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter7596904 = new Ya.Metrika({id:7596904, enableAll: true,params:window.yaParams||{ }}); } catch(e) { } }); })(window, "yandex_metrika_callbacks");</script></div><script src="//mc.yandex.ru/metrika/watch.js" type="text/javascript" defer="defer"></script><noscript><div><img src="//mc.yandex.ru/watch/7596904" style="position:absolute; left:-9999px;" alt="" /></div></noscript> <script type="text/javascript">var yaParams = {};</script><div style="display:none;"><script type="text/javascript">(function(w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter7596904 = new Ya.Metrika({id:7596904, enableAll: true,params:window.yaParams||{ }}); } catch(e) { } }); })(window, "yandex_metrika_callbacks");</script></div><script src="//mc.yandex.ru/metrika/watch.js" type="text/javascript" defer="defer"></script><noscript><div><img src="//mc.yandex.ru/watch/7596904" style="position:absolute; left:-9999px;" alt="" /></div></noscript>

View File

@ -35,8 +35,7 @@ BeatHaven = (function() {
_player.initJplayer(); _player.initJplayer();
_search = new Search(); _search = new Search();
_pages = new Pages(); _pages = new Pages();
_settings = new Settings(); return _settings = new Settings();
return _ajax.detectPage();
}; };
BeatHaven.prototype.adjustSizes = function() { BeatHaven.prototype.adjustSizes = function() {
$('.data-container').height($(window).height() - $('.header-container').height()); $('.data-container').height($(window).height() - $('.header-container').height());

View File

@ -81,7 +81,7 @@ Pages = (function() {
return false; return false;
}; };
Pages.prototype.renderSettings = function(data) { Pages.prototype.renderSettings = function(data) {
if (_session.getUser().name == null) { if (_session.getUser().id == null) {
_ajax.go('/search/'); _ajax.go('/search/');
return false; return false;
} }

View File

@ -42,17 +42,23 @@ Vkontakte = (function() {
name: r.response name: r.response
}, function(ar2) { }, function(ar2) {
_session.setUser(ar2.user); _session.setUser(ar2.user);
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!'); $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
window._session = _session;
_ajax.detectPage();
return $('.fullscreen').hide();
}); });
}); });
} else { } else {
_session.setUser(ar.user); _session.setUser(ar.user);
} }
$('.header-container .hello').show(); $('.header-container .hello').show();
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!'); $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
window._session = _session;
_ajax.detectPage();
return $('.fullscreen').hide();
}); });
if (response.session.expire != null) { if (response.session.expire != null) {
setTimeout(function() { return setTimeout(function() {
_vkontakte.auth(); _vkontakte.auth();
return false; return false;
}, response.session.expire * 1000 - new Date().getTime() + 1000); }, response.session.expire * 1000 - new Date().getTime() + 1000);
@ -64,11 +70,13 @@ Vkontakte = (function() {
display: 'block' display: 'block'
}); });
$('.header-container .hello').hide(); $('.header-container .hello').hide();
window._session = _session;
_ajax.detectPage();
return $('.fullscreen').hide();
} }
return window._session = _session;
}; };
Vkontakte.prototype.auth = function() { Vkontakte.prototype.auth = function() {
VK.Auth.login(function(response) { VK.Auth.getLoginStatus(function(response) {
_vkontakte.authInfo(response); _vkontakte.authInfo(response);
return false; return false;
}, 8); }, 8);
@ -145,7 +153,10 @@ Vkontakte = (function() {
return Vkontakte; return Vkontakte;
})(); })();
$('#vk_login').live('click', function() { $('#vk_login').live('click', function() {
_vkontakte.auth(); VK.Auth.login(function(response) {
_vkontakte.authInfo(response);
return false;
}, 8);
return false; return false;
}); });
$('#vk_logout').live('click', function() { $('#vk_logout').live('click', function() {

View File

@ -1,9 +1,25 @@
@import "rounded"; @import "rounded";
.fullscreen { .fullscreen {
position: absolute;
z-index: 9999;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: #ffffff;
text-align: center; text-align: center;
background: rgba(255, 255, 255, 0.9);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#e5ffffff, endColorstr=#e5ffffff);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#e5ffffff, endColorstr=#e5ffffff)";
.inner {
position: relative;
top: 50%;
margin-top: -50px;
height: 100px;
}
} }
.button { .button {
@ -119,7 +135,7 @@
background-color: #07F; background-color: #07F;
color: #FFF; color: #FFF;
top: 32px; top: 32px;
left: 230px; left: 280px;
padding: 8px; padding: 8px;
border: #05D 1px solid; border: #05D 1px solid;
@include rounded(3); @include rounded(3);

View File

@ -1,7 +1,20 @@
.fullscreen { .fullscreen {
position: absolute;
z-index: 9999;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
text-align: center; } background-color: #ffffff;
text-align: center;
background: rgba(255, 255, 255, 0.9);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#e5ffffff, endColorstr=#e5ffffff);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#e5ffffff, endColorstr=#e5ffffff)"; }
.fullscreen .inner {
position: relative;
top: 50%;
margin-top: -50px;
height: 100px; }
.button { .button {
display: inline; display: inline;
@ -79,7 +92,7 @@
background-color: #07F; background-color: #07F;
color: #FFF; color: #FFF;
top: 32px; top: 32px;
left: 230px; left: 280px;
padding: 8px; padding: 8px;
border: #05D 1px solid; border: #05D 1px solid;
border-radius: 3px; border-radius: 3px;