16,874
个编辑
LLWiki正在建设中,欢迎加入我们!
小 |
小 |
||
*/
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 => {
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',
'settings.dialog', 'to.bottom', 'mobile.menu' // 小工具Hook
].forEach(ele => {
mw.hook( ele ).add(x => {
|