Join Us and become a Member for a Verified Badge to access private areas with the latest PS4 PKGs.
Announcements       Thread starter PSXHAX       24      
Status
Not open for further replies.

PSXHAX

Staff Member
Verified
Moderator
I'm working on adding a @ mention link that appears next to each poster's name in threads so that users can mention them by clicking the link without having to type their names out manually.

Mention Link.png

Currently if you click the @ symbol it loads to the main page, and then if you press the 'Back' button it will load the page you were just on and in the QuickReply box the user's name will be added that you mentioned.

Where I need help is getting it to function that way without navigating away from the page you're on, so that users don't have to press the 'Back' button as that is more time-consuming than manually typing their names out. :p

Currently the code being used is as follows:
Code:
<a href="" rel="nofollow" style="cursor: pointer;" onclick="document.getElementById('ctrl_message_html').value += '@{$message.username} '" value="@{$message.username} " />@</a>
I've tried adding things like return false; to prevent navigating away and also adding {$requestPaths.requestUri} to the href (which reloads the current page instead of the main page) in message_user_info but neither adds the user's name being mentioned to the QuickReply box.

If any HTML or JavaScript gurus have ideas, feel free to share them below.

I'm not seeking to add Java files or other resources to get it working, only an inline method similar to what is used in the Shoutbox when you click on user avatars. ;)
 
Code:
<a href="javascript:void(0)" rel="nofollow" style="cursor: pointer;" onclick="var $e = XenForo.getEditorInForm($('#QuickReply'));if (typeof $e.val==='function'){$e.val($e.val() + '@{$message.username} ');}else{$e.document.body.innerHTML += '@{$message.username} ';}" />@</a>
 
Code:
<a href="" rel="nofollow" style="cursor: pointer;" onclick="document.getElementById('ctrl_message_html').value += '@{$message.username} ';var form= XenForo.getEditorInForm($('#QuickReply'));form.$editor.text(form.$editor.text()+'@{$message.username} '); return false;" value="@{$message.username} " />@</a>
 
When I was playing around (before implementing @DenisMan's code) I was able to get it to 'zoom' down to the QuickReply box when clicking on one of the @'s.

We could try adding that back in also, although it may not be desirable if you're clicking on multiple @'s before composing a reply.
 
That sounds cool I myself don't @ more than one person. I actually haven't seen a lot of people @ more than 2 in a reply.
 
Good point, I'll have to sort out which code I had that made it jump to the QuickReply box onclick and try to add it back soon then.
 
Status
Not open for further replies.
Back
Top