mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
modified exec_body_scripts to load external scripts. finally moved all the js files out of tpls into their own js
todo: still need to organize the individual scripts client side,
This commit is contained in:
42
public/src/forum/account.js
Normal file
42
public/src/forum/account.js
Normal file
@@ -0,0 +1,42 @@
|
||||
(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;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}());
|
||||
Reference in New Issue
Block a user