Frug / AJAX-Chat

A fully customizable web chat implemented in JavaScript, PHP and MySQL which integrates nicely with common forum systems like phpBB, MyBB, FluxBB, SMF and vBulletin. A Flash and Ruby based socket connection can be used to boost performance.
http://frug.github.io/AJAX-Chat/
546 stars 301 forks source link

Add strikethrough #250

Open Tymewalk opened 7 years ago

Tymewalk commented 7 years ago

Many forums support strikethrough, yet AJAX chat does not.

[s]Example[/s]

Appears as Example

From my view it should be simple, do the same thing with [b], [i], and [u], but with <s></s> instead.

phillipkirk commented 10 months ago

Method

Giving AJAX-Chat the ability to parse the BBCode

This can be done by looking for the following code in config.js (chat/js/config.js);

// Defines the list of allowed BBCodes:
bbCodeTags:[
    'b',
    'i',
    'u',
    'quote',
    'code',
    'color',
    'url',
    'img'
],

and amend to the following;

// Defines the list of allowed BBCodes:
bbCodeTags:[
    'b',
    'i',
    'u',
    's',
    'quote',
    'code',
    'color',
    'url',
    'img'
],

Adding a button to the BBCode toolbar

Adding a button is takes a bit more, in loggedIn.html (chat/lib/template/loggedIn.html) find the block towards the bottom with id's like bbCodeBold and bbCodeItalic and add this line of code where you want the button;

<input id="bbCodeStrikethrough" type="button" value="[LANG]bbCodeLabelStrikethrough[/LANG]" title="[LANG]bbCodeTitleStrikethrough[/LANG]" onclick="ajaxChat.insertBBCode('s');" style="text-decoration:line-through;"/>

Then edit every PHP file in chat\lib\lang to add (with the appropriate translations, here written for en.php);

$lang['bbCodeLabelStrikethrough'] = 's';
$lang['bbCodeTitleStrikethrough'] = 'Strikethrough text: [s]text[/s]';

Screenshots