News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

aIconList and IconList object

Started by Oldiesmann, August 18, 2024, 08:30:23 PM

Previous topic - Next topic

Oldiesmann

Working more on reactions, I'm at the point now where I want to get the template stuff done. I want to essentially do what we do for message icons, except handle reactions instead of changing the message icons.

Looking at the code in Display.template.php, I see we have this to handle defining the message icon list:

aIconLists[aIconLists.length] = new IconList({
sBackReference: "aIconLists[" + aIconLists.length + "]",
sIconIdPrefix: "msg_icon_",
sScriptUrl: smf_scripturl,
bShowModify: ', !empty(Config::$modSettings['show_modify']) ? 'true' : 'false', ',
iBoardId: ', Utils::$context['current_board'], ',
iTopicId: ', Utils::$context['current_topic'], ',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sLabelIconList: "', Lang::$txt['message_icon'], '",
sBoxBackground: "transparent",
sBoxBackgroundHover: "#ffffff",
iBoxBorderWidthHover: 1,
sBoxBorderColorHover: "#adadad" ,
sContainerBackground: "#ffffff",
sContainerBorder: "1px solid #adadad",
sItemBorder: "1px solid #ffffff",
sItemBorderHover: "1px dotted gray",
sItemBackground: "transparent",
sItemBackgroundHover: "#e0e0f0"
});

In script.js, there's a bunch of related code. Should I just copy and rename all of this to handle things, or is there a better way to do it?

I basically want the same functionality for reactions - click on an icon, which brings up the list of reactions, then click on the icon corresponding to your desired reaction (I haven't yet determined how to handle removing your reaction - I'll get to that once I get the rest working the way I want).
Michael Eshom
Christian Metal Fans

Oldiesmann

Anyone able to provide assistance with this? I'm going to have more free time on the weekends the next few months until the local amusement park opens up again in April and would like to get back to working on this. I basically just want to replicate the code that handles showing available message icons when you click on one. From there I can change what happens when you click on said icon, though I still haven't figured out how to handle removing the reaction entirely. I might just make it so if you click the same reaction again it removes it, or figure out how to put a small "x" in the upper right corner of the icon that you can click on instead. Unfortunately I don't know nearly as much about JavaScript/AJAX/design as I do PHP so this is going to be a bit more challenging for me.
Michael Eshom
Christian Metal Fans

Advertisement: