Creating custom edit buttons for MediaWiki

谁都会走 提交于 2020-01-01 17:30:07

问题


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 javascript 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!


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/3079390/creating-custom-edit-buttons-for-mediawiki

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