Extension:Livelets

The idea of this extension is to delay the loading of slower portions of a page, while the rest of the page loads quickly and is displayed as soon as possible, using a simple template-syntax. The complex content in them to be turned into a separate request using MediaWiki's ajax functionality. You can have multiple livelets loading in sequence.

Later we'll be adding the ability to make these areas "live" whereby the content in them will stay up to date automatically without the whole page having to be reloaded.

Some of our sites use a livelet in the sidebar to load the main tree which can be very large for some users and would cause the site to be sluggish if it had to load the whole tree for each new page request.

Having the large content in a livelet speeds up the site in two ways:
 * 1) The large content only starts loading after the main page is loaded and accessible.
 * 2) Because the large content is a separate request with its own static URL, it can be cached locally by the browser.

Installation
Create a Livelets folder in your extensions directory. Download the latest snapshot and extract it to your extensions directory. Then include it in your LocalSettings.php file as in the following example.

Most people like to have an animated ajax loader image such as these ones from the Wikimedia commons. The livelet containers render with a div element inside them with an class value of livelet-loader so that you can add some CSS rules such as the following example which renders a small box containing a rotating daisy. You can add this CSS to your MediaWiki:Common.css article.

Usage
To create livelets, simple wrap any areas of wikitext in the #live parser-function. In the following example, a transclusion of the page called Template:MyVerySlowTable has been turned into a livelet:

Current State
Currently the livelet loads once using Ajax after the page content has loaded and then acts as a normal static Mediawiki page.

The default installation of Livelets uses Ajax technology, which is used by many extensions and by the MediaWiki code itself and is considered safe.

Future Development - Live Updates Using SWF
With Ajax, changes do not propagate automatically from the server to the client: the client must poll the server at a regular interval to see if any changes have taken place.

Hence, it is intended that an option be made available to enable live updates using SWF.

The advantage of using SWF technology is that it allows a fully asynchronous connection to be established between the server and the clients making the system fully event driven without any regular polling involved.

This SWF method raises some security concerns as outlined by the XSS alert template above.

Livelets will not have this feature enabled by default. An additional variable will need to be set in LocalSettings.

The SWF functionality is not complete enough for use yet, but will require the following additional files to be installed into the livelet extension directory:
 * livelets.pl
 * livelets.swf - compiled from livelets.as using the Flashlets extension

Todo

 * ajax polling of header for auto-updating
 * perl/swf for asynchronous update (no polling)

Change log

 * Version 1.0.2: Total rewrite to make current as of MediaWiki version 1.16
 * Version 0.2.6: Missing pagename parameter in AJAX request
 * Version 0.2.5: Removed dependence on Mootools and no longer requires a separate javascript file