monobook.js在MediaWiki中存储在哪里? [英] Where is monobook.js stored in MediaWiki?

查看:98
本文介绍了monobook.js在MediaWiki中存储在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的Wiki编辑器页面添加额外的按钮,然后我发现了该页面:

I am trying to add extra buttons for my wiki editor page and I came across to this page:

http://en.wikipedia.org/wiki/User:MarkS/Extra_edit_buttons#Simple_Install

在简单安装"部分,我需要在monobook.js中添加额外的代码.

In the simple install section, I need to add extra code in monobook.js.

但是,我在Wiki文件夹中找不到monobook.js.谁能给我一些指导?

However, I cannot find monobook.js in my wiki folder. Can anyone give me some direction?

推荐答案

您链接的简单安装"适用于希望从

The "simple install" you linked to is for Wikipedia users who want to enable the gadget from their personal script file.

正确的主题应该是#在您自己的Wiki上安装XEB ,但是我并不完全同意(例如,不推荐使用importScript).您可以选择的替代方法是:

The correct topic would be #Installing XEB on your own Wiki, however I don't fully agree with that (importScript is deprecated, for example). Your alternatives are:

  • 让您的用户只需从//en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js&action=raw&ctype=text/javascript导入脚本.这可能会导致XSS风险,但是导入的用户脚本总是如此.奖励:总是会获得最新版本.
  • 将脚本,css和图像复制到您的域中-这意味着您将负责维护它们.您可以将它们定位在服务器文件系统中的任何位置,MediaWiki:名称空间的Wiki页面上(仅管理员可以编辑)或以.js结尾的用户子页面上(仅该用户和管理员可以编辑).在帮助文件中推荐了最后一个,但是我建议不要使用User:MarkS.确保您不信任的人都无法登录该帐户.

  • let your users just import the script from //en.wikipedia.org/w/index.php?title=User:MarkS/extraeditbuttons.js&action=raw&ctype=text/javascript. That's a possible XSS risk, but imported userscripts always are. Bonus: The will always get the latest version.
  • copy the script, the css and the images to your domain - which means you are in charge to maintain them. You could locate them anywhere in your server's file system, on a wiki page in the MediaWiki: namespace (only admins can edit) or on a user subpage that ends in .js (only that user and admins can edit). The last one was recommended in the help file, but I suggest not to use User:MarkS for that. Ensure nobody whom you don't trust could log into that account.

然后将该位置提升给您的用户,以便他们可以从那里导入脚本.

Then promote that location to your users, so they can import the script from there.

更好:安装Gadgets扩展并将脚本迁移到小工具,用户可以在设置中轻松启用该小工具.

Even better: Install the Gadgets extension and migrate the script to a gadget, which users can easily enable in the settings.

注意该脚本已被弃用,并且可能不适用于当前的MediaWiki版本.它在很大程度上取决于脚本的加载顺序,需要一些技巧才能与ResourceLoader很好地集成.

Notice the script is deprecated and might not work with current MediaWiki versions. It depends heavily on script loading order, which needs some hacks to integrate well with the ResourceLoader.

另请参见 Manual:Interface/JavaScript ;在手册:用户组CSS和Javascript 手册:页面自定义.

这篇关于monobook.js在MediaWiki中存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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