Creating custom edit buttons for MediaWiki
Hi im trying to build a mediawiki extension which requires AJAX calls during editing a page. All I need is to add a new edit button on the edit page which displays a javascri开发者_开发百科pt popup editor which in turn makes the appropriate calls.
I need to know if it is feasible in Mediawiki, to inject javascrpt code into edit buttons.
Any kind of information or leads are welcome!
Ok clearly the question is very specific, tht no one cared to answer. so if some one else wants to know how to add custom edit buttons in Mediawiki, this is how I did it
I found a Mediawiki help page which asks the user to edit a particular javascript page located at http://(wiki-site-url)/Mediawiki:Comomn.js
.
On closer inspection this is not an actual js page but a normal wikipage(stored in the database as wikitext) which is loaded by mediawiki during runtime. The site admin can edit this page by adding
if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
"imageFile": "<path-to-image-on-the-server>",
"speedTip": "Comment visible only for editors",
"tagOpen": "open tag",
"tagClose": "closing tag",
"sampleText": "Insert comment here"}
}
This can also be achieved for a single user by applying the same edit on the users own copy of the js file available at http://(wiki-site-url/User:(Your_username)/(skinname).js
Both the js pages could be created if they dont already exist.
The wiki way is to put an HTML button into a Widget and put your JavaScript there, or better yet in its own Gadget
精彩评论