Glossary for SMF 2.1

Started by GL700Wing, September 15, 2024, 03:41:07 PM

Previous topic - Next topic

GL700Wing

Link to the mod

Glossary for SMF 2.1
v1.5

Based on Glossary mod by Slinouille



Introduction
The mod adds a Glossary to your forum.  You can create Glossary items (ie, keywords and definitions) that are displayed in messages as a keyword tooltip containing the definition.

This mod uses the following JavaScript plugins (some with associated CSS).
- jQuery Tooltip plugin from jQuery UI (customised for this mod).
- jQuery SimpleModal plugin from SimpleModal 1.4.4 (updated for this mod).
- jQuery ContextMenu plugin originally from A Beautiful Site.
- famfamfam Silk icons available from Peacock Software.

Glossary for SMF 2.0
v0.3.1 - 25-Apr-09
o Create a Glossary consisting of keywords and keyword definitions for your forum community.
o Allow numeric keywords in addition to alphabetic keywords.
o Allow categories for grouping of keywords.
o Allow keywords to have synonyms.
o New BBCode to enable keywords to be inserted inline in messages.
o Option to allow keyword definitions to contain BBCodes.
o Tooltips:
  ~ Option to view keyword definition when hovering over keyword in a message.
  ~ Option for BBCode keywords to be not case-sensitive.
  ~ If a keyword is used more than once per message option to only display tooltip once.
  ~ Specify character to be used to insert line breaks in keywords definitions.
  ~ Support for tooltips with SimplePortal mod.
o Membergroup permissions to allow/disallow members to:
  ~ View the Glossary list.
  ~ Suggest new Glossary keywords with definitions.
  ~ Manage/administer the Glossary keywords, keyword definitions and categories.
o Glossary List Administration:
  ~ Keywords (with keyword definitions) can be:.
     * Added.
     * Updated (including being renamed and/or having synonyms added, updated, or deleted).
     * Deleted.
     * Approved.
     * Unapproved.
     * Have tooltip for keyword definition enabled.
     * Have tooltip for keyword definition disabled.
     * Assigned to a category (or no category).
   ~ Categories can be:
      * Added.
      * Updated (including being renamed).
      * Deleted.
o Enable a 'right-click' Glossary administration menu in Glossary ' Alphabetic/Alphanumeric' view (useful for large glossaries).
o Languages: French, English, and German.
o Mod setting to enable/disable mod.
o Mod setting to enable checkbox to enable tooltips for new/updated keywords by default.
o Mod settings to specify width of keyword/keyword definition columns in Glossary list.




Glossary for SMF 2.1
v1.0 - 09-Sep-24
o Hooks Only!!
o SMF 2.1.4 compatibility.
o Tooltips:
  ~ Improved processing of keyword for tooltip to remove 'http(s)://' from keyword to ensure tooltip is displayed correctly.
  ~ Line breaks in definitions displayed correctly without the need to use a custom line break character.
  ~ Option to only display tooltips for keywords that are inside a Glossary BBCode tag (ie, [glossary]Keyword[/glossary]).
  ~ Option to display tooltips in signatures.
  ~ Option to display tooltips in PMs.
  ~ Option to display tooltips in 'News' items.
  ~ Fixed bug where the case of whole/partial words used in definitions that contain keywords was changed to match the keyword case (eg, In the SMF 2.0 version of this mod if there was a 'RAM' keyword and the word 'mainframe' was in a definition it would be displayed as 'mainfRAMe' in a tooltip).
o Membergroup permissions to allow/disallow members to:
  ~ View Glossary tooltips in messages.
  ~ Insert Glossary BBCode in messages.
  ~ Not allow guests to manage/administer the Glossary.
o Glossary List:
  ~ Link to member profile for unapproved keywords (if guests are allowed to make keyword suggestions the word 'Guest' will be shown).
  ~ Mod settings to show keyword author to Glossary admins and/or all members who can view Glossary index.
  ~ Mod setting to only show alphanumeric characters with an associated keyword.
  ~ Mod setting to enable checkbox to approve tooltips for new/updated keywords by default.
  ~ Mod setting for definition column width removed.
  ~ Mod setting for category column width added.
  ~ Keyword synonyms shown below keywords.
     * If the synonyms mod setting is not enabled the word 'Disabled is shown at the top of the list of synonyms.
  ~ Synonym icon and tooltip removed.
  ~ Added 'right-click' context menu for Glossary administration to 'Categories' view.
