如何为MediaWiki添加onload脚本 [英] How to add an onload script for MediaWiki

查看:104
本文介绍了如何为MediaWiki添加onload脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了的问题,而我的版本是 1.21.1 ,现在我想使用.我在Internet上进行了搜索,发现可以将脚本放在 Common.js 文件中,但是在我的Wiki项目中找不到 Common.js .我已经搜索了整个目录,但仍然没有找到它.

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?

推荐答案

brightbyte的答案有效:在Wiki的搜索框中输入MediaWiki:Common.js.它会告诉您该页面不存在-只需创建它即可.您放入其中的任何JS代码都会在每次页面加载时执行.当然,您必须是管理员才能创建或编辑该页面.

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.

此文档记录在 Manual:Interface/JavaScript 上;在手册:用户组CSS和Javascript 手册:页面自定义.

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

这篇关于如何为MediaWiki添加onload脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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