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

Jump to navigation Jump to search
m (try dis)
m (trim)
/* Add edit buttons to templates */
function add_editSection_link(box) {
if (!box.id) return;
// FIXME: what does this do?
const vid = box.id.replace(/\.(\d+)/, "%$1")
// get the title element
const title = box.querySelector('.title')
// generate an edit link
const a = A('/edit/Template:'+ vid, 'edit')
// wrap the link in an '.editSection' link floated right
const float = document.createElement('span')
// loop over all .infobox and .navbar elements to
const boxes = [...document.querySelectorAll('.infobox'), ...document.querySelectorAll('.navbar')]
add_editSection_linkboxes.forEach(boxadd_editSection_link)
for (const box of boxes)
add_editSection_link(box)
 
});