Forum:Inlcuding canvas with javascript on a template page

I try to summarize the project first: I want to create a template which shows specific damage data on a canvas. This template should included on weapon pages like: w:c:battlefieldheroes:Maimer's_Machete

Other gaming wikis solved the issue by uploading stats images (http://battlefield.wikia.com/wiki/File:AN-94Stats.png), but those can't be edited by other contributors.

Working with css gradients will be impossible, cause there's too much caption and overlapping. My approach uses canvas:

Template page includes:

CanvasMediaWikiPage

Canvas can't be inserted directly on the template page, so it requires this workaround >.>

MediaWiki:CanvasMediaWikiPage includes:

 Your browser doesn't support canvas.

But the canvas itself is defined via Javascript:

Setting up the proper canvas commands won't an obstacle, but:

Problem: I'd have to set up 20+ canvas items for different stats only. Is it possible to define the stats on template page and make an unversal canvas javascript that loads those stats afterwards?

This way the stats can be edited and adapted easily in the future without cluttering the Mediawiki:Common.js BFH-Wiki 15:41, November 14, 2011 (UTC)


 * Using functions like  and properties like , you can put any number of values or properties into the template and pull them up with JS. Template code is evaluated by the server, so you don't need to worry about load order problems or any of that.


 * My biggest worry about the load order seems to be solved then! Will give that a try and confirm if successful. Great thanks, BFH-Wiki 16:38, November 14, 2011 (UTC)