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

删除984字节 、​ 2023年3月17日 (五) 13:28
// 使用Wikiplus小工具快速编辑
(// 使用Wikiplus小工具快速编辑)
标签移动版网页编辑 移动版编辑
 
(未显示同一用户的11个中间版本)
"use strict";
/* global wgULS */
// 用户贡献页面不可创建
$('.mw-usertoollinks-contribs.new').off( 'click' ).click(function(e) { e.stopImmediatePropagation(); });
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-content').append(function() { return $(this).next(); });
});
 
if (['Recentchanges', 'Watchlist'].includes( mw.config.get( 'wgCanonicalSpecialPageName' ) == "Recentchanges")) {
$(function() {
// 快速编辑工具
if (['edit', 'submit'].includes( mw.config.get('wgAction') )) {
$( '.mw-editTools' ).insertBefore( '#wpTextbox1' );
}
});
 
if (mw.config.get( 'wgCanonicalSpecialPageName' ) == "Recentchanges") {
// 修改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() {
constvar uri = new mw.Uri(),
invert = uri.query.invert || 0,;
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() { window.location.href = uri.extend({ invert: 1 - invert }); });
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)
});
});
} else if (mw.config.get( 'wgCanonicalSpecialPageName' ) == 'MobileMenu') {
mw.hook( 'mobile.menu' ).fire( $('.menu') );
}
//</nowiki>
16,874

个编辑