o Option to make individual keywords case sensitive  Note: this will also make all the synonyms for the keyword case-sensitive.
o Synonyms:
  ~ Keyword checking to ensure keyword is not already in use as a synonym.
  ~ Synonym checking to ensure:
     * Synonym is not already in use as a keyword.
     * Synonym is not already assigned to another keyword.
  ~ Specific error messages for keyword/synonym conflicts.
  ~ Mod setting to display keyword and synonyms below keyword definition in tooltip.
o Improved disabling of mod features (eg, Glossary list [except for Glossary admins], membergroup permissions, BBCode, etc) when mod is not enabled.
o Updated error message reporting to provide SMF 2.1 compatibility.
o Updated jQuery Tooltip and SimpleModal scripts and/or CSS – customised to work with this mod.
o Updated installation process to use mod specific directories/folders for images, languages, CSS files, and scripts.
o Removal of support for SimplePortal mod.
o Removed unused strings from language file.
o Other bug fixes, performance improvements, and tweaks.
o Support for special characters in keywords and synonyms.
o Automatic Glossary integrity checking and alerting for keyword/synonym issues/conflicts.
o Languages: English.



Usage
This mod allows Glossary keywords to be displayed as tooltips (with their definition shown when hovering over/clicking on the keyword) in posts and other message types (ie, News items, PMs, and/or signatures).



Limitations when the use of the Glossary BBCode tag (ie, [glossary]Keyword[/glossary]) is optional
1. Although the use of the Glossary BBCode tag is optional using the mod this way may result in a noticeable increase in the time it takes pages to load when a forum has a combination of a large glossary, a large number of verbose posts on displayed topic pages, and/or is hosted on a low spec server/shared hosting.  The reason for this is that using the mod this way results in the need to check every word in every post (and other messages types) on a displayed page for a possible Glossary keyword match and to create the tooltip if a keyword match is found.

2. If a Glossary keyword/synonym is not marked as case-sensitive and it matches a HTML tag or text in another BBCode tag (eg, 'BR' matches the '<br>' tag, 'RED' matches the '[color=red]' tag) the matching string in the HTML tag/BBCode tag will be displayed as a Glossary keyword/tooltip.

3. The Glossary list is processed in alphanumeric order and, if a keyword has synonyms they are processed before the next keyword, and as a result keywords/synonyms may not always have the expected definition shown in their tooltip.
Scenario A. Keywords/synonyms that contain special characters and which are a substring of another keyword/synonym:
Keyword: Ali'i with definition: Chief or leader
Keyword: Ali'i's Home with definition: In the village ...
If the use of the Glossary BBCode tag is optional the keyword Ali'i's Home will always have the definition of the keyword Ali'i in a tooltip (ie, even if Ali'i's Home is enclosed in the Glossary BBCode tag).

Scenario B: Single/multi word keyword/synonym that is a substring of another single/multi word keyword/synonym:
First example: The keywords 'Submarine' and 'Yellow Submarine' have been added to the Glossary.
If the use of the Glossary BBCode tag is optional the tooltip for the phrase 'Yellow Submarine' will always contain the definition for the 'Submarine' keyword (ie, even if 'Yellow Submarine' is enclosed in the Glossary BBCode tag).
Second example: The keywords 'Big Boat' (with a synonym of 'Yellow'), 'Submarine' and 'Yellow Submarine' have been added to the Glossary.
If the use of the Glossary BBCode tag is optional the tooltip for the phrase 'Yellow Submarine' now will always have TWO tooltips: the definition for the 'Yellow' synonym of the 'Big Boat' keyword AND the definition for the 'Submarine' keyword.



