Creating custom edit buttons for MediaWiki

自作多情 提交于 2019-12-04 17:55:25

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.

Qermit

The wiki way is to put an HTML button into a Widget and put your JavaScript there, or better yet in its own Gadget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!