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

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

来自LLWiki
跳转到导航 跳转到搜索
标签移动版网页编辑 移动版编辑
(// 使用Wikiplus小工具快速编辑)
标签移动版网页编辑 移动版编辑
 
(未显示2个用户的84个中间版本)
第1行: 第1行:
/* 这里的任何JavaScript将为使用移动版网站的用户加载 */
//<nowiki>
//<nowiki>
// 由ResourceLoader直接调用,不可使用ES6语法
(function($, mw) {
/**
$(function () {
* @Description: 手机版全局JS
mw.loader.using('ext.gadget.site-lib').then(function() {
* @Author: 如无特殊说明,均为[[User:Bhsd]]
/* Mobile Navmenu by GFwiki */
*/
$.ajax({
"use strict";
url: "/api.php?action=parse&page=MediaWiki:MFSidebar" + wgULS("","/zh-hant") + "&format=json",
/* global wgULS */
success: function(data) {
mw.hook( 'wikipage.content' ).add(function( $content ) {
var navlist = data.parse.text["*"];
// tabs-dropdown解析错误
$(navlist).insertAfter(".menu > ul:first");
$('.tabs-dropdown .tabs-content').append(function() { return $(this).next(); });
},
});
error: function () {
console.error("can\'t load customized navmenu");
},
dataType: "json"
});


if (['Recentchanges', 'Watchlist'].includes( mw.config.get( 'wgCanonicalSpecialPageName' ) )) {
/* 沙盒顶部 */
// 修改filter
$('.page-LLWiki_沙盒 #mf-section-0').prepend('<table style="background-color:#F3F5F7;border:1px solid #D4DBE2;border-radius:5px;width:70%;border-left:10px solid #C5C5C5;margin:auto" cellpadding="4px" align="center"><tbody><tr><td width="15%"><div class="center"><img src="/mediawiki/img_auth.php/thumb/0/04/Bandeau-avertisement-3.png/50px-Bandeau-avertisement-3.png" decoding="async" srcset="/mediawiki/img_auth.php/0/04/Bandeau-avertisement-3.png 1.5x" width="50" height="50"></div></td><td style="padding-left:5px">' + wgUCS("欢迎来到沙盒!您可以在此进行编辑测试。", "歡迎來到沙盒!您可以在此進行編輯測試。") + '</td></tr></tbody></table>');
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() {
/* 引自zh.moegirl.org.cn/mediawiki:mobile.js */
var uri = new mw.Uri(),
/* jquery.collapsible */
invert = uri.query.invert || 0;
if ($('.mw-collapsible').length) {
const node = $( '.mw-rcfilters-ui-itemMenuOptionWidget-view-namespaces' ).first().clone()
mw.loader.using('jquery.makeCollapsible').then(function() {
.insertAfter( $( '.mw-rcfilters-ui-filterMenuSectionOptionWidget' ).first() )
$('.mw-collapsible').makeCollapsible();
.attr('id', 'ooui-invert').removeClass( 'oo-ui-element-hidden' )
});
.on('click', function() {
}
uri = new mw.Uri();
invert = uri.query.invert || 0;
/* jquery.tablesorter */
location.replace( uri.extend({ invert: 1 - invert }) );
if ($('table.sortable').length) {
});
mw.loader.using('jquery.tablesorter').then(function() {
node.find( 'span.oo-ui-labelElement-label' ).text( wgULS("排除选项", "排除所選") );
$('table.sortable').tablesorter();
node.find( 'input' ).prop('checked', invert > 0)
});
.next().addClass( 'oo-ui-image-invert' );
}
});
});
/* 特殊页面 */
}
$('.page-Special_用户列表 h1').html('LLWiki上的LLer');
});
})(jQuery, mediaWiki);
//</nowiki>
//</nowiki>
// [[category:作为模块的小工具]] [[category:不可关闭的小工具]] [[category:手机版小工具]]
// {{DEFAULTSORT:*}}

2023年3月17日 (五) 13:28的最新版本

//<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() {
			var 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() {
				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' );
		});
	});
}
//</nowiki>
// [[category:作为模块的小工具]] [[category:不可关闭的小工具]] [[category:手机版小工具]]
// {{DEFAULTSORT:*}}