User:Void/testing.js: Difference between revisions
Content added Content deleted
(let's try this crazy thing) |
m (fix) |
||
Line 5: | Line 5: | ||
if(/Status: (Open|Done)/.test(headings[i].innerText)) { |
if(/Status: (Open|Done)/.test(headings[i].innerText)) { |
||
headings[i].nextSibling.lastChild.id = 'edit-' + i; |
headings[i].nextSibling.lastChild.id = 'edit-' + i; |
||
$('edit-' + i).before('| <a href="#" click="doThing(' + i + ')">respond</a>'); |
$('#edit-' + i).before('| <a href="#" click="doThing(' + i + ')">respond</a>'); |
||
} |
} |
||
} |
} |
Revision as of 22:50, 11 September 2017
// <nowiki>
if( mw.config.get('wgPageName') === 'TestWiki:Request_permissions' ) {
var headings = $('.mw-headline');
for(var i = 0; i < headings.length; i++) {
if(/Status: (Open|Done)/.test(headings[i].innerText)) {
headings[i].nextSibling.lastChild.id = 'edit-' + i;
$('#edit-' + i).before('| <a href="#" click="doThing(' + i + ')">respond</a>');
}
}
}
function doThing(num) {
console.log(num);
}
// </nowiki>