为MediaWiki创建自定义编辑按钮 [英] Creating custom edit buttons for MediaWiki

查看:115
本文介绍了为MediaWiki创建自定义编辑按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在尝试构建一个在编辑页面时需要AJAX调用的mediawiki扩展。我只需要在编辑页面上添加一个新的编辑按钮,它会显示一个javascript弹出编辑器,该编辑器会进行相应的调用。

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.

我需要知道Mediawiki是否可行,将javascrpt代码注入编辑按钮。

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!

推荐答案

很明显,这个问题非常具体,没有人愿意回答。所以,如果其他人想知道如何在Mediawiki中添加自定义编辑按钮,我就是这样做的。

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

我找到了 Mediawiki帮助页面,要求用户编辑位于 http://的特定javascript页面(wiki- site-url)/Mediawiki:Comomn.js
仔细观察,这不是一个实际的js页面,而是一个普通的wikipage(存储在数据库中的wikitext),它在运行时由mediawiki加载。网站管理员可以通过添加

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"}
}

对于单个用户,也可以通过在用户自己的 http://上提供的js文件副本上应用相同的编辑来实现这一点。 (wiki-site-url / User:(Your_username)/(skinname).js

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

如果他们不这样做,那么两个js页面都可以创建已存在。

Both the js pages could be created if they dont already exist.

这篇关于为MediaWiki创建自定义编辑按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