Author Topic: Adding JavaScript-powered features to forum posts  (Read 103 times)

0 Members and 0 Guests are viewing this topic.

Offline HGMuller

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
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?

Share on Facebook Share on Twitter


Offline CreateAForum

  • Administrator
  • *****
  • Posts: 5813
  • Karma: 279
    • View Profile
Re: Adding JavaScript-powered features to forum posts
« Reply #1 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
Like Create A Forum? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
1 Replies
226 Views
Last post June 17, 2012, 04:52:18 pm
by Andrew
1 Replies
173 Views
Last post March 12, 2013, 06:22:20 pm
by aIURbliS
11 Replies
1888 Views
Last post April 07, 2013, 01:54:18 am
by aIURbliS
3 Replies
2365 Views
Last post December 31, 2014, 05:22:13 am
by aIURbliS
0 Replies
179 Views
Last post April 06, 2015, 04:02:31 pm
by discjocke09