News:

Create A Forum Installed

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - HGMuller

Pages: [1]
1
General Support / Adding JavaScript-powered features to forum posts
« 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:

  • How can I cause a given <script> tag that would invoke the required script to appear on every page that displays forum postings?
  • It it possible to place the .js file with that script on this server, and how would I know what URL to use i order to link to it?
  • Would it be possible to place a set of (tiny, say 33x33 pixel) images of chess pieces on the server from which the board would be composed?

Pages: [1]