User:Gryllida/js/wab-talk.js

$('.mw-headline').each(function( index ) { // console.log( index + ": " + $( this ).text );  var txt = $( this ).text;  if(txt.indexOf('Wikinews recent additions') == -1){  	return true;  }  var $self = $( this );  // dom  var $span = $(' ');  $span.text(' Remove');  $span.attr('style', 'color: blue');  $span_y = $(" Yes ");  $span_n = $(" No ");  var $span2 = $(" Are you sure? ");  $span2.append($span_y );  $span2.append($(' / ') );  $span2.append($span_n );

// event $span.click(function {   $span2.show;    $(this).hide;  }); $span_n.click(function {   $span2.hide;    $span.show;  }); // // delete the section with number 'index - 1' via api $span_y.click(function {   	// blank the section  	var api = new mw.Api;  	api.postWithToken("edit", { action: 'edit', title: mw.config.get ('wgPageName'), section: index+1, summary: 'blanking section (assisted)', text: '' }); 	// update the view  	var $anchor = $self.parent;  	$anchor.nextUntil( "h2" ).remove;  	$anchor.remove;  	$('.wab-talk').remove;  	importScript('User:Gryllida/js/wab-talk-0.2.js');  }); // add to h $span.insertAfter($(this)); $span2.insertAfter($(this)); $span2.hide; });