Use of special characters in keywords/synonyms
Most special characters (ie, except for <, >, =, /, \, ", and leading apostrophes) and trailing apostrophes are supported in keywords/synonyms.

'Smart' quotes are not supported in keywords/synonyms and the use of other typographic characters (see Common HTML entities used for typography in keywords/synonyms may cause issues and/or make them difficult to use.



Other limitations/known issues
The use of the http:// or https:// strings is not supported in keywords, synonyms or definitions.



Fonts
The fonts used for displaying Glossary keywords and/or definitions are defined as follows:
 
Font family for displaying definitions shown in tooltips:
.ui-widget in ./Themes/default/css/glossary/glossary.ui.tooltip.css

Font family for displaying keywords/definitions in the Glossary list:
.glossary_keyword_def in ./Themes/default/css/glossary/glossary.css

To change between a serif font and a sans-serif font change the order of the font-family lines and clear the forum cache (you may also need to disable the Administration Center > Features and Options > General > Minimize CSS and JavaScript files option if this is enabled).



Release History:
1.0 : 09-Sep-24
o Initial release.

1.1 : 20-Sep-24
o Bug fix for issue with URLs in BBCode tags.

1.2 : 26-Sep-24
o Added option to exclude messages in specific boards from Glossary use.
   ~ To make it easier to identify board IDs this mod can optionally show them before the board name in the 'Manage Boards and Categories > Modify Boards' list.
o Minor performance/reliability improvements.

1.3 : 28-Sep-24
o Fixed tooltip corruption issue reported by JRMBelgium that occurred in a very specific of circumstances if the 'Show keyword and synonyms below definition in tooltip' option was enabled.
o Minor performance/reliability improvements and layout changes.

1.4 : 24-Oct-24
o Parsing code for processing Glossary keywords in messages completely rewritten by live627 - it's now amazingly fast!
o Added mod setting to give option to convert the line separator character(s) in the description to line breaks when editing the keyword.
o Glossary list:
   ~ Added option to enable tooltips to only be shown when individual keywords (and their synonyms) are inside the Glossary BBCode tag - previously this was only available as a global setting.
   ~ Convert the line separator character(s) in the description to line breaks when displaying keywords if the associated mod setting is enabled.
   ~ Show the total number of keywords and synonyms (plus numbers of keywords/synonyms with non-default settings).
   ~ Show non-default settings for keywords (ie, not approved, not shown as tooltips, case sensitive, and tag only) below settings icons.

1.5 : 16-Nov-24
o Bug fix for issue with synonyms that occurred when adding the very first synonym to a Glossary.



License
Copyright 2024 Kathy Leslie, 2024 John Rayes.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GL700Wing

Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

M45T3R5W4G3R

Great mod with ease of use and practicality on PC. However, I think the tooltips do not work on mobile. Are you planning on updating the mod to accommodate on touch tooltip display on mobile as well?

GL700Wing

#4
Quote from: M45T3R5W4G3R on September 17, 2024, 03:42:30 PMHowever, I think the tooltips do not work on mobile. Are you planning on updating the mod to accommodate on touch tooltip display on mobile as well?
@M45T3R5W4G3R  Working as expected with my iPad on the test2.turtleshellprod.com forum.

From the https://test2.turtleshellprod.com/index.php?topic=40.0 topic
You cannot view this attachment.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

M45T3R5W4G3R

#5
Quote from: GL700Wing on September 17, 2024, 04:29:39 PM
Quote from: M45T3R5W4G3R on September 17, 2024, 03:42:30 PMHowever, I think the tooltips do not work on mobile. Are you planning on updating the mod to accommodate on touch tooltip display on mobile as well?
@M45T3R5W4G3R  Working as expected with my iPad on the hxxp:test2.turtleshellprod.com [nonactive] forum.

From the hxxp:test2.turtleshellprod.com/index.php?topic=40.0 [nonactive] topic
You cannot view this attachment.

Wow, that was fast and yeah, you are right. Your link worked as expected on my mobile phone as well. I uninstalled some of my mods that might have interfered with that on my local server but it wasn't effective. I'll just try a clean installation and then check step-by-step to see where things go wrong. I may not do it quickly as I would be kinda' busy, but would let you know when I test it.

JRMBelgium

#6
This modification completely destroyed url's on my forum. Hours of my time wasted uninstalling mods and backtracking everything I did until I found out this mod was causing the problems. I added the backup of my glossary. I honestly don't see which one impacted the url's.

GL700Wing

#7
Quote from: Jelle Mees on September 19, 2024, 01:52:40 PMThis modification completely destroyed url's on my forum.
Some questions:
1. What is the URL of your forum?;
2. Does the link corruption issue relate to internal URLs (ie, links to your forum), external URLs, or both?;
3. Was the option 'Only show tooltips for keywords inside a Glossary BBCode tag' enabled or disabled?; and
4. Were synonyms enabled or disabled?

QuoteHours of my time wasted uninstalling mods and backtracking everything I did until I found out this mod was causing the problems.
There is a mod setting that gives you the option to enable/disable the Glossary mod globally and the mod can also be enabled/disabled for individual membergroups (useful if you want to only allow some users to use the the Glossary and/or to add/remove/check/test Glossary entries).

Also, if a problem starts on any of my forums soon after I install/update a particular mod the first thing I do is disable/uninstall that mod.

QuoteI added the backup of my glossary. I honestly don't see which one impacted the url's.
I'll look into this problem for you and let you know what I find.

Finally, this mod has already been in use for up to six months on two production forums (one of which has more than 41,000 members and almost 2.7 million posts) without any issues and it's also been extensively tested with a Glossary containing more than 1,200 keyword/definition entries.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Kindred

Also... instead of wasting hours....  next time remember to take a backup of your site before installing ANY mod.

Then you just restore the backup..
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GL700Wing

#9
Version 1.1 : 20-Sep-24
o Bug fix for issue with URLs in BBCode tags.


Thanks to @Jelle Mees for reporting this issue.
Note:  The initial release prevented links in URL tags from working (ie, clicking on the link text did nothing).  Issue did not occur if the option 'Only show tooltips for keywords inside a Glossary BBCode tag' was enabled.

Note: Upgrade option from v1.0 available.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

JRMBelgium

Quote from: Kindred on September 19, 2024, 09:09:51 PMAlso... instead of wasting hours....  next time remember to take a backup of your site before installing ANY mod.

Then you just restore the backup..

I did, but if you have done 10 backups and installed 10 mods after you notice the bug for the first time, it takes a lot of time to downgrade the forum again step by step to find the issue.

M45T3R5W4G3R

Hey, I just tested the glossa
Quote from: M45T3R5W4G3R on September 17, 2024, 04:43:20 PM
Quote from: GL700Wing on September 17, 2024, 04:29:39 PM
Quote from: M45T3R5W4G3R on September 17, 2024, 03:42:30 PMHowever, I think the tooltips do not work on mobile. Are you planning on updating the mod to accommodate on touch tooltip display on mobile as well?
@M45T3R5W4G3R  Working as expected with my iPad on the hxxp:test2.turtleshellprod.com [nonactive] forum.

From the hxxp:test2.turtleshellprod.com/index.php?topic=40.0 [nonactive] topic
You cannot view this attachment.

Wow, that was fast and yeah, you are right. Your link worked as expected on my mobile phone as well. I uninstalled some of my mods that might have interfered with that on my local server but it wasn't effective. I'll just try a clean installation and then check step-by-step to see where things go wrong. I may not do it quickly as I would be kinda' busy, but would let you know when I test it.

Hey, I just checked and I realized that it was a permission issue. As I didn't use SMF for a long while, I didn't think about checking perms before and now I just realized that I was using my Regular User as mobile test account meanwhile using Admin as computer account. For anyone facing the issue, you have to allow users to see tooltips option under Glossary section from user permissions.

JRMBelgium

@GL700Wing I'm still noticing bugs.

I added a "before" and "after" picture as attachment.

This is the original text:

Do you want an admin to join the server and spectate NOW?
Yes! He's currently playing and can be spectated on AMG 1.
What would you like to report?
Aimbot/Wallhack or other cheat
Please provide us with the EA username of the player breaking the rules:
Rattanaboonbaram
Please provide us with your own Origin username or Discord nickname:
Ammo-kech
If possible, please describe what happened. A link to a screenshot or video would also be very useful:
Wallhacks

Diego Andrés

Can you share the bbc you're inputting before posting, and the one that resulted after?

You can use [nobbc][/nobbc] to avoid parsing, or [code][/code] tags.

SMF Tricks - Free & Premium Responsive Themes for SMF.

JRMBelgium

Quote from: Diego Andrés on September 24, 2024, 12:49:49 PMCan you share the bbc you're inputting before posting, and the one that resulted after?

You can use [nobbc][/nobbc] to avoid parsing, or [code][/code] tags.


GL700Wing

#15
Quote from: JRMBelgium on September 24, 2024, 10:09:55 AM@GL700Wing I'm still noticing bugs.

I added a "before" and "after" picture as attachment.
@JRMBelgium This looks to me like it's a mod compatibility issue rather than a bug with this mod - please provide a list of the mods you have installed.

Once I have this information I'll investigate this issue but please be aware that while mod authors are required to ensure their products work correctly and do not cause issues (ie, do not have bugs) with forums that do not any other mods installed they are not required to ensure that their mods will be compatible with other mods (and sometimes it's just not possible or feasible to do so).


Update: I've installed the Custom Form Mod, created a question/answer form the same as the one you used, used the form to submit exactly the same answers you have shown and used your Glossary (as provided here).  As you can see from the following image the Glossary mod is working on my test forum as expected/required.
You cannot view this attachment.

To guarantee compatibility with other mods you could enable the Only show tooltips for keywords inside a Glossary BBCode tag option and require forum users to use the mod's BBCode for Glossary items.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Kindred

GL700wing....   both the glossary abd custom forms mods are installed on the turtleshellprod and 40konline sites

I have seen no issues like this either
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

JRMBelgium

Quote from: GL700Wing on September 24, 2024, 05:04:05 PM
Quote from: JRMBelgium on September 24, 2024, 10:09:55 AM@GL700Wing I'm still noticing bugs.

I added a "before" and "after" picture as attachment.
@JRMBelgium This looks to me like it's a mod compatibility issue rather than a bug with this mod - please provide a list of the mods you have installed.

Once I have this information I'll investigate this issue but please be aware that while mod authors are required to ensure their products work correctly and do not cause issues (ie, do not have bugs) with forums that do not any other mods installed they are not required to ensure that their mods will be compatible with other mods (and sometimes it's just not possible or feasible to do so).


