MyBB Community Forums

Full Version: Myalerts and Dvz Shoutbox
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello
I use the mialerts plugin on the forum, which adds a notification that someone has marked us on the shoutbox, and now I have a question how to make a backlight for a message
^ can you please elaborate your requirement with a (mock-up) image & test url ..
Description in the picture version
[attachment=40048]

The idea is to click on the notification which will add myalerts with a new mark on the dvz shoutbox for this message to have some kind of glow to distinguish it from others

I'm sorry, my english is bad
If using DVZ Mentions, a recommended way would be to add an attribute to mention tags targeting the current user at https://github.com/dvz/mybb-dvzMentions/...ng.php#L89:
    if ($mybb->user['uid'] != 0 && $mybb->user['uid'] == $user['uid']) {
        $attributes[] = 'data-mentionsCurrenUser="true"';
    }

That would allow to select those with JavaScript, find the parent block and add a highlighted CSS class (the function is executed on load to mark preloaded messages and added as a callback for the ones loaded dynamically):
function highlightMentionMessages() {
	$('#shoutbox .mycode_mention[data-mentionscurrenuser="true"]').parents('.entry').addClass('highlighted');
}
highlightMentionMessages();
dvz_shoutbox.callbacks['entries'].push(highlightMentionMessages);
Quote:That would allow to select those with JavaScript, find the parent block and add a highlighted CSS class (the function is executed on load to mark preloaded messages and added as a callback for the ones loaded dynamically):
function highlightMentionMessages() {
	$('#shoutbox .mycode_mention[data-mentionscurrenuser="true"]').parents('.entry').addClass('highlighted');
}
highlightMentionMessages();
dvz_shoutbox.callbacks['entries'].push(highlightMentionMessages);

Will you tell me where else to add because I do not know where it should be
(2018-03-18, 11:53 AM)Szogi1910 Wrote: [ -> ]
Quote:That would allow to select those with JavaScript, find the parent block and add a highlighted CSS class (the function is executed on load to mark preloaded messages and added as a callback for the ones loaded dynamically):
function highlightMentionMessages() {
	$('#shoutbox .mycode_mention[data-mentionscurrenuser="true"]').parents('.entry').addClass('highlighted');
}
highlightMentionMessages();
dvz_shoutbox.callbacks['entries'].push(highlightMentionMessages);

Will you tell me where else to add because I do not know where it should be

It should work anywhere after the Shoutbox's JS is loaded, so e.g. after {$dvz_shoutbox} inside <script></script> tags.
you will tell me how to add such a backlight to the message in the archive.