LLWiki正在建设中,欢迎加入我们!
“MediaWiki:Mobile.js”的版本间差异
跳转到导航
跳转到搜索
标签:移动版网页编辑 移动版编辑 |
标签:移动版网页编辑 移动版编辑 |
||
第8行: | 第8行: | ||
/* global wgULS */ |
/* global wgULS */ |
||
mw.hook( 'wikipage.content' ).add(function( $content ) { |
mw.hook( 'wikipage.content' ).add(function( $content ) { |
||
const $collapsibleContent = $content.find( '.mw-collapsible:not(.mw-made-collapsible)' ), |
|||
$sortableContent = $content.find( 'table.sortable' ); |
|||
/** |
|||
* @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(); }); |
|||
} |
|||
// tabs-dropdown解析错误 |
// tabs-dropdown解析错误 |
||
$('.tabs-dropdown .tabs-content').append(function() { return $(this).next(); }); |
$('.tabs-dropdown .tabs-content').append(function() { return $(this).next(); }); |
2021年11月27日 (六) 04:29的版本
//<nowiki> // 由ResourceLoader直接调用,不可使用ES6语法 /** * @Description: 手机版全局JS * @Author: 如无特殊说明,均为[[User:Bhsd]] */ "use strict"; /* global wgULS */ mw.hook( 'wikipage.content' ).add(function( $content ) { // tabs-dropdown解析错误 $('.tabs-dropdown .tabs-content').append(function() { return $(this).next(); }); }); if (['Recentchanges', 'Watchlist'].includes( mw.config.get( 'wgCanonicalSpecialPageName' ) )) { // 修改filter mw.hook( 'structuredChangeFilters.ui.initialized' ).add(function() { console.log('Hook: structuredChangeFilters.ui.initialized,开始修改filter'); mw.loader.using( ['mediawiki.Uri', 'ext.gadget.site-lib'] ).then(function() { const node = $( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces' ).first().clone() .insertAfter( $( '.mw-rcfilters-ui-filterMenuSectionOptionWidget' ).first() ) .attr('id', 'ooui-invert').removeClass( 'oo-ui-element-hidden' ) .on('click', function() { const uri = new mw.Uri(), invert = uri.query.invert || 0; location.replace( uri.extend({ invert: 1 - invert }) ); }); node.find( 'span.oo-ui-labelElement-label' ).text( wgULS("排除选项", "排除所選") ); node.find( 'input' ).prop('checked', invert > 0) .next().addClass( 'oo-ui-image-invert' ); }); }); } else if (mw.config.get( 'wgCanonicalSpecialPageName' ) == 'MobileMenu') { mw.hook( 'mobile.menu' ).fire( $('.menu') ); } //</nowiki> // [[category:作为模块的小工具]] [[category:不可关闭的小工具]] [[category:手机版小工具]] // {{DEFAULTSORT:*}}