Difference between revisions of "User:Fbstj/gadget/history-test.js"

Jump to navigation Jump to search
m (fix bug)
m (++)
}) // api.get.then
}) // note.close
});
 
// 2019-04-13 try to make buttons from links
; mw.hook('wikipage.diff').add(function(){
// load the notify function
//mw.loader.load('mediawiki.notification');
// create an api client
//const api = new mw.Api()
// fetch the current RC id for the later request
//const rcid = mw.util.getParamValue('rcid', this.href)
// the old "button"
const old = document.querySelector('.patrollink')
// setup the new button
const btn = document.createElement('button')
btn.textContent = 'Patrol'
btn.addEventListener('click', function() {
// clicked
mw.notify('clicked!')
})
// hide old button and show new one
old.replaceWith(btn)
 
});