Users of vbulletin based forums can integrate the pgn4web chessboard in their posts using a custom bbcode for PGN games, like this:
[pgn] ... PGN data ... [/pgn]
The integration code has been validated with the vbulletin demo facility.
Look at the users sites gallery for examples.
The forum administrator should create a new BBcode with BBcode tag name
as pgn
The reccomended value for the HTML replacement
string is:
<script type='text/javascript'>
"use strict";
var pgn4webPath = "/pgn4web";
var pgn4webTextareaIdNum;
if (pgn4webTextareaIdNum === undefined) { pgn4webTextareaIdNum = 1; }
var pgn4webTextareaId = "pgn4web_" + pgn4webTextareaIdNum++;
document.write("<textarea id='" + pgn4webTextareaId +"' style='display: none;'>");
</script>
{param}
</textarea>
<script type='text/javascript'>
"use strict";
document.getElementById(pgn4webTextareaId).value = document.getElementById(pgn4webTextareaId).value.replace(/<.*?>/g, ' ').replace(/\[(FONT[^\]]*|[^\]]*FONT)\]/gi, ' ');
var height = 268;
var multiGamesRegexp = /\s*\[\s*\w+\s*"[^"]*"\s*\]\s*[^\s\[\]]+[\s\S]*\[\s*\w+\s*"[^"]*"\s*\]\s*/m;
if (multiGamesRegexp.test(document.getElementById(pgn4webTextareaId).value)) { height += 34; }
document.write("<iframe src='" + pgn4webPath + "/board.html?am=l&d=3000&ss=26&ps=d&pf=d&lcs=____&dcs=RsCo&bbcs=RsCo&hm=b&hcs=FpBE&bd=c&cbcs=YKqR&ctcs=BoBo&hd=j&md=f&tm=13&fhcs=$$$$&fhs=14&fmcs=$$$$&fccs=v71$&hmcs=VtCE&fms=14&fcs=m&cd=i&bcs=____&fp=13&hl=t&fh=b&fw=p&pi=" + pgn4webTextareaId + "' frameborder=0 width=100% height=" + height + " scrolling='no' marginheight='0' marginwidth='0'>your web browser and/or your host do not support iframes as required to display the chessboard</iframe>");
</script>
Please remember to set the variable pgn4webPath
above to the path of the pgn4web folder on your site.
Please note these settings apply a predefined set of colors and options to match the default vbulletin template; if you need to change any of the colors and options (the parameters after board.html in the code above) you can refer to the board widget instructions wiki page or ask for support.
It is recommended to switch on the following options for the pgn
BBcode tag: Remove Tag If Empty
, Disable BB Code Within This BB Code
and Disable Smilies Within This BB Code
.
The icon below can be used as button image:
The instructions above require pgn4web 1.91 or later and requires that vbulletin and pgn4web are on the same domain.
In case you need to install vbulletin and pgn4web on different domains, please use the following alternative value for the HTML replacement string. Please note that this alternative solution limits the size of the PGN data to approximately 2000 characters:
<script type="text/javascript">
"use strict";
var pgn4webURL = "http://pgn4web.casaschi.net";
if (!document.getElementById("pgn4webEncoderScript")) { document.write('<script id="pgn4webEncoderScript" type="text/javascript" src="' + pgn4webURL + '/pgn-encoder.js"><!--' + 'script-->'); }
</script>
<script type='text/javascript'>
"use strict";
var pgn4webTextareaIdNum;
if (pgn4webTextareaIdNum === undefined) { pgn4webTextareaIdNum = 1; }
var pgn4webTextareaId = "pgn4web_" + pgn4webTextareaIdNum++;
document.write("<textarea id='" + pgn4webTextareaId +"' style='display: none;'>");
</script>
{param}
</textarea>
<script type='text/javascript'>
"use strict";
var pgnText = document.getElementById(pgn4webTextareaId).value.replace(/<.*?>/g, ' ');
pgnText = pgnText.replace(/\[(FONT[^\]]*|[^\]]*FONT)\]/gi, ' ');
var height = 268;
var multiGamesRegexp = /\s*\[\s*\w+\s*"[^"]*"\s*\]\s*[^\s\[\]]+[\s\S]*\[\s*\w+\s*"[^"]*"\s*\]\s*/m;
if (multiGamesRegexp.test(pgnText)) { height += 34; }
document.write("<iframe src='" + pgn4webURL + "/board.html?am=l&d=3000&ss=26&ps=d&pf=d&lcs=____&dcs=RsCo&bbcs=RsCo&hm=b&hcs=FpBE&bd=c&cbcs=YKqR&ctcs=BoBo&hd=j&md=f&tm=13&fhcs=$$$$&fhs=14&fmcs=$$$$&fccs=v71$&hmcs=VtCE&fms=14&fcs=m&cd=i&bcs=____&fp=13&hl=t&fh=b&fw=p&pe=" + EncodePGN(pgnText) + "' frameborder=0 width=100% height=" + height + " scrolling='no' marginheight='0' marginwidth='0'>your web browser and/or your host do not support iframes as required to display the chessboard</iframe>");
</script>
Please remember to set the variable pgn4webURL
above to the URL of the pgn4web server you plan to use.
<
and >
characters; please make sure your PGN data does not contain <
and >
characters. [pgn]
bbcode. After editing an existing post containing a [pgn]
tag, when using the save
command, vbulletin displays a blank page while endlessly trying to load the next page. Please note that the modifications to the post are actually saved, just the transition to the next vbulletin page fails. Settings -> Options -> General Settings -> Disable AJAX Features
and change the item Disable AJAX Features
from the default Enable ALL AJAX Features
to Disable Problematic AJAX Features
, or go advanced
command instead of the save
command when editing a post, or With minor modifications to the integration guidelines described above other bbcode tags can be created for specialized applications, for instance taking advantage of the board widget puzzle support.
Wiki: BoardWidget_instructions
Wiki: BoardWidget_puzzle
Wiki: Contribute
Wiki: Index
Wiki: User_Notes_Web_Platforms
Wiki: User_Sites
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: pa...@casaschi.net
how to stop the games from autoplaying
Some forum administrators prefer the chessboard to load without automatically starting autoplaying the games. In order to achieve that, simply replace in the bbcode definition am=l with am=n
View and moderate all "wiki Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Wiki"
Originally posted by: pa...@casaschi.net
the puzzle tag
The pgn tag can be easily modified into a tag optimized for puzzles, hiding the move text until the user clicks on the prompt in order to show the puzzle solution. In order to achieve that, simply replace in the bbcode definition am=l with am=n, hd=j with hd=v and md=f with md=p.
Last edit: Anonymous 2017-08-28