问题
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
In the simple install section, I need to add extra code in monobook.js.
However, I cannot find monobook.js in my wiki folder. Can anyone give me some direction?
回答1:
The "simple install" you linked to is for Wikipedia users who want to enable the gadget from their personal script file.
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:
- 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 useUser: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.
Even better: Install the Gadgets extension and migrate the script to a gadget, which users can easily enable in the settings.
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.
See also Manual:Interface/JavaScript; there are similar customisations at Manual:User group CSS and Javascript and Manual:Page customizations.
回答2:
The page you linked to talks about a user's monobook.js, which is a page called User:UserName/monobook.js
.
If you want to do the same for all users on your wiki, you can use the site-wide monbook.js, which is not a file, but a page called MediaWiki:monobook.js
.
Keep in mind that those scripts only apply if you're using the Monobook skin. If you want to have some script for all skins, use User:UserName/common.js
or MediaWiki:common.js
.
来源:https://stackoverflow.com/questions/13613379/where-is-monobook-js-stored-in-mediawiki