“User:Bhsd/tool.js”的版本间差异

添加315字节 、​ 2021年5月26日 (三) 23:50
无编辑摘要
*/
mw.myJsSize = () => {
const $table = $('.jsTable'), // 总是获取当前页面中的表格
$items = $table.find( 'tr:nth-child(n+1)' ),
titles = $items.find( 'a' ).toArray().map(ele => ele.title);
};
 
mw.hook( 'wikipage.content' ).add($content => {
(function() {
const $btn = $content.find( '#myJsSize' ).one('click', mw.myJsSize);
if ($btn.length === 0) { return; }
console.log('Hook: wikipage.content, 开始添加JS大小查询按钮');
});
 
(() => {
/**
* @Function: 记录所有触发的Hook
['postEdit', 'wikipage.content', 'wikipage.collapsibleContent', 'wikipage.categories', 'wikipage.diff',
'wikipage.editform', 'structuredChangeFilters.ui.initialized', 'codeEditor.configure', // MW原生Hook
'code.prettify', 'wikiplus.dialog', 'transclusion.preview', //'local.comments', 小工具Hook'hotcat.ready',
'settings.dialog', 'to.bottom', 'mobile.menu' // 小工具Hook
].forEach(ele => {
mw.hook( ele ).add(x => {
16,874

个编辑