by JScript February 25th 2015, 2:24 pm
@_Twisted_Mods_Your code is very nice, well done!
Here is my version based on yours with little modifications, see:
New code link: https://help.forumotion.com/t50435p30-friend-request-in-posts#945268
- Code:
$(function() {
if (!_userdata.session_logged_in) {
return false;
}
var FFinPosts = {
sFriend: "Add As Friend",
sFoes: "Add To Foes",
oTarget: $('.post'),
iLen: 0,
sUser_name: "",
oThis: null
};
FFinPosts.iLen = FFinPosts.oTarget.length;
for (var i = 0; i < FFinPosts.iLen; i++) {
FFinPosts.oThis = $(FFinPosts.oTarget[i]);
FFinPosts.sUser_name = FFinPosts.oThis.find('.author a, .name, .user a[href^="/u"]').text();
if (FFinPosts.sUser_name !== _userdata.username) {
FFinPosts.oThis.find('.postprofile dd:last, .postdetails.poster-profile, .user-contact')
.append(
'<a class="profile-icon" href="/profile?friend=' + FFinPosts.sUser_name + '&mode=editprofile&page_profil=friendsfoes">' +
' <img title="Add As Friend" alt="Add As Friend" src="http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/16/Actions-list-add-user-icon.png" width="25" height="25">' +
'</a>' +
'<a class="profile-icon" href="/profile?foe=' + FFinPosts.sUser_name + '&mode=editprofile&page_profil=friendsfoes">' +
' <img title="Add To Foes" alt="Add To Foes" src="http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/16/Actions-list-remove-user-icon.png" width="25" height="25">' +
'</a>'
)
}
}
});
Working on all versions too.
JS
Last edited by JScript on February 25th 2015, 7:16 pm; edited 1 time in total