mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 01:15:47 +01:00
42 lines
1007 B
JavaScript
42 lines
1007 B
JavaScript
|
|
(function() {
|
||
|
|
var yourid = templates.get('yourid'),
|
||
|
|
theirid = templates.get('theirid');
|
||
|
|
|
||
|
|
var isFriend = {isFriend};
|
||
|
|
|
||
|
|
$(document).ready(function() {
|
||
|
|
|
||
|
|
var rep = $('#reputation');
|
||
|
|
rep.html(app.addCommas(rep.html()));
|
||
|
|
|
||
|
|
var postcount = $('#postcount');
|
||
|
|
postcount.html(app.addCommas(postcount.html()));
|
||
|
|
|
||
|
|
var editLink = $('#editLink');
|
||
|
|
var addFriendBtn = $('#add-friend-btn');
|
||
|
|
|
||
|
|
|
||
|
|
if( yourid !== theirid) {
|
||
|
|
editLink.hide();
|
||
|
|
if(isFriend)
|
||
|
|
addFriendBtn.hide();
|
||
|
|
else
|
||
|
|
addFriendBtn.show();
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
addFriendBtn.hide();
|
||
|
|
}
|
||
|
|
|
||
|
|
addFriendBtn.on('click', function() {
|
||
|
|
$.post('/users/addfriend', {uid: theirid},
|
||
|
|
function(data) {
|
||
|
|
addFriendBtn.remove();
|
||
|
|
$('#user-action-alert').html('Friend Added!').show();
|
||
|
|
}
|
||
|
|
);
|
||
|
|
return false;
|
||
|
|
});
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
}());
|