16,874
个编辑
LLWiki正在建设中,欢迎加入我们!
(修正下载首页样式的判别) |
|||
const pagename = mw.config.get( 'wgPageName' ),
action = mw.config.get( 'wgAction' ),
specialPage = mw.config.get( 'wgCanonicalSpecialPageName' )
hook = mw.hook( 'wikipage.content' );
/**
// 这个事件不能重复添加,但#editform可能会重建
$('#bodyContent').on('click', 'span.mw-charinsert-item', function() {
$('#wpTextbox1').textSelection( 'encapsulateSelection', {pre: this.dataset.start, post: this.dataset.end} );▼
▲ $('#wpTextbox1').textSelection( 'encapsulateSelection', {
});
* @Dependencies: mediawiki.Title
*/
console.log('Hook: wikipage.content, 开始处理其他用户主页面的红链');
$content.find( '.new' ).attr('href', function(
const query = mw.util.getParamValue('title', val);
if (!query) { return; } // 特殊页面
* @Function: 正确显示[[特殊:前缀索引/LLWiki:首页/当年今日/]]
*/
if (pagename.startsWith( 'LLWiki:首页/当年今日/' ) && action == 'view'
▲ // 非管理员不需要关心未创建的页面
if ($('#mainpage-style').length) { return; } // 避免不必要的下载
const $output = $content.children( '.mw-parser-output' ).addClass( 'mainpage-flex' );▼
console.log('Hook: wikipage.content, 开始下载主页样式表');
mw.loader.load( '//cdn.jsdelivr.net/gh/bhsd-harry/LLWiki@1.4/widget/mainpage.min.css', 'text/css' );
}
hook.add( download )
▲
}
*/
if (matchMedia( 'screen and (hover: none)' ).matches) {
console.log('Hook: wikipage.content, 开始移除gallery的hover效果');
$content.find( '.mw-gallery-packed-hover ' ).toggleClass( 'mw-gallery-packed-hover mw-gallery-packed' );
|