Update: I've installed the Custom Form Mod, created a question/answer form the same as the one you used, used the form to submit exactly the same answers you have shown and used your Glossary (as provided here).  As you can see from the following image the Glossary mod is working as expected/required.
You cannot view this attachment.

To guarantee compatibility with other mods you could enable the Only show tooltips for keywords inside a Glossary BBCode tag option and require forum users to use the mod's BBCode for Glossary items.

Then I'm sorry for waisting your time on debugging. Based on the amount of mods I have, it's going to be very difficult which mod is in conflict with yours I think.


GL700Wing

#18
Quote from: JRMBelgium on September 25, 2024, 02:45:48 PMThen I'm sorry for waisting your time on debugging.
I'm always willing to work on resolving mod conflicts when/where I can but unfortunately, and especially if it's a JavaScript issue, it's not always something I can do.

That said, I'm working on an update to this mod that will enable messages in specific boards to be excluded from Glossary use and if you have the 'Custom Form Mod' output sent to specific boards and use this new feature to exclude those boards from Glossary use it may resolve the issue you're encountering.

QuoteBased on the amount of mods I have, it's going to be very difficult which mod is in conflict with yours I think.
It's interesting that the same version of 'Custom Form Mod' is shown as being installed twice on your forum - it's not normally possible to install the same mod more than once ...
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

GL700Wing

Version 1.2 : 26-Sep-24
o Added option to exclude messages in specific boards from Glossary use.
  ~ To make it easier to identify board IDs this mod can optionally show them before the board name in the 'Manage Boards and Categories > Modify Boards' list.
o Minor performance/reliability improvements.


Note: Mod update option available for previous versions.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: