User:Void/testing.js: Difference between revisions

From TestWiki
Content added Content deleted
(fixes)
(let's try this crazy thing)
Line 4: Line 4:
for(var i = 0; i < headings.length; i++) {
for(var i = 0; i < headings.length; i++) {
if(/Status: (Open|Done)/.test(headings[i].innerText)) {
if(/Status: (Open|Done)/.test(headings[i].innerText)) {
headings[i].nextSibling.lastChild.before(" | <a href='#' id='test'>test</a>");
headings[i].nextSibling.lastChild.id = 'edit-' + i;
$('edit-' + i).before('| <a href="#" click="doThing(' + i + ')">respond</a>');
}
}
}
}
}

function doThing(num) {
console.log(num);
}
}



Revision as of 22:48, 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>