858
edits
(initial creation for testy) |
mNo edit summary |
||
Line 15: | Line 15: | ||
function addCollapseEvent() { | function addCollapseEvent() { | ||
//Add new click and keypress event listeners, and bind them to the function above. They should trigger only AFTER the other existing events | //Add new click and keypress event listeners, and bind them to the function above. They should trigger only AFTER the other existing events | ||
console.log('Adding click event'); | |||
$('mw-customtoggle-myDivision1').on('click.mw-collapsible keypress.mw-collapsible', checkIfCollapsed); | $('mw-customtoggle-myDivision1').on('click.mw-collapsible keypress.mw-collapsible', checkIfCollapsed); | ||
} | } | ||
Line 20: | Line 21: | ||
function onReady() { | function onReady() { | ||
//Add a new listener to the hook fired after the collapsible elements are ready. | //Add a new listener to the hook fired after the collapsible elements are ready. | ||
console.log('Adding collapsible listener'); | |||
mw.hook('wikipage.collapsibleContent').add(addCollapseEvent); | mw.hook('wikipage.collapsibleContent').add(addCollapseEvent); | ||
} | } | ||
console.log('Adding wikipage.content listener'); | |||
mw.hook('wikipage.content').add(onReady); | mw.hook('wikipage.content').add(onReady); |
edits