User:3ShadowFox3/Conversation

Fox
Hello, I'm one of the admins over at the 7DaysToDie Wiki, and our curse employee ported over the crafting table templates from the minecraft wiki over to our wiki, as the crafting table in the game 7 Days to Die is very similar to the minecraft crafting table. I seen that your on-site crafting table can loops different item thumbnails like on the wood planks page. I was wondering if you could help us maybe have that same feature over at our wiki. Thanks!

Ultradude25
Hi

The way animations are done are rather crappy and over-complicated on the code side, as MediaWiki templates are simply too slow to handle the amount of grids we needed on a page, so the animated images are loaded in through JavaScript. It's made further complicated by a bug in the version of MediaWiki we are on that prevents redirects from working (we heavily use file redirects because our file database is tied to two other wikis, so changing any files will break them), so redirects have to be done separately from retrieving the file URLs.

When Curse updates all the wikis to 1.21 (planned to happen before the end of the year) we'll have Lua, which will highly simplify how the animations work, only requiring a few lines of JavaScript to flick through each image. However, if you don't want to wait until then I've copied out the necessary JavaScript without any things that are specific to our wiki, although it's never been tested on other wikis. You'll need to set the baseURL and the wikiURL to match your wiki (both appear to be "/").

That JavaScript is not tied down to the grid template, it just has some special support for it (mods and numbers), so by using the animate template (or manually writing the correct HTML) you can animate any set of images (as you may have seen in some of our infoboxes).

Fox
Alright thanks. I don't think we could part from using redirects. So we'll just wait for the update. Ill be sure to shoot you a email for help when mediawiki 1.21 comes out. Thanks for the help.

Ultradude25
You don't need to part from file redirects. I was just mentioning that the MediaWiki bug makes the script further complicated to support them. If it didn't support file redirects, it'd be completely useless to us, as we have to use them for many files.

Fox
Oh my bad. Ill look into the links you sent earlier. One more question. I'm not sure you took a look at out crafting table, but it's not exactly like the minecraft one. Where as ours is a 5 by 5 crafting grid. Would the contents of the link still work with our current set up? Or would we have to modify it to work with our site?

Ultradude25
Each square is a "grid". The crafting table template is merely creating a layout of multiple "grids", which are each independent of each other. If the script works with a single grid, it should work with any amount of grids. In fact, aside from a few special features that the grid needs, the script doesn't even care that it is a grid. It's just a list of image names as far as it's concerned. You could throw some images in to the crafting table using the animate template and they'd all keep in sync with the images in each grid.

The only thing that takes into account sets of grids like the crafting table is a separate script (not included in that link), which pauses the animation of all the grids in that set when the mouse hovers over it (gives people chance to read the recipe or click on something). Even that doesn't care about the amount or layout of the grids, it just pauses any grids that are under a specific class (for example the crafting table is "grid-Crafting Table").