Jump to content

User:Luasóg bot

From Wikipedia, the free encyclopedia

About Luasóg

[edit]

Luasóg consists of two project streams:

You can use Luasóg immediately on Wikipedia by importing this page in to your vector.js or your monobook.js page (non-Internet Explorer browsers only, see example below). To use the Luasóg framework to access the Wikipedia API off-site, download the desktop IDE from the project page on SourceForge.net.

Luasóg is only in version 0.3 but already has a robust set of wrapper functions for common API calls. For example, using Luasóg you can read a page or category, log in and edit. All calls the WikiMedia API can be access using the request method. The full Luasóg API is documented here.

Example script

[edit]

If you use a browser other that Internet Explorer, the Luasóg framework can be used directly on Wikipedia to easily script otherwise impossible things. For example, the following script will add an edit counter to the My Contributions link at the top of the page.

If you use the new theme, Vector, add the following code to your vector.js page. If you use the old theme, Monobook, add it to your monobook.js page. After adding the code, follow the instructions on that page about how to refresh your browser to see the results.

// include the Luasóg framework
importScript('User:Luasóg bot/framework.js');

// wait for the page to load
window.onload = function(){
	// instantiate an instance of Luasog pointing at the en.wiki API
	var luasog = new Luasog("http://en.wikipedia.org/w/api.php");

	// set up the callback function
	var callback = function(data){
		// add the number of edits for this user to the inner HTML of the contributions link
		document.getElementById("pt-mycontris").innerHTML =
		document.getElementById("pt-mycontris").innerHTML.replace
		("</a>", " ("+data.query.userinfo.editcount+")</a>");
	};

	// request the edit count for this use and call callback when done
	luasog.request({action:"query", meta:"userinfo",uiprop:"editcount"}, callback);
};

Version 0.3 released

[edit]
Luasóg is released under the GNU GPL v.3.
Luasóg is released under the GNU GPL v.3.

Version 0.3 of Luasóg was released on the 24th of March 2010. This should still be considered a development release but is expected to be stable enough for most purposes. All known issues from the previous release have been addressed.

The most important changes since 0.2 is that the IDE is no longer web-based. The web-based IDE dropped from project and the desktop IDE based wholly on local files. Some new methods were added to the frame work (dealign with namespaces and categories).