Create A Forum - Support Forums

Support => General Support => Topic started by: HGMuller on February 13, 2018, 10:28:00 am

Title: Adding JavaScript-powered features to forum posts
Post by: HGMuller on February 13, 2018, 10:28:00 am
For the chessvariants forum I would like to add a feature to make it possible to include chess diagrams in forum postings, e.g. through a description of the board position between [diag][/diag] tags. The existing feature for uploading images is not satisfactory for this, as a typical diagram measures about 100KB as an image, and fills up the avalable quota very fast. When embedded in the text of the posting it would only add some 100-200 bytes.

The way I imagined doing this was by providing a JavaScript file that would be executed in the browser client after loading a page with forum posts, which would examine the content of all HTML elements with class="post" for the occurrence of these custom tags, and then replace them by the HTML code to display a chess board as a table of piece images according to the description. I already have such a script that assumes the diagrams are indicated by a HTML tag of a certain class, rather than by a BBcode, but it would only require a very small modification to make it act on the latter.

So my actual questions are:

Title: Re: Adding JavaScript-powered features to forum posts
Post by: CreateAForum on February 13, 2018, 02:14:51 pm
1. You can add javascript via admin -> style manager -> headers and footers

For #2 and #3 if you send me the files I can upload them after review