User:Rutilant/DisCloser/First.js

$(function {	headerLevel = 2;	$( 'h' + headerLevel + ' span.mw-headline' ).each( function( i, val ) { var sectionName = $( this ).text; var editSectionUrl = $( this ).parent.find( '.mw-editsection a:first' ).attr( 'href' ); var sectionReg = /&section=(.*)/; var sectionRaw = sectionReg.exec( editSectionUrl ); if ( sectionRaw != null && sectionRaw[ 1 ].indexOf( 'T' ) < 0 ) { var sectionNumber = parseInt( sectionRaw[ 1 ] ); if ( $( this ).parent.prop( 'tagName' ) === 'H' + headerLevel ) { $( this ).parent( 'h' + headerLevel ).append( ' Close ' ); }}})});

statusRegExp = /&action=edit&closure=yes&section=(.*)/; var sectionNumber = statusRegExp.exec(location.href)[1]; if (sectionNumber != null && sectionNumber != ""){ $('#wpPreview').click; text1=document.editform.wpTextbox1.value; text=document.editform.wpSummary.value; text = text.replace("/* ",""); text = text.replace(" */ ",""); if (text != null && text != ""){ text2="=="+text+"=="; texts="== "+text+" =="; text1=text1.replace(text2,""); text1=text1.replace(texts,""); var result = prompt("Provide result\nDo NOT sign!"); if (result != null && result != ""){

text1="=="+text+"==\n" + text1+""; document.editform.wpTextbox1.value = text1; document.editform.wpSummary.value = 'Discussion closed using DisCloser.'; $('#wpDiff').click; }else{ alert("Error! You left the reason empty!"); } } }else{ alert("Error! Please refresh and try again.\n Invalid section number");

}