About
Despite the name, GW2BBCode is not real BBCode: it does not integrate with any bulletin board systems (forums).
Instead, GW2BBCode is a stand-alone (it can work with any site), JavaScript-based plug-in: all
you need to do in order to enable GW2BBCode for your site is include some additional files and do
some very simple configuration. More on that in the installation
section.
There is one caveat: GW2BBCode is a MooTools
plug-in. If your site is already using a different JavaScript library, this may cause
trouble – and even if it doesn't, including two “general purpose” libraries is generally not a great
idea, for various reasons. However, that's just the way it is – the author of GW2BBCode loves
MooTools, so when he does hobby projects he uses MooTools. Perhaps he will port GW2BBCode to vanilla
JavaScript one day, if and when he feels like it.
Usage
#{skill name}
GW2BBCode will find text that looks like this and replace it with the appropriate skill icon. That is
all.
Skill names are case-insensitive, and skill names can have aliases (time will tell which aliases are
desirable; there are none in the system right now). If a skill name doesn't exist in the datastore,
GW2BBCode will simply leave the code untouched.
Builds and other features aren't supported right now, for obvious reasons. Support for whatever
features make sense will be added after Guild Wars 2's launch.
Technical note: the template for GW2BBCode, as a regular expression, is /#\{(.*?)\}/g
.
You can customise this through the constructor's options object if you want or
need to.
Installation
- Include the files found in the download in your page(s). The file
GW2BBCode.tools.js
is optional; it provides some additional utilities for
developers. More on that in the documentation. Note that when it comes to
MooTools and MooTools More, you can use any version you want equal to or greater than 1.4.0. The
files in the download are just for convenience. MooTools should be included first, followed by
mootools-extensions.js
, Tooltip.js
, GW2BBCode.js
,
GW2BBCode.skills.js
and finally GW2BBCode.tools.js
if you need it.
- Initialize GW2BBCode; simplest case:
new GW2BBCode(document.body)
. The constructor
takes two arguments: containers, an element (or elements collection or string selector)
and options, an options object. Containers is where GW2BBCode looks for the
BBCode, and should resolve to a collection of elements as specific as possible in order to
prevent issues with other scripts you may have running (and also for general performance). See
the documentation for details.
Docs
The GW2BBCode documentation is coming soon!
Stats
Please enable JavaScript in your browser in order to be able to see the GW2BBCode stats.
To-do
- Add the remaining skills, naturally (and keep it all updated).
- Make sure the tooltip never displays outside of the viewport.
- Clean out unnecessary MooTools extensions and make a list of which MooTools More modules are
required.
- Maybe also support items in addition to skills… that's a lot of work,
especially to keep updated, so help will definitely be needed with that.