Files
NodeBB/public/src/forum/account.js

41 lines
883 B
JavaScript
Raw Normal View History

(function() {
var yourid = templates.get('yourid'),
theirid = templates.get('theirid'),
2013-06-20 16:13:23 -04:00
isFollowing = templates.get('isFollowing');
2013-06-20 16:13:23 -04:00
$(document).ready(function() {
2013-06-20 16:13:23 -04:00
var rep = $('#reputation');
rep.html(app.addCommas(rep.html()));
var postcount = $('#postcount');
postcount.html(app.addCommas(postcount.html()));
var editLink = $('#editLink');
var followBtn = $('#follow-btn');
2013-06-20 16:13:23 -04:00
if( yourid !== theirid) {
editLink.hide();
if(isFollowing)
followBtn.hide();
else
followBtn.show();
}
else {
followBtn.hide();
}
followBtn.on('click', function() {
2013-06-20 16:29:44 -04:00
$.post('/users/follow', {uid: theirid, _csrf:$('#csrf_token').val()},
2013-06-20 16:13:23 -04:00
function(data) {
followBtn.remove();
$('#user-action-alert').html('You are now following'+ $('.account-username').text() +'!').show();
}
);
2013-06-20 16:13:23 -04:00
return false;
});
2013-06-20 16:13:23 -04:00
});
}());