Sessions, lastfm auth workarounds
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
var Settings = {
|
||||
|
||||
lastfm_login_url: null,
|
||||
|
||||
getAccountInfo: function(callback) {
|
||||
Session.query('/user/update', {}, callback);
|
||||
},
|
||||
@@ -29,14 +31,27 @@ $('.settings-container .tabs .tab').live('click', function(){
|
||||
$('.form-container').html($('.forms .'+ $(this).attr('data-fieldset')).html());
|
||||
Settings.loadFormData($(this).attr('data-fieldset'));
|
||||
}
|
||||
if ($(this).attr('data-fieldset') == 'lastfm') {
|
||||
Session.query('/lastfm/getinfo', {}, function(data){
|
||||
console.log(data);
|
||||
Settings.lastfm_login_url = data.lastfm_login_url;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$('.lastfm-connect').live('click', function(){
|
||||
window.open(Settings.lastfm_login_url);
|
||||
});
|
||||
|
||||
$('.settings-container .form input').live('blur', function(){
|
||||
params = {
|
||||
'username': $('.settings-container .form input[name$="username"]').first().val(),
|
||||
'email': $('.settings-container .form input[name$="email"]').first().val(),
|
||||
};
|
||||
Settings.saveAccountInfo(params, function(){
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (params.username.length > 0 ? params.username : '%username%') +'!');
|
||||
});
|
||||
var active_tab = $('.settings-container .tabs .tab.active').attr('data-fieldset');
|
||||
if (active_tab == 'account') {
|
||||
params = {
|
||||
'username': $('.settings-container .form input[name$="username"]').first().val(),
|
||||
'email': $('.settings-container .form input[name$="email"]').first().val(),
|
||||
};
|
||||
Settings.saveAccountInfo(params, function(){
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (params.username.length > 0 ? params.username : '%username%') +'!');
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -10,7 +10,7 @@ function authInfo(response) {
|
||||
if (!ar.username) {
|
||||
VK.Api.call('getVariable', {key: 1281}, function(r) {
|
||||
Session.query('/user/update', {'name': r.response}, function(ar2) {
|
||||
$('#header-container .hello .greating').text('Hi there, '+ ar2.username +'!');
|
||||
$('#header-container .hello .greating').text('Hi there, '+ (ar2.username ? ar2.username : '%username%') +'!');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<div class="left-space"></div>
|
||||
<div class="tab" data-fieldset="account">Account</div>
|
||||
<div class="middle-space"></div>
|
||||
<div class="tab" data-fieldset="lastfm">Last.fm</div>
|
||||
</div>
|
||||
<div class="form-container"></div>
|
||||
<div class="forms">
|
||||
@@ -18,5 +19,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lastfm">
|
||||
<div class="form">
|
||||
<div class="field">
|
||||
<div class="label">Username:</div>
|
||||
<div class="value"><input name="username" type="text" disabled="disabled" value="Not connected" /></div>
|
||||
<div class="action-button"><input type="button" class="lastfm-connect" value="Connect"/></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,6 +68,9 @@
|
||||
background-color: #EAEAEA;
|
||||
margin-right: -10px;
|
||||
}
|
||||
.settings-container .form-container .form .field .value {
|
||||
float: left;
|
||||
}
|
||||
.settings-container .form-container .form .field input[type="text"]{
|
||||
font-size: 24px;
|
||||
padding: 4px;
|
||||
@@ -77,6 +80,17 @@
|
||||
border-radius: 3px;
|
||||
width: 300px;
|
||||
}
|
||||
.settings-container .form-container .form .field input[type="button"]{
|
||||
width: 120px;
|
||||
font-size: 24px;
|
||||
padding: 4px;
|
||||
background-color: #DDD;
|
||||
border: #CCC 1px solid;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.settings-container .forms {
|
||||
display: none;
|
||||
}
|
||||
Reference in New Issue
Block a user