How to add an onload script for MediaWiki

淺唱寂寞╮ 提交于 2019-12-13 04:15:12

问题


I installed a mediawiki and my version is 1.21.1, now I want to add some code when the page is onload using javascript. I have searched on the Internet and found we can put our scripts on the Common.js file, but I don't found Common.js in my wiki project. I have searched the whole directory and still did not find it.

Anyone could tell me how to achieve my goal?


回答1:


brightbyte's answer, which worked: Enter MediaWiki:Common.js into the search box of your wiki. It will tell you the page doesn't exist - just create it. Any JS code you put in there will be executed on every page load. Of course, you have to be an administrator to create or edit that page.

This is documented at Manual:Interface/JavaScript; there are similar customisations at Manual:User group CSS and Javascript and Manual:Page customizations.



来源:https://stackoverflow.com/questions/22526486/how-to-add-an-onload-script-for-mediawiki

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