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

“MediaWiki:Gadget-site-shared.js”的版本间差异

跳转到导航 跳转到搜索
(修正下载首页样式的判别)
(移除负面效果大于正面收益的功能)
* 8. 分类栏正确显示词曲作者的日文名
* 9. 触摸屏将packed-hover模式的gallery替换为packed
* 10. 章节标题hash繁简转换禁止使用InPageEdit快速编辑和快速重定向
* 11. 禁止使用InPageEdit快速编辑和快速重定向
* @Dependencies: mediawiki.api, mediawiki.Uri, mediawiki.Title, ext.gadget.site-lib
* @Author: 如无特殊说明,均为[[User:Bhsd]]
}
 
const lcCats = ["Μ's", 'Lily white', 'JQuery'];,
/**
const author = ['/^(作词', '|作曲', '|编曲', '|弦编曲', '|管弦编曲']):/;
* @Function: 分类栏显示小写标题
*/
const lcCats = ["Μ's", 'Lily white', 'JQuery'];
mw.hook( 'wikipage.categories' ).add(function($content) {
/**
* @Function: 分类栏显示小写标题
});*/
console.log('Hook: wikipage.categories, 开始替换小写分类');
lcCats.forEach(function(ele) {
$content.find(const 'a:contains('corrected += ele[0].toLowerCase() + ')' )ele.textslice(function(i, text1) {;
return text$content.replacefind( new RegExp'a:contains('^' + ele), ele[0].toLowerCase() + ele')').slicetext(1function(_, text) );{
return text.replace( RegExp('^' + ele), corrected ); // jshint ignore: line
});
});
mw.hook( 'wikipage.categories' }).add(function($content) {
});
/**
 
* @Function: 分类栏显示词曲作者的日文名
/**
*/
* @Function: 分类栏显示词曲作者的日文名
*/
const author = ['作词', '作曲', '编曲', '弦编曲', '管弦编曲'];
mw.hook( 'wikipage.categories' ).add(function($content) {
console.log('Hook: wikipage.categories, 开始替换词曲作者分类');
$content.children( '#mw-normal-catlinks' ).find('a')
author.forEach(function(ele) {
$content.findfilter( 'a:containsfunction(') +{ elereturn +author.test( this.textContent ':)'; }).html(function(_, val) {
const texti = thisval.textContentindexOf( ':' );
return [eleval.slice(0, i + ':'1), $('<span>', {lang: 'ja', text: this.title.slice(ele.lengthi + 10)})];
});
});
});
});
}
 
/**
* @Function: 自动实现hash繁简转换
* @Bug: 由于MediaWiki的hash转义算法有缺陷,可能无法识别转义前的“.”字符
*/
const hashConvert = function() {
const hash = location.hash.slice(1);
if (!hash || document.getElementById( hash )) { return; }
const header = $('.mw-headline').filter(function() {
const text = this.textContent;
return text == hash || text == decodeURIComponent( hash.replace(/\.(?=[\dA-Z]{2})/g, '%') );
})[0];
if (header) { location.hash = '#' + header.id; }
};
hashConvert();
$(window).on('hashchange', hashConvert);
 
/**