About page, lots of fixin
This commit is contained in:
@@ -9,22 +9,22 @@ Ajax = (function() {
|
||||
if (data.status != null) {
|
||||
if (data.status === 'loading') {
|
||||
_search.showArtistPics(data.pics);
|
||||
return setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
return _ajax.loadArtistData(name);
|
||||
}, 3000);
|
||||
} else if (data.status === 'corrected') {
|
||||
return _ajax.loadArtistData(data.page);
|
||||
_ajax.loadArtistData(data.page);
|
||||
} else if (data.status === 'suggestions') {
|
||||
_search.hideSpinner();
|
||||
return _search.showSuggestions(data.values);
|
||||
_search.showSuggestions(data.values);
|
||||
} else if (data.status === 'loading_failed') {
|
||||
_search.hideSpinner();
|
||||
return _search.showError();
|
||||
_search.showError();
|
||||
}
|
||||
return _beathaven.redrawScrollbar();
|
||||
} else {
|
||||
_ajax.setArchor('/artist/' + name + '/');
|
||||
_pages.renderArtist(data);
|
||||
return _beathaven.redrawScrollbar();
|
||||
return _pages.renderArtist(data);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
@@ -50,6 +50,13 @@ Ajax = (function() {
|
||||
});
|
||||
return false;
|
||||
};
|
||||
Ajax.prototype.loadAboutPage = function() {
|
||||
$.get('/templates/about.html', function(data) {
|
||||
_pages.renderTextpage(data);
|
||||
return _ajax.setTitle('About');
|
||||
});
|
||||
return false;
|
||||
};
|
||||
Ajax.prototype.setArchor = function(anchor) {
|
||||
this.referer = this.getAnchor();
|
||||
return window.location.hash = '#' + anchor;
|
||||
@@ -72,6 +79,8 @@ Ajax = (function() {
|
||||
_ajax.loadSearchPage();
|
||||
} else if (_ajax.getAnchor().match(/\/settings\//)) {
|
||||
_ajax.loadSettingsPage();
|
||||
} else if (_ajax.getAnchor().match(/\/about\//)) {
|
||||
_ajax.loadAboutPage();
|
||||
} else {
|
||||
_ajax.loadSearchPage();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ _settings = null;
|
||||
$(function() {
|
||||
var l, _ref;
|
||||
l = document.location;
|
||||
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'localhost') {
|
||||
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'local.beathaven.org') {
|
||||
l.href = 'http://beathaven.org/' + l.hash;
|
||||
}
|
||||
_beathaven = new BeatHaven();
|
||||
@@ -28,7 +28,7 @@ BeatHaven = (function() {
|
||||
BeatHaven.prototype.init = function() {
|
||||
this.adjustSizes();
|
||||
this.checkRedrawScrollbar();
|
||||
_vkontakte = new Vkontakte(document.location.host === 'beathaven.org' ? 2335068 : 2383163);
|
||||
_vkontakte = new Vkontakte(2335068);
|
||||
_vkontakte.init();
|
||||
_ajax = new Ajax();
|
||||
_player = new Player();
|
||||
|
||||
@@ -52,6 +52,7 @@ Pages = (function() {
|
||||
$('.data-container .inner').html('').append(artist_info).append(albums_info);
|
||||
yaCounter7596904.hit(_ajax.getAnchor(), data.artist.name, _ajax.referer);
|
||||
_ajax.setTitle(data.artist.name);
|
||||
_beathaven.redrawScrollbar();
|
||||
return false;
|
||||
};
|
||||
Pages.prototype.renderSearch = function(data) {
|
||||
@@ -80,6 +81,10 @@ Pages = (function() {
|
||||
return false;
|
||||
};
|
||||
Pages.prototype.renderSettings = function(data) {
|
||||
if (_session.getUser().name == null) {
|
||||
_ajax.go('/search/');
|
||||
return false;
|
||||
}
|
||||
$('.data-container').css({
|
||||
background: 'none'
|
||||
});
|
||||
@@ -89,5 +94,17 @@ Pages = (function() {
|
||||
$('.settings-container .tabs .tab').first().trigger('click');
|
||||
return false;
|
||||
};
|
||||
Pages.prototype.renderTextpage = function(data) {
|
||||
$('.data-container').css({
|
||||
background: 'url(/images/concrete_wall_2.png) 0 -30px repeat'
|
||||
});
|
||||
$('.data-container .inner').html(data);
|
||||
_beathaven.redrawScrollbar();
|
||||
return false;
|
||||
};
|
||||
return Pages;
|
||||
})();
|
||||
})();
|
||||
$('.about').live('click', function() {
|
||||
_ajax.go('/about/');
|
||||
return false;
|
||||
});
|
||||
@@ -30,5 +30,10 @@ Session = (function() {
|
||||
$.post(url, q_params, callback);
|
||||
return false;
|
||||
};
|
||||
Session.prototype.reloadSession = function() {
|
||||
return _session.query('/user/auth', {}, function(ar) {
|
||||
return _session.setUser(ar.user);
|
||||
});
|
||||
};
|
||||
return Session;
|
||||
})();
|
||||
@@ -2,36 +2,54 @@ var Settings;
|
||||
Settings = (function() {
|
||||
function Settings() {}
|
||||
Settings.prototype.getAccountInfo = function(callback) {
|
||||
return _session.query('/user/update/', {}, callback);
|
||||
_session.query('/user/update/', {}, callback);
|
||||
return false;
|
||||
};
|
||||
Settings.prototype.saveAccountInfo = function(params, callback) {
|
||||
return _session.query('/user/update', params, callback);
|
||||
_session.query('/user/update', params, callback);
|
||||
return false;
|
||||
};
|
||||
Settings.prototype.loadFormData = function(form) {
|
||||
if (form === 'account') {
|
||||
$('.settings-container .form input[name$="username"]').val(_session.getUser().name);
|
||||
return $('.settings-container .form input[name$="email"]').val(_session.getUser().email);
|
||||
$('.settings-container .form input[name$="email"]').val(_session.getUser().email);
|
||||
} else if (form === 'lastfm') {
|
||||
if (_session.getUser().lastfm_username) {
|
||||
return $('.form-container input[name$="username"]').first().val(_session.getUser().lastfm_username);
|
||||
$('.form-container input[name$="username"]').first().val(_session.getUser().lastfm_username);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
Settings.prototype.updateLastfmLogin = function() {
|
||||
if (window.lastfm_popup.closed) {
|
||||
_session.query('/user/auth', {}, function(ar) {
|
||||
_session.setUser(ar.user);
|
||||
return _settings.loadFormData('lastfm');
|
||||
});
|
||||
} else {
|
||||
setTimeout(_settings.updateLastfmLogin, 100);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return Settings;
|
||||
})();
|
||||
$('.settings').live('click', function() {
|
||||
return _ajax.go('/settings/');
|
||||
_ajax.go('/settings/');
|
||||
return false;
|
||||
});
|
||||
$('.settings-container .tabs .tab').live('click', function() {
|
||||
if (!$(this).hasClass('active')) {
|
||||
$('.settings-container .tabs .tab').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.form-container').html($('.forms .' + $(this).attr('data-fieldset')).html());
|
||||
return _settings.loadFormData($(this).attr('data-fieldset'));
|
||||
_settings.loadFormData($(this).attr('data-fieldset'));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('.lastfm-connect').live('click', function() {
|
||||
return window.open(_session.getUser().lastfm_login_url);
|
||||
window.lastfm_popup = window.open(_session.getUser().lastfm_login_url);
|
||||
setTimeout(_settings.updateLastfmLogin, 100);
|
||||
return false;
|
||||
});
|
||||
$('.settings-container .form input').live('blur', function() {
|
||||
var active_tab, params;
|
||||
@@ -41,8 +59,10 @@ $('.settings-container .form input').live('blur', function() {
|
||||
username: $('.settings-container .form input[name$="username"]').first().val(),
|
||||
email: $('.settings-container .form input[name$="email"]').first().val()
|
||||
};
|
||||
return _settings.saveAccountInfo(params, function() {
|
||||
return $('#header-container .hello .greating').text('Hi there, ' + (params.username.length > 0 ? params.username : '%username%') + '!');
|
||||
_settings.saveAccountInfo(params, function() {
|
||||
$('.header-container .hello .greating span').text((params.username.length > 0 ? params.username : '%username%'));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -1,15 +1,24 @@
|
||||
var Vkontakte;
|
||||
Vkontakte = (function() {
|
||||
Vkontakte.prototype.qr = null;
|
||||
Vkontakte.prototype.api_id = null;
|
||||
function Vkontakte(api_id) {
|
||||
this.api_id = api_id;
|
||||
}
|
||||
Vkontakte.prototype.getApiId = function() {
|
||||
return this.api_id;
|
||||
};
|
||||
Vkontakte.prototype.init = function() {
|
||||
this.qr = [];
|
||||
VK.init({
|
||||
apiId: this.api_id
|
||||
});
|
||||
return VK.Auth.getLoginStatus(this.authInfo);
|
||||
window.vkAsyncInit = function() {
|
||||
VK.init({
|
||||
apiId: _vkontakte.getApiId()
|
||||
});
|
||||
return VK.Auth.getLoginStatus(_vkontakte.authInfo);
|
||||
};
|
||||
return setTimeout(function() {
|
||||
return $('#vk_api_transport').append('<script async="async" src="http://vkontakte.ru/js/api/openapi.js"></script>');
|
||||
}, 0);
|
||||
};
|
||||
Vkontakte.prototype.authInfo = function(response) {
|
||||
var _session;
|
||||
@@ -31,20 +40,22 @@ Vkontakte = (function() {
|
||||
name: r.response
|
||||
}, function(ar2) {
|
||||
_session.setUser(ar2.user);
|
||||
return $('.header-container .hello .greating').text('Hi there, ' + (_session.getUser().name ? _session.getUser().name : '%username%') + '!');
|
||||
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
_session.setUser(ar.user);
|
||||
}
|
||||
return $('.header-container .hello .greating').text('Hi there, ' + (_session.getUser().name ? _session.getUser().name : '%username%') + '!');
|
||||
$('.header-container .hello').show();
|
||||
return $('.header-container .hello .greating').html('Tēnā koe, <span class="settings">' + (_session.getUser().name ? _session.getUser().name : '%username%') + '</span>!');
|
||||
});
|
||||
} else {
|
||||
_session = new Session({});
|
||||
_session.setUser({});
|
||||
$('#vk_login, .auth_notice').css({
|
||||
display: 'block'
|
||||
});
|
||||
$('#vk_logout').hide();
|
||||
$('.header-container .hello').hide();
|
||||
}
|
||||
return window._session = _session;
|
||||
};
|
||||
@@ -117,11 +128,15 @@ Vkontakte = (function() {
|
||||
};
|
||||
return Vkontakte;
|
||||
})();
|
||||
$(function() {
|
||||
$('#vk_login').click(function() {
|
||||
return VK.Auth.login(_vkontakte.authInfo(), 8);
|
||||
});
|
||||
return $('#vk_logout').click(function() {
|
||||
return VK.Auth.logout(_vkontakte.authInfo());
|
||||
});
|
||||
$('#vk_login').live('click', function() {
|
||||
VK.Auth.login(function(response) {
|
||||
_vkontakte.authInfo(response);
|
||||
return false;
|
||||
}, 8);
|
||||
return false;
|
||||
});
|
||||
$('#vk_logout').live('click', function() {
|
||||
_ajax.go('/search/');
|
||||
VK.Auth.logout(_vkontakte.authInfo);
|
||||
return false;
|
||||
});
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
.add-album-button-container {
|
||||
position: relative;
|
||||
margin: 10px -25px 0 0;
|
||||
margin: 10px -50px 0 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.header-container {
|
||||
.hello {
|
||||
display: none;
|
||||
float: right;
|
||||
margin: 6px 10px 0 0;
|
||||
color: #222;
|
||||
@@ -8,16 +9,21 @@
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 8px;
|
||||
|
||||
span {
|
||||
border-bottom: #202020 1px dotted;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.settings {
|
||||
.settings-button {
|
||||
float: right;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
margin: 1px 0;
|
||||
background-image: url(/images/icns/settings.png);
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navigation {
|
||||
@@ -54,7 +60,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.vk_auth {
|
||||
&.vk_auth {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,19 @@
|
||||
@include rounded(3);
|
||||
|
||||
&.gray {
|
||||
background-color: #EEE;
|
||||
color: #444;
|
||||
border-color: #DDD;
|
||||
background-color: #e0e0e0;
|
||||
color: #404040;
|
||||
text-shadow: #d0d0d0 0px 1px 1px;
|
||||
border-color: #d0d0d0;
|
||||
box-shadow: #c0c0c0 1px 1px 0px;
|
||||
}
|
||||
|
||||
&.red {
|
||||
background-color: #fab0b0;
|
||||
color: #e05050;
|
||||
text-shadow: #c08080 0px 1px 1px;
|
||||
border-color: #eaa0a0;
|
||||
box-shadow: #da9090 1px 1px 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $icons_dir: "/images/icns/";
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
width: 80px;
|
||||
width: 50px;
|
||||
height: 30px;
|
||||
z-index: 10;
|
||||
@include alpha_gradient(32, 32, 32, '202020');
|
||||
|
||||
@@ -53,7 +53,10 @@
|
||||
border-top: #CCC 1px solid;
|
||||
|
||||
.form {
|
||||
margin: 25px;
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
||||
.field {
|
||||
height: 40px;
|
||||
@@ -94,8 +97,18 @@
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.saved {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logout {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.forms {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.textpage {
|
||||
margin: 25px;
|
||||
}
|
||||
@@ -31,7 +31,7 @@
|
||||
border: #d0d0d0 1px solid; }
|
||||
.albums .album .pic .add-album-button-container {
|
||||
position: relative;
|
||||
margin: 10px -25px 0 0;
|
||||
margin: 10px -50px 0 0;
|
||||
text-align: center; }
|
||||
.albums .album .name {
|
||||
display: block;
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
@import "search.css" all;
|
||||
@import "albums.css" all;
|
||||
@import "settings.css" all;
|
||||
@import "textpage.css" all;
|
||||
@@ -1,4 +1,5 @@
|
||||
.header-container .hello {
|
||||
display: none;
|
||||
float: right;
|
||||
margin: 6px 10px 0 0;
|
||||
color: #222; }
|
||||
@@ -6,7 +7,10 @@
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 8px; }
|
||||
.header-container .hello .settings {
|
||||
.header-container .hello .greating span {
|
||||
border-bottom: #202020 1px dotted;
|
||||
cursor: pointer; }
|
||||
.header-container .hello .settings-button {
|
||||
float: right;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
@@ -39,7 +43,7 @@
|
||||
font-size: 9px;
|
||||
font-weight: normal;
|
||||
margin: 10px 0 0 4px; }
|
||||
.header-container .navigation li .vk_auth {
|
||||
.header-container .navigation li.vk_auth {
|
||||
display: none; }
|
||||
.header-container .navigation li a {
|
||||
color: inherit;
|
||||
|
||||
@@ -13,9 +13,17 @@
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px; }
|
||||
.button.gray {
|
||||
background-color: #EEE;
|
||||
color: #444;
|
||||
border-color: #DDD; }
|
||||
background-color: #e0e0e0;
|
||||
color: #404040;
|
||||
text-shadow: #d0d0d0 0px 1px 1px;
|
||||
border-color: #d0d0d0;
|
||||
box-shadow: #c0c0c0 1px 1px 0px; }
|
||||
.button.red {
|
||||
background-color: #fab0b0;
|
||||
color: #e05050;
|
||||
text-shadow: #c08080 0px 1px 1px;
|
||||
border-color: #eaa0a0;
|
||||
box-shadow: #da9090 1px 1px 0px; }
|
||||
|
||||
/* Scrollbars */
|
||||
.data-container .scrollbar-pane {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
width: 80px;
|
||||
width: 50px;
|
||||
height: 30px;
|
||||
z-index: 10;
|
||||
background: -moz-linear-gradient(left, rgba(32, 32, 32, 0) 0%, #202020 50%, #202020 100%);
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
height: 500px;
|
||||
border-top: #CCC 1px solid; }
|
||||
.settings-container .form-container .form {
|
||||
margin: 25px; }
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
width: 100%; }
|
||||
.settings-container .form-container .form .field {
|
||||
height: 40px;
|
||||
margin-bottom: 10px;
|
||||
@@ -75,5 +78,11 @@
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
margin-left: 5px; }
|
||||
.settings-container .form-container .form .field .saved {
|
||||
float: left; }
|
||||
.settings-container .form-container .logout {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 0; }
|
||||
.settings-container .forms {
|
||||
display: none; }
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
.textpage {
|
||||
margin: 25px; }
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="textpage">
|
||||
Now back to the good part!
|
||||
</div>
|
||||
@@ -17,6 +17,13 @@
|
||||
<div class="label">Email:</div>
|
||||
<div class="value"><input name="email" type="text"/></div>
|
||||
</div>
|
||||
|
||||
<div class="save">
|
||||
<div class="button gray">Hello, my name is Useless Button</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="logout">
|
||||
<div class="button red" id="vk_logout">Log out</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lastfm">
|
||||
|
||||
Reference in New Issue
Block a user