LLWiki正在建设中,欢迎加入我们

“MediaWiki:Mobile.js”的版本间差异

来自LLWiki
跳转到导航 跳转到搜索
第5行: 第5行:
Just replace span text and href to add links */
Just replace span text and href to add links */


/* 在匿名函数内定义变量 */
var recentchanges = '最近更改', sandbox = '沙盒', villagepump = '互助客栈', policy = '方针', help = '帮助';
(function() {
switch(mw.config.get('wgUserLanguage')) {
var recentchanges = '最近更改', sandbox = '沙盒', villagepump = '互助客栈', policy = '方针', help = '帮助';
case 'zh-hant':
switch(mw.config.get('wgUserLanguage')) {
case 'zh-hk':
case 'zh-mo':
case 'zh-hant':
case 'zh-tw':
case 'zh-hk':
case 'zh-mo':
recentchanges = '近期變更';
case 'zh-tw':
villagepump = '互助客棧';
policy = '方針';
recentchanges = '近期變更';
help = '助';
villagepump = '客棧';
policy = '方針';
break;
help = '幫助';
}
break;
var timer = setInterval(function() {
if ($('.menu ul:first').length) {
console.log("mobile menu exists");
clearInterval(timer);
$('.menu ul:first').append('<li><a href="/zh/special:recentchanges" class="mw-ui-icon mw-ui-icon-before"><span>' + recentchanges + '</span></a></li><li><a href="/zh/project:沙盒" class="mw-ui-icon mw-ui-icon-before"><span>' + sandbox + '</span></a></li><li><a href="/zh/project:互助客栈" class="mw-ui-icon mw-ui-icon-before"><span>' + villagepump + '</span></a></li><li><a href="/zh/project:方针" class="mw-ui-icon mw-ui-icon-before"><span>' + policy + '</span></a></li><li><a href="/zh/help:帮助总览" class="mw-ui-icon mw-ui-icon-before"><span>' + help + '</span></a></li>');
}
}
}, 100); // check every 100ms
var timer = setInterval(function() {
if ($('.menu ul:first').length) {
console.log("mobile menu exists");
clearInterval(timer);
$('.menu ul:first').append('<li><a href="/zh/special:recentchanges" class="mw-ui-icon mw-ui-icon-before"><span>' + recentchanges + '</span></a></li><li><a href="/zh/project:沙盒" class="mw-ui-icon mw-ui-icon-before"><span>' + sandbox + '</span></a></li><li><a href="/zh/project:互助客栈" class="mw-ui-icon mw-ui-icon-before"><span>' + villagepump + '</span></a></li><li><a href="/zh/project:方针" class="mw-ui-icon mw-ui-icon-before"><span>' + policy + '</span></a></li><li><a href="/zh/help:帮助总览" class="mw-ui-icon mw-ui-icon-before"><span>' + help + '</span></a></li>');
}
}, 100); // check every 100ms
})();

2020年8月6日 (四) 12:24的版本

/* 这里的任何JavaScript将为使用移动版网站的用户加载 */

/* Add to MediaWiki:Mobile.js for custom Mobile Menu links 
for MW-1.34.2 with MobileFrontend and MinervaNeue 
Just replace span text and href to add links */

/* 在匿名函数内定义变量 */
(function() {
	var recentchanges = '最近更改', sandbox = '沙盒', villagepump = '互助客栈', policy = '方针', help = '帮助';
	switch(mw.config.get('wgUserLanguage')) {
		case 'zh-hant':
		case 'zh-hk':
		case 'zh-mo':
		case 'zh-tw':
			recentchanges = '近期變更';
			villagepump = '互助客棧';
			policy = '方針';
			help = '幫助';
			break;
	}
 
	var timer = setInterval(function() {
		if ($('.menu ul:first').length) {
			console.log("mobile menu exists");
			clearInterval(timer);
			$('.menu ul:first').append('<li><a href="/zh/special:recentchanges" class="mw-ui-icon mw-ui-icon-before"><span>' + recentchanges + '</span></a></li><li><a href="/zh/project:沙盒" class="mw-ui-icon mw-ui-icon-before"><span>' + sandbox + '</span></a></li><li><a href="/zh/project:互助客栈" class="mw-ui-icon mw-ui-icon-before"><span>' + villagepump + '</span></a></li><li><a href="/zh/project:方针" class="mw-ui-icon mw-ui-icon-before"><span>' + policy + '</span></a></li><li><a href="/zh/help:帮助总览" class="mw-ui-icon mw-ui-icon-before"><span>' + help + '</span></a></li>');
		}
	}, 100); // check every 100ms
})();