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

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

跳转到导航 跳转到搜索
添加483字节 、​ 2021年4月3日 (六) 05:30
无编辑摘要
(// Edit via Wikiplus)
mw.hook( 'wikipage.content' ).add(function( $content ) {
const $collapsibleContent = $content.find( '.mw-collapsible:not(.mw-made-collapsible)' ),
$sortableContent = $content.find( 'table.sortable' );,
$hoverGallery = $content.find( '.mw-gallery-packed-hover ' ),
isTouch = matchMedia( '(hover: none)' ).matches;
/**
* @Function: 折叠
* @Source: [[moegirl:Mediawiki:Mobile.js]]
*/
if ($collapsibleContent.length) {
console.log('Hook: wikipage.content,开始执行折叠');
mw.loader.using( 'jquery.makeCollapsible' ).then(function() { $collapsibleContent.makeCollapsible(); });
}
// 表格排序
if ($sortableContent.length) {
console.log('Hook: wikipage.content,开始执行表格排序');
mw.loader.using( 'jquery.tablesorter' ).then(function() { $sortableContent.tablesorter(); });
}
/**
* @Function: packed-hover模式的gallery将在触摸屏上替换为packed模式
* @Author: [[User:Bhsd]]
*/
if (isTouch && $hoverGallery.length) {
console.log('Hook: wikipage.content, 开始移除gallery的hover效果');
$hoverGallery.toggleClass( 'mw-gallery-packed-hover mw-gallery-packed' );
}
});
16,874

个编辑

导航菜单