“File:方形乳贴-上白泽慧音.jpg”与“MediaWiki:Gadget-stickyHeading.js”:页面之间的差异
(页面间差异)
跳到导航
跳到搜索
imported>Edwin312 (源地址:http://www.pixiv.net/member_illust.php?mode=medium&illust_id=51334725) |
Mediawiki>Bhsd |
||
第1行: | 第1行: | ||
== | // 直接由ResourceLoader调用,因此不可使用ES6语法 | ||
"use strict"; | |||
/*global mw, $*/ | |||
const nsid = mw.config.get( 'wgNamespaceNumber' ), | |||
pagename = mw.config.get('wgPageName'), | |||
contentModel = mw.config.get( 'wgPageContentModel' ), | |||
skin = mw.config.get('skin'), | |||
gadgets = mw.gadgets || {}, | |||
stickyHeading = gadgets.stickyHeading || {}, | |||
ns = stickyHeading.namespace || [], | |||
mode = stickyHeading.mode, | |||
collapse = (stickyHeading.collapse !== false); | |||
if ( (ns.includes( nsid ) || nsid % 2 === 1 || pagename == "LLWiki:互助客棧") && contentModel == 'wikitext' && | |||
((skin == 'vector' && mode != 'mobile') || (skin == 'minerva' && mode != 'desktop')) ) { | |||
mw.hook( 'wikipage.content' ).add(function( $content ) { | |||
console.log('Hook: wikipage.content, 开始添加粘性章节标题'); | |||
$content.addClass( 'stickyHeading' ); | |||
const headings = $content.find( '.mw-parser-output > h2' ); | |||
headings.toArray().reverse().forEach(function(ele) { | |||
$('<div>').addClass( 'section-container' ).insertBefore(ele) | |||
.append( $(ele).nextAll( ':not(.section-container, #toc)' ).add(ele) ); | |||
}); | |||
if (!collapse || skin == 'minerva') { return; } | |||
$content.addClass( 'collapseHeading' ); | |||
const icon = $('<i class="mw-ui-icon-before mw-ui-icon-small mw-ui-icon mw-ui-icon-collapse"></i>'); | |||
headings.prepend( icon ).on('click', function(e) { | |||
if ( $(e.target).is('a') ) { return; } | |||
const self = $(this); | |||
self.nextAll().toggleClass( 'sec-hide' ); | |||
self.children().first().toggleClass( 'mw-ui-icon-collapse mw-ui-icon-expand' ); | |||
}); | |||
}); | |||
} | |||
// [[category:作为模块的小工具]] [[category:讨论工具]] [[category:桌面版小工具]] [[category:手机版小工具]] [[category:默认开启的小工具]] | |||
// {{DEFAULTSORT:stickyHeading.js}} |
2021年5月27日 (四) 21:14的版本
// 直接由ResourceLoader调用,因此不可使用ES6语法
"use strict";
/*global mw, $*/
const nsid = mw.config.get( 'wgNamespaceNumber' ),
pagename = mw.config.get('wgPageName'),
contentModel = mw.config.get( 'wgPageContentModel' ),
skin = mw.config.get('skin'),
gadgets = mw.gadgets || {},
stickyHeading = gadgets.stickyHeading || {},
ns = stickyHeading.namespace || [],
mode = stickyHeading.mode,
collapse = (stickyHeading.collapse !== false);
if ( (ns.includes( nsid ) || nsid % 2 === 1 || pagename == "LLWiki:互助客棧") && contentModel == 'wikitext' &&
((skin == 'vector' && mode != 'mobile') || (skin == 'minerva' && mode != 'desktop')) ) {
mw.hook( 'wikipage.content' ).add(function( $content ) {
console.log('Hook: wikipage.content, 开始添加粘性章节标题');
$content.addClass( 'stickyHeading' );
const headings = $content.find( '.mw-parser-output > h2' );
headings.toArray().reverse().forEach(function(ele) {
$('<div>').addClass( 'section-container' ).insertBefore(ele)
.append( $(ele).nextAll( ':not(.section-container, #toc)' ).add(ele) );
});
if (!collapse || skin == 'minerva') { return; }
$content.addClass( 'collapseHeading' );
const icon = $('<i class="mw-ui-icon-before mw-ui-icon-small mw-ui-icon mw-ui-icon-collapse"></i>');
headings.prepend( icon ).on('click', function(e) {
if ( $(e.target).is('a') ) { return; }
const self = $(this);
self.nextAll().toggleClass( 'sec-hide' );
self.children().first().toggleClass( 'mw-ui-icon-collapse mw-ui-icon-expand' );
});
});
}
// [[category:作为模块的小工具]] [[category:讨论工具]] [[category:桌面版小工具]] [[category:手机版小工具]] [[category:默认开启的小工具]]
// {{DEFAULTSORT:stickyHeading.js}}
文件历史
点击某个日期/时间查看对应时刻的文件。
日期/时间 | 缩略图 | 大小 | 用户 | 备注 | |
---|---|---|---|---|---|
当前 | 2022年11月20日 (日) 16:17 | 543 × 800(274 KB) | Maintenance script(讨论 | 贡献) | == 摘要 == Importing file | |
2022年11月20日 (日) 09:13 | 543 × 800(126 KB) | Maintenance script(讨论 | 贡献) | == 摘要 == Importing file |
您不可以覆盖此文件。
文件用途
以下页面使用本文件: