Where is monobook.js stored in MediaWiki?

前端 未结 2 693
再見小時候
再見小時候 2020-12-06 23:30

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

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 00:09

    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 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.

    • 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.

提交回复
热议问题