User:Cabe6403/monobook.js

importScript('User:Dr pda/prosesizebytes.js');

function inc (file) { mw.loader.load('/w/index.php?title='+file+'&action=raw&ctype=text/javascript&dontcountme=s'); } inc("User:Lightdarkness/aiv.js");

importScript('User:Cameltrader/Advisor.js');

/* A heavily modified and expanded version of this code is now in use across the entire SourceWatch wiki. Here's a direct link to the code. A particular enhancement in the SourceWatch code is that it provides a dropdown next to the edit summary textfield containing common edit summaries. Selecting one of these automatically inserts that summary into the textfield. The code also examines which subproject of SourceWatch the page belongs to, and adds an appropriate prefix to the edit summary. */
 * Usage :Include a call to  in your page load function
 * Possible improvements :Make any form submission force a summary. Note that requiring an edit summary on preview or diff is not useful since "save" still needs to gain focus or be clicked before a commit can occur.

// ==UserScript== // @name          Enhanced history display // @namespace     stevage // @description   Collapses consecutive edits from the same person into one, shows diffs on history page // @include       *.wikipedia.org/*action=history // ==/UserScript== // This page should be found at http://en.wikipedia.org/wiki/User:Stevage/EnhanceHistory.user.js // Install it from http://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&dontcountme=s&title=User:Stevage/EnhanceHistory.user.js ( function { GM_log('in blank function');  function compress {    GM_log('in compress function');    if (!document.getElementById('bodyContent')) {        return;    }    this.add_buttons;  }  compress.prototype.add_buttons = function {    GM_log('in add_buttons');    // Create the compress buttion    var button1 = document.createElement('input');    button1.setAttribute('id', 'compress_button1');    button1.className = 'historysubmit';    button1.style.marginLeft = '5px';    button1.setAttribute('type', 'button');    button1.value = 'Compress history';    button1.onclick = function { compress.start; }    // Create the ShowDiffs buttion    var button1 = document.createElement('input'); button1.setAttribute('id', 'showdiffs1'); button1.className = 'historysubmit'; button1.style.marginLeft = '5px'; button1.setAttribute('type', 'button'); button1.value = 'Show diffs'; button1.onclick = function { compress.showDiffs; } // Add the button to the page var history = document.getElementById('pagehistory'); history.parentNode.insertBefore(button1, history); } ///////////////////////////////////////////////////////// function getPlainText(s) { GM_log(">getPlainText"); if (s==null) return ""; var len = s.length; if (len > 20) { return " " + s.substr(0,10)+'...'+ s.substr(len-10,10)+ " "; } else { return " " + s + " "; }   GM_log("/g, "&gt;"); if (m == -1) html += ""+t+""; else if (m == 1) html += ""+t+""; else html += "" +getPlainText(t) + ""; } return html; } // Find the differences between two texts. Return an array of changes. function diff(text1, text2) { // Check for equality (speedup) if (text1 == text2) return 0, 0, text1; var a; // Trim off common prefix (speedup) a = diff_prefix(text1, text2); text1 = a[0]; text2 = a[1]; var commonprefix = a[2]; // Trim off common suffix (speedup) a = diff_suffix(text1, text2); text1 = a[0]; text2 = a[1]; var commonsuffix = a[2]; if (!text1) { // Just add some text (speedup) a = 1, commonprefix.length, text2; } else if (!text2) { // Just delete some text (speedup) a = -1, commonprefix.length, text1; } else { // Check to see if the problem can be split in two. var longtext = text1.length > text2.length ? text1 : text2; var shorttext = text1.length > text2.length ? text2 : text1; var hm = diff_halfmatch(longtext, shorttext, Math.ceil(longtext.length/4)); if (!hm) hm = diff_halfmatch(longtext, shorttext, Math.ceil(longtext.length/2)); if (hm) { if (text1.length > text2.length) { var text1_a = hm[0]; var text1_b = hm[1]; var text2_a = hm[2]; var text2_b = hm[3]; } else { var text2_a = hm[0]; var text2_b = hm[1]; var text1_a = hm[2]; var text1_b = hm[3]; }     var mid_common = hm[4]; var result_a = diff(text1_a, text2_a); var result_b = diff(text1_b, text2_b); if (commonprefix) // Shift the indicies forwards due to the commonprefix. for (var x=0; x<result_a.length; x++) result_a[x][1] += commonprefix.length; result_a.push([0, commonprefix.length+text2_a.length, mid_common]); while (result_b.length) { result_b[0][1] += commonprefix.length+text2_a.length+mid_common.length; result_a.push(result_b.shift); }     a = result_a; } else { var result = diff_map(text1, text2); if (result) a = diffchar2diffarray(result, commonprefix.length); else // No acceptable result. a = -1, commonprefix.length, text1], [1, commonprefix.length, text2; } }  if (commonprefix) a.unshift([0, 0, commonprefix]); if (commonsuffix) a.push([0, commonprefix.length + text2.length, commonsuffix]); return a; } function diff_map(text1, text2) { // Explore the intersection points between the two texts. var now = new Date; var ms_end = now.getTime + 1000; // Don't run for more than one second. var max = text1.length + text2.length; var v_map = new Array; var v = new Array; v[1] = 0; var x, y; for (var d=0; d<=max; d++) { now = new Date; if (now.getTime > ms_end) // JavaScript timeout reached return null; v_map[d] = new Object; for (var k=-d; k<=d; k+=2) { if (k == -d || k != d && v[k-1] < v[k+1]) x = v[k+1]; else x = v[k-1]+1; y = x - k;     while (x < text1.length && y < text2.length && text1.charAt(x) == text2.charAt(y)) { x++; y++; }     v[k] = x;      v_map[d][k] = x;      if (x >= text1.length && y >= text2.length) { var str = diff_path(v_map, text1, text2); return str; }   }  }  alert("No result.  Can't happen. (diff_map)"); return null; } function diff_path(v_map, text1, text2) { // Work from the end back to the start to determine the path. var path = ''; var x = text1.length; var y = text2.length; for (var d=v_map.length-2; d>=0; d--) { while(1) { if (diff_match(v_map[d], x-1, y)) { x--; path = "-"+text1.substring(x, x+1) + path; break; } else if (diff_match(v_map[d], x, y-1)) { y--; path = "+"+text2.substring(y, y+1) + path; break; } else { x--; y--; //if (text1.substring(x, x+1) != text2.substring(y, y+1)) // return alert("No diagonal.  Can't happen. (diff_path)"); path = "="+text1.substring(x, x+1) + path; }   }  }  return path; } function diff_match(v, x, y) { // Does the vector list contain an x/y coordinate? for (var k in v)   if (v[k] == x && x-k == y)      return true; return false; } function diff_prefix(text1, text2) { // Trim off common prefix var pointermin = 0; var pointermax = Math.min(text1.length, text2.length); var pointermid = pointermax; while(pointermin < pointermid) { if (text1.substring(0, pointermid) == text2.substring(0, pointermid)) pointermin = pointermid; else pointermax = pointermid; pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } var commonprefix = text1.substring(0, pointermid); text1 = text1.substring(pointermid); text2 = text2.substring(pointermid); return [text1, text2, commonprefix]; } function diff_suffix(text1, text2) { // Trim off common suffix var pointermin = 0; var pointermax = Math.min(text1.length, text2.length); var pointermid = pointermax; while(pointermin < pointermid) { if (text1.substring(text1.length-pointermid) == text2.substring(text2.length-pointermid)) pointermin = pointermid; else pointermax = pointermid; pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } var commonsuffix = text1.substring(text1.length-pointermid); text1 = text1.substring(0, text1.length-pointermid); text2 = text2.substring(0, text2.length-pointermid); return [text1, text2, commonsuffix]; } function diff_halfmatch(longtext, shorttext, i) { // Do the two texts share a substring which is at least half the length of the longer text? // Start with a 1/4 length substring at position i as a seed. if (longtext.length < 10 || shorttext.length < 1) return null; // Pointless. var seed = longtext.substring(i, i+Math.floor(longtext.length/4)); var j=0; var j_index; var best_common = ''; while ((j_index = shorttext.substring(j).indexOf(seed)) != -1) { j += j_index; var my_prefix = diff_prefix(longtext.substring(i), shorttext.substring(j)); var my_suffix = diff_suffix(longtext.substring(0, i), shorttext.substring(0, j)); if (best_common.length < (my_suffix[2] + my_prefix[2]).length) { best_common = my_suffix[2] + my_prefix[2]; best_longtext_a = my_suffix[0]; best_longtext_b = my_prefix[0]; best_shorttext_a = my_suffix[1]; best_shorttext_b = my_prefix[1]; }   j++; } if (best_common.length >= longtext.length/2) return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common]; else return null; } function diffchar2diffarray(text, offset) { // Convert '-h+c=a=t' into -1, 0, 'h'], [1, 0, 'c'], [0, 1, 'at' // Old format: - remove char, = keep char, + add char // New format: array of [m, i, t] // Where m: -1 remove char, 0 keep char, 1 add char // Where i: index of change in first text // Where t: text to be added/kept/removed var i = 0; if (offset) i += offset; var a = new Array; var m; var last_m = null; for (var x=0; xdiffstring " + o.length + "/" + n.length); var out = diff( o.split(/\s+/), n.split(/\s+/) ); GM_log("1diffstring"); var str = ""; GM_log("2diffstring"); var plaintext = ""; GM_log("3diffstring"); for ( var i = 0; i < out.n.length - 1; i++ ) { if ( out.n[i].text == null ) { if ( out.n[i].indexOf('"') == -1 && out.n[i].indexOf('<') == -1 && out.n[i].indexOf('=') == -1 ) { 		    str += getPlainText(plaintext) + " " + " " + out.n[i] +"";			    plaintext = "";			  } else				  plaintext += " " + out.n[i];		  } else {			  var pre = "";			  if ( out.n[i].text.indexOf('"') == -1 && out.n[i].text.indexOf('<') == -1 && out.n[i].text.indexOf('=') == -1 ) { var n = out.n[i].row + 1; while ( n < out.o.length && out.o[n].text == null ) { if ( out.o[n].indexOf('"') == -1 && out.o[n].indexOf('<') == -1 && out.o[n].indexOf(':') == -1 && out.o[n].indexOf(';') == -1 && out.o[n].indexOf('=') == -1 )						 pre += " " + out.o[n] +" ";					  n++;				  }			  }			  plaintext = plaintext + " " + out.n[i].text;			  if (pre!="") {				  str += getPlainText(plaintext) + " " + pre;				  plaintext = "";			  }		  } // if	  } // for    GM_log("<diffstring");	  return str +" " +getPlainText(plaintext);	}	function diff( o, n ) {		var ns = new Array;		var os = new Array;		for ( var i = 0; i < n.length; i++ ) {			if ( ns[ n[i] ] == null )				ns[ n[i] ] = { rows: new Array, o: null };			ns[ n[i] ].rows.push( i );		}		for ( var i = 0; i < o.length; i++ ) {			if ( os[ o[i] ] == null )				os[ o[i] ] = { rows: new Array, n: null };			os[ o[i] ].rows.push( i );		}		for ( var i in ns ) {			if ( ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1 ) { n[ ns[i].rows[0] ] = { text: n[ ns[i].rows[0] ], row: os[i].rows[0] }; o[ os[i].rows[0] ] = { text: o[ os[i].rows[0] ], row: ns[i].rows[0] }; }		}		for ( var i = 0; i < n.length - 1; i++ ) { if ( n[i].text != null && n[i+1].text == null && o[ n[i].row + 1 ].text == null && 					 n[i+1] == o[ n[i].row + 1 ] ) { n[i+1] = { text: n[i+1], row: n[i].row + 1 }; o[n[i].row+1] = { text: o[n[i].row+1], row: i + 1 }; }		}		for ( var i = n.length - 1; i > 0; i-- ) { if ( n[i].text != null && n[i-1].text == null && o[ n[i].row - 1 ].text == null && 					 n[i-1] == o[ n[i].row - 1 ] ) { n[i-1] = { text: n[i-1], row: n[i].row - 1 }; o[n[i].row-1] = { text: o[n[i].row-1], row: i - 1 }; }		}		return { o: o, n: n }; } function stripHTML(oldString) { var newString = ""; var inTag = false; for(var i = 0; i < oldString.length; i++) { if(oldString.charAt(i) == '<') inTag = true; if(oldString.charAt(i) == '>') { inTag = false; i++; }     if(!inTag) newString += oldString.charAt(i); }   return newString; } compress.prototype.mediawiki_content = function(text) { GM_log(">mw_content:"); if (text == "") { return text; } else { text = '' + text; var start = text.indexOf('') + 1; var end = text.indexOf(' '); GM_log("/g, "&gt;"); GM_log ("Stripped: " + s.substr(0,50)); return s;   } } compress.prototype.start = function { var hist = document.getElementById('pagehistory'); if (hist) { var diffs; diffs = document.evaluate(       "LI",        hist,        null,        XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,        null      ); var last='*x!', prevdiffcomment; for (var i = 0; i < diffs.snapshotLength; i++) { var diff = diffs.snapshotItem(i); var comment = document.evaluate(         'SPAN[@class="comment"]',          diff,          null,          XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,          null        ).snapshotItem(0); //GM_log(comment.innerHTML); var a = document.evaluate(         "SPAN/A",          diff,          null,          XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,          null        ); eacha = a.snapshotItem(0); if (eacha.title==last) { if (comment) { prevdiffcomment.innerHTML = prevdiffcomment.innerHTML + '//' + comment.innerHTML; } else { prevdiffcomment.innerHTML = prevdiffcomment.innerHTML + '//---'; }         diff.parentNode.removeChild(diff); } else { last = eacha.title; if (!comment) { comment = document.createElement('SPAN'); comment.className='comment'; comment.innerHTML=' ---'; diff.insertBefore(comment, null); }         prevdiffcomment = comment; } //if }//for } //if hist } // function 'start' compress.prototype.loadDiff = function(urlno) { GM_log("in loadDiff"); this.urlno = urlno; this.hostname = "en.wikipedia.org"; var url = this.urls[urlno] + '&action=edit'; if (this.urls[urlno] == null) { var details = new String(""); details.responseText = ""; // force comparison with blank text; compress.loadedDiff(details); return; }   GM_log(">loading!" + url); GM_xmlhttpRequest({ 	  method:'GET',  	  url:url,      headers:{        'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',        'Accept': 'application/xml',        },      onload:function(details) {        //alert("hello " + details.status + '/' + details.statusText + '/' + details.responseHeaders);        compress.loadedDiff(details);      }    }); GM_log("loadedDiff "+this.urlno); this.pages[this.urlno] = this.mediawiki_content(details.responseText); GM_log("-loadedDiff "+this.urlno); if (this.urlno > 0) { s = diffString(this.pages[this.urlno], this.pages[this.urlno-1]); GM_log("done diff"); wh = document.getElementById(this.info[this.urlno -1]); span = document.createElement('span'); span.innerHTML = s;     wh.insertBefore(span, null); }   if (details.responseText != "") { compress.loadDiff(this.urlno+1); // if blank text, stop. }         GM_log("<loadedDiff"); } compress.prototype.showDiffs = function { var hist = document.getElementById('pagehistory'); if (hist) { var diffs; diffs = document.evaluate(       'LI/A[text != "cur" and text != "last"][1]',        hist,        null,        XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,        null      ); this.urls = new Array(diffs.snapshotLength); this.info = new Array(diffs.snapshotLength); this.pages = new Array(diffs.snapshotLength); GM_log("Number of A's: " + diffs.snapshotLength); for (var i = 0; i < diffs.snapshotLength; i++) { var diff = diffs.snapshotItem(i); diff.id = "difflink" + i;       diff.parentNode.id = "diffli" + i;        this.urls[i] = diff.href; this.info[i] = "diffli" + i;       if (i==0) { this.loadDiff(0); }     }//for } //if hist } // function 'start' var compress = new compress; document.compress = compress; } // unnamed function ) ;

importScript('User:AzaToth/twinkle.js');

TwinkleConfig = { revertMaxRevisions             :       50, userTalkPageMode               :       'tab', showSharedIPNotice             :       true, openTalkPage                   :       [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert       :       false, summaryAd                      :       " using TW", deletionSummaryAd              :       " using TW", protectionSummaryAd            :       " using TW", watchSpeedyPages               :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ], watchProdPages                 :       true, openUserTalkPageOnSpeedyDelete :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], watchRevertedPages             :       [ 'agf', 'norm', 'vand', 'torev' ], markRevertedPagesAsMinor       :       [ 'agf', 'norm', 'vand', 'torev' ], deleteTalkPageOnDelete         :       false, watchWarnings                  :       true, markAIVReportAsMinor           :       true, markSpeedyPagesAsMinor         :       true, offerReasonOnNormalRevert      :       true, orphanBacklinksOnSpeedyDelete  :       {orphan:true, exclude:['g6']} };

//AUTO PEER REVIEW

//User talk:AndyZ/peerreviewer.js // ******************************************* // // See User:AndyZ/peerreviewer for details // // Quick installation -                       // // Add to your monobook.js:                   // // User:AndyZ/peerreviewer.js    // // ******************************************* // // Written by AndyZ, 2006                     // // ******************************************* // //Semi-automatic javascript peer reviewer // note that this is NOT a WP:BOT // though it may be considered a semi-bot // *-*-*-*-*-* start code *-*-*-*-*-* // addlink script: User:Omegatron/monobook.js/addlink.js document.write(''); // *-*-*-*-*-*-*-*-*-*- //   // configurable options // // details on talk page // // *-*-*-*-*-*-*-*-*-*- //	// input_PR is the source id for the input // output_PR is the output id for the output var input_PR, output_PR; if(!input_PR) input_PR = "wpTextbox1"; if(!output_PR) output_PR = "theResponse"; //configurable options, see talk page for details var allSpaces_PR, defaultView_PR, select_PR, popup_PR, sendTo_PR, toolbarLink_PR, toolbar_PR, directRef_PR, cat_PR, alpha_PR, userSandbox_PR, initMsg_PR, endMsg_PR, noXHR_PR, maintain_PR, maintain2_PR, spellcheck_PR, showHeading_PR, showInstaview_PR, instaview_PR, width_PR, imgCheck_PR, context_PR, simple_PR, expandContractions_PR; if(!allSpaces_PR) allSpaces_PR = false; // if true, "peer review" link will appear on all article pages if(!defaultView_PR) defaultView_PR = 0; // options: 0 - normal, in prose; 1 - template form;  2 - with references;  (for now) if(!select_PR) select_PR = false; // selects text if(!popup_PR) popup_PR = false; // feature not available yet if(!sendTo_PR) sendTo_PR = false; // if true, removes send to tab if(!toolbarLink_PR) toolbarLink_PR = false; // accepted values = "personal", "cactions", "navigation", "tb" if(!toolbar_PR) toolbar_PR = "personal"; if(!directRef_PR) directRef_PR = false; if(!cat_PR) cat_PR = false; if(!alpha_PR) alpha_PR = false; if(!userSandbox_PR) userSandbox_PR = "User:" + wgUserName + "/sandbox" if(!initMsg_PR) initMsg_PR = " " + "The following suggestions were generated by a semi-automatic javascript program, and might not be applicable for the article in question." if(!endMsg_PR) endMsg_PR = "\nYou may wish to browse through User:AndyZ/Suggestions for further ideas. Thanks, "+"\n\n\n"; if(!noXHR_PR) noXHR_PR = false; // allow ajax (XMLHTTPrequest) or not if(!maintain_PR) maintain_PR = false; //for maintainers of WP:PR/A and its subpages if(!maintain2_PR) maintain2_PR = false; //for maintainers of WP:PR/A and its subpages if(maintain2_PR) select_PR = true; if(maintain2_PR) showHeading_PR = true; if(!spellcheck_PR) spellcheck_PR = false; //spell checker, takes long time though if(!showHeading_PR) showHeading_PR = false; if(!showInstaview_PR) showInstaview_PR = false; if(instaview_PR == undefined) instaview_PR = true; //instaview button!! released under BSD license by Pilaf if(imgCheck_PR == undefined) imgCheck_PR = false; if(context_PR == undefined) context_PR = false; if(!width_PR) width_PR = 1200; var width4_PR = width_PR + 4; width_PR = width_PR.toString; width4_PR = width4_PR.toString; if(!simple_PR) simple_PR = false; if(expandContractions_PR==undefined) expandContractions_PR = true; //colors, style var restoreText_PR, restoreStyle_PR, topBarColor_PR, botBarColor_PR; if(!restoreText_PR) restoreText_PR = "[restore]"; // text for restoration button if(!restoreStyle_PR) restoreStyle_PR = "background:yellow; position:absolute; margin-left:5px; margin-top:120px;"; if(!topBarColor_PR) topBarColor_PR = "red"; // color of top bar of suggestions if(!botBarColor_PR) botBarColor_PR = "#cccccc"; // color of bottom bar of suggestions // *-*-*-*-*-* end configurable options *-*-*-*-*-* if(wgNamespaceNumber == 0 || wgNamespaceNumber == 4 || allSpaces_PR){		//only if namespace is main (or wp) //the actual output location of the suggestions //!!! needs cleanup for readability //feedbackid = "theFeedback"; //drag_PR = 'onmousedown="StartDrag(document.getElementById('+feedbackid+'))" onmouseup="CancelDrag" onmouseout="CancelDrag"' var instaview_button_txt; if(instaview_PR) instaview_button_txt = '<input type="button" value="Instaview" name="instaview_button" id="instaview_button" style="width:150" onclick="instaPreview;" onMouseOver="window.status=\'Preview the suggestions using Live Preview ((C)2006 Pilaf, BSD) without having to copy+paste and using diff. button\'; return true;" onMouseOut="window.status=\'\'">' else instaview_button_txt = ""; //add new button for <span onclick="addToPage">move to soon document.write('<div id="theFeedback" style="position:absolute; width:'+width_PR+'px; margin-top:150px; margin-left:40px; border:2px solid #000000; background:55ff55; visibility:hidden; z-index:20;">' +    '<div id="topBar" style="background:'+topBarColor_PR+'; text-align:right; width:'+width4_PR+'px">' +     '<span onclick="popreview;" onMouseOver="window.status=\'Shows current suggestions in new window, so that they do not interfere with editing\'" onMouseOut="window.status=\'\'">new window | ' +    '<span onclick="hide_PR" onMouseOver="window.status=\'Hides suggestions so you can continue editing\'" onMouseOut="window.status=\'\'">close ' +     ' ' +     '<form name="theForm"><textarea style="width:'+width_PR+'px" rows="20" name="theResponse" id="theResponse">'+initMsg_PR+' ' +    '<div style="background:'+botBarColor_PR+'; width:' + width4_PR + 'px">'+instaview_button_txt +    ' <input type="button" value="Readonly" name="switch_readonly" onclick="determineReadonly"> |' + ' <input type="button" value="Autoformat article per MoS" name="MOSformatting" onclick="MOS_format;" onMouseOver="window.status=\'Combo of scripts (thx Bobblewik, Gimmetrow) that fix certain MoS issues in article. Be sure to carefully check diff\'" onMouseOut="window.status=\'\'">' + ' <a href="http://en.wikipedia.org/wiki/User talk:AndyZ/peerreviewer.js" target="_blank" onMouseOver="window.status=\'All feedback is appreciated\'" onMouseOut="window.status=\'\'">Questions/comments/errors?</a> ' + ' '	+' '	+'<div id="restore" style="z-index:19; visibility:hidden;'+restoreStyle_PR+'" onclick="show_PR" onMouseOver="window.status=\'Show suggestions\'" onMouseOut="window.status=\'\'">'+restoreText_PR+' ')	} if(simple_PR) JSpeerreview_callingFunction = "JSpeerreview_simple;" else JSpeerreview_callingFunction = "JSpeerreview;"; if(toolbar_PR == "personal" || toolbar_PR == "navigation" || toolbar_PR == "cactions" || toolbar_PR == "tb"){    if((wgNamespaceNumber == 0 || wgNamespaceNumber == 4 || allSpaces_PR) && !toolbarLink_PR){    //adds peer review link to top bar (with your user + talk pgs, prefs., watchlist, etc.)    addOnloadHook(function  { if(document.forms.editform) { addLink('p-'+toolbar_PR, 'javascript:' + JSpeerreview_callingFunction, 'peer review', 'ca-peerreviewer', 'Semi-automatic peer reviewer by javascript', , ); }   });	    }    if((wgNamespaceNumber == 0 || allSpaces_PR) && toolbarLink_PR){    addOnloadHook(function  { addLink('p-'+toolbar_PR, 'javascript:toJSpeerreview', 'peer review', 'ca-peerreviewer', 'Semi-automatic peer reviewer by javascript', , ); });	   } } templateData_PR = new Array( ["lead","*Please expand the lead to conform with guidelines at Lead. The article should have an appropriate number of paragraphs as is shown on WP:LEAD, and should adequately summarize the article."], ["leadlong","*The lead of this article may be too long, or may contain too many paragraphs. Please follow guidelines at WP:LEAD; be aware that the lead should adequately summarize the article."], ["leaddetail","*The lead is for summarizing the rest of the article, and should not introduce new topics not discussed in the rest of the article, as per WP:LEAD. Please ensure that the lead adequately summarizes the article."], ["infobox","*You may wish to consider adding an appropriate infobox for this article, if one exists relating to the topic of the article. "], ["contxt","*Per Wikipedia:Context and Wikipedia:Manual of Style (dates), months and days of the week generally should not be linked. Years, decades, and centuries can be linked if they provide context for the article."], ["linkdate","*Years (2008) or months (January) by themselves are typically not linked. Per Wikipedia:Context, be consistent about linking years with full dates. Either link them all, or none of them: for example, link ."], ["dateth","*As per Wikipedia:Manual of Style (dates), dates shouldn't use th; for example, instead of (if such appeared in the article) using January 30th was a great day, use January 30 was a great day."], ["nbsp","*Per Wikipedia:Manual of Style (numbers), there should be a non-breaking space -  between a number and the unit of measurement. For example, instead of ', use ', which when you are editing the page, should look like: <tt></tt>."], ["spellnum","*Per Wikipedia:Manual of Style (numbers), please spell out source units of measurements in text; for example, the Moon is 380,000 kilometres (240,000 mi) from Earth."], ["abbrev","*Per Wikipedia:Manual of Style (numbers), when doing conversions, please use standard abbreviations: for example, miles -> mi, kilometers squared -> km2, and pounds -> lb."], ["headingthe","*Per Manual of Style (headings), headings generally do not start with articles ('the', 'a(n)'). For example, if there was a section called  ==The Biography== , it should be changed to  ==Biography== ."], ["headingre","*Per Manual of Style (headings), headings generally should not repeat the title of the article. For example, if the article was Ferdinand Magellan, instead of using the heading  ==Magellan's journey== , use  ==Journey== ."], ["headinglink","*As per Manual of Style (headings), please do not link words in headings."], ["headingcap","*Per Manual of Style (headings), avoid capitalizing words in section headings unless they are proper nouns or the first word of the heading."], ["gtl","*Please reorder/rename the last few sections to follow guidelines at Guide to layout."], ["overlink","*Consider removing links that add little to the article or that have been repeated in close proximity to other links to the same article, as per Manual of Style (links) and WP:CONTEXT. Guides recommend having greater than 3% words in links, but be sure not to overlink words just to add more links."], ["underlink","*Consider adding more links to the article; per Manual of Style (links) and Build the web, create links to relevant articles."], ["footspace","*As done in WP:FOOTNOTE, footnotes usually are located right after a punctuation mark (as recommended by the CMS, but not mandatory), such that there is no space in between. For example, the sun is larger than the moon [2]. is usually written as the sun is larger than the moon.[2]"], ["alpha","*Please alphabetize the interlanguage links."], //   ["alpha|categories","*Please alphabetize the categories."], //   ["alpha|categories and interlanguage links","*Please alphabetize the categories and interlanguage links."], ["ref","*The article will need references. See WP:CITE and WP:V for more information."], ["foot","*This article needs footnotes, preferably in the cite.php format recommended by WP:WIAFA. Simply, enclose inline citations, with WP:CITE or WP:CITE/ES information, with . At the bottom of the article, in a section named “References” or “Footnotes”, add ."], ["noimg","*This article has no or few images. Please see if there are any free use images that fall under the Image use policy and fit under one of the Image copyright tags that can be uploaded. To upload images on Wikipedia, go to Special:Upload; to upload non-fair use images on the Wikimedia Commons, go to commons:special:upload."], ["leadimg","*If there is not a free use image in the top right corner of the article, please try to find and include one."], ["caption","*Per What is a featured article?, Images should have concise captions."], ["toc","*Per WP:WIAFA, this article's table of contents (ToC) may be too long – consider shrinking it down by merging short sections or using a proper system of daughter pages as per Summary style."], ["expand","*This article is a bit too short, and therefore may not be as comprehensive as WP:WIAFA critera 1(b) is looking for. Please see if anything can be expanded upon."], ["SS","*This article may need to undergo summary style, where a series of appropriate subpages are used. For example, if the article is United States, then an appropriate subpage would be History of the United States, such that a summary of the subpage exists on the mother article, while the subpage goes into more detail."], ["copyedit","*Please ensure that the article has gone through a thorough copyediting so that it exemplifies some of Wikipedia's best work. See also User:Tony1/How to satisfy Criterion 1a."], ["list","*This article may be a bit list-weighty; in other words, some of the lists should be converted to prose (paragraph form)."], ["trivia","*Generally, trivia sections are looked down upon; please either remove the trivia section or incorporate any important facts into the rest of the article."], ["persondata","*If this article is about a person, please add  along with the required parameters to the article - see Persondata for more information."], ["how","*Please avoid including instruction manuals, tutorials, etc. or other 'how-to's per WP:NOT."], ["ig","*Avoid including galleries in articles, as per Wikipedia:Galleries. Common solutions to this problem include moving the gallery to wikicommons or integrating images with the text."], ["fact","*Please provide citations for all of the s."] ); for(i=0;i<templateData_PR.length;i++)	templateData_PR[i][1] += "[?]";	//appending footnotes	// *-*-*-*-*-* non-configurable global variable declarations *-*-*-*-*-* var temp_mem, foot_mem; var imgFU = false, imgFUstr = ""; var imgNT = false, imgNTstr = ""; var PRtemplateData, tempPRdata; // !!! var outputText_PR = initMsg_PR;	//actual output text var spellcheck_output = ""; function JSpeerreview{   //wpTxt is the variable for the text of a document, input_PR is the id if(document.getElementById(input_PR))    wpTxt = document.getElementById(input_PR).value; else{    alert("Error: Could not locate text\n" + input_PR); return; } if(!document.getElementById(output_PR)){    alert("Error: Unable to access output location\n" + output_PR); return;	} //current date variables    var current_date = new Date, cur_month = current_date.getMonth, cur_year = current_date.getFullYear;    var y_abbrev = cur_year.toString.substring(2,4); var m_abbrev = new Array("J","F","M","A","MY","JN","JL","AU","S","O","N","D"); var m_full = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); // 	// Messages on WP:PR // 	if(wgTitle.indexOf("Peer review") != -1 && wgTitle.indexOf("/Automated") == -1 && wgNamespaceNumber == 4 		//WP namespace && document.editform.wpTextbox1.value.indexOf("User:AndyZ/peerreviewer") == -1){ document.editform.wpTextbox1.value += "\n*A script has been used to generate a semi-automated" +" review of the article for issues relating to grammar and house style. If you would find such a review helpful, please click here. Thanks, ~"; // Add a tag to the summary box - stolen from User:Bobblewik var txt = document.editform.wpSummary; var summary = "Automated peer review at WP:PRA/"+m_abbrev[cur_month]+y_abbrev+""; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) { txt.value += " | "; }		txt.value += summary; } return; } //   // |%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%| // // |%|%|%|%|%| START  OUTPUT |%|%|%|%|%| // // |%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%|%| // document.getElementById(output_PR).value = JSpeerreview_body(document.getElementById(input_PR).value,document.getElementById(output_PR).value); //--* replacing template format with actual words temp_mem = document.getElementById(output_PR).value; if(defaultView_PR == 0) replaceTemp; document.getElementById('instaview_button').style.width = 150; document.theForm.switch_readonly.style.width = 150; //--* //show feedback document.getElementById("theFeedback").style.visibility = "visible"; if(select_PR)				//selects suggestions, for easy copy+pasting document.getElementById(output_PR).select; // %%%%%%%%%%%%%%%%%%%%%%%%%%%%% }// ending brace for function %% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%% function JSpeerreview_simple{ output_PR = "wpTextbox1"; document.getElementById('wpTextbox1').value = JSpeerreview_body(document.getElementById('wpTextbox1').value,""); replaceTemp; } function JSpeerreview_body(inputText_PR,outputText_PR){ if(outputText_PR.indexOf("Thanks")!=-1){ var existingPR = confirm("There are already suggestions here.\nContinuing will cause the old suggestions to be overwritten.\nDo you wish to proceed?"); if(!existingPR) return; else{ outputText_PR = initMsg_PR;		//reset global variables imgFU = false; imgFUstr = ""; imgNT = false; imgNTstr = ""; } } if(outputText_PR == "") outputText_PR = initMsg_PR; if(showHeading_PR) //heading on output (at top) outputText_PR = "==="+wgTitle+"===\n"+outputText_PR; //--* lead - determine number of paragraphs inputText_PR_lead = inputText_PR.substring(0,inputText_PR.indexOf("==")) if(/^([A-Z]|'{3})/gm.test(inputText_PR_lead)) NumPara = inputText_PR_lead.match(/^([A-Z]|'{3})/gm).length; else NumPara=1; if(NumPara == 1) outputText_PR+="\n"; if(NumPara == 2 && inputText_PR.length>=30000) outputText_PR+="\n"; if(NumPara == 3 && inputText_PR.length<=15000) outputText_PR+="\n"; if(NumPara == 4 && inputText_PR.length<=30000) outputText_PR+="\n"; if(NumPara >= 5){ outputText_PR+="\n"; outputText_PR+="\n"; } //--* Links compared to # of words (see WP:MOS-L) words = inputText_PR.split(" ").length; links = inputText_PR.split("/gi, '$1')   //.replace(/\[\[(miles?)\]\]/gi, '$1')    .replace(/m\.p\.h\.(\W)/g, 'mph$1')    .replace(/(\W)mph(\W)/gi, '$1mph$2')    .replace(/(\d)\s?mph/gi, '$1 mph')    .replace(/(\d)\-mph/gi, '$1 mph')    // square mile    .replace(/sq\.?\s?mi/gi, 'sq mi')    // foot pound    .replace(/ftlbs?(\W)/gi, 'ft·lbf$1')    .replace(/ft[ -.·•\/]lb(\W)/gi, 'ft·lbf$1')    .replace(/ft[ -.·•\/]lbs/gi, 'ft·lbf')    .replace(/ft[ -.·•\/]lbf/gi, 'ft·lbf')    .replace(/ft[ -.·•\/]lbff/gi, 'ft·lbf')    // Give digital value a percent symbol '%' instead of word    .replace(/(\d)\s?per ?cent([^aei])/gi, '$1%$2')    .replace(/(\d)\-per ?cent([^aei])/gi, '$1%$2')    // knot    .replace(/(\d)\s?kts(\W)/gi, '$1 knots$2')    .replace(/(\d)\s?knt(\W)/gi, '$1 knots$2')    // horsepower    .replace(/(\d)\s?hp(\W)/gi, '$1 hp$2')    .replace(/(\d)\s?bhp/gi, '$1 bhp') .replace(/(\d)\s?shp/gi, '$1 shp') // rpm .replace(/(\d)\s?rpm/gi, '$1 rpm') .replace(/(\d)\-rpm/gi, '$1 rpm') // decibel .replace(/(\d)\s?(dB)\b/g, '$1 $2') // bits per second .replace(/([KkMmGg])(bps|bits?\/s|b\/s)/g, '$1bit/s') .replace(/(\d)\s?(bps)/gi, '$1 bit/s') .replace(/(\d) bps/gi, '$1 bit/s') .replace(/bits?\/sec(\W)/gi, 'bit/s$1') // bytes per second .replace(/([KkMmGg])(Bps|bytes?\/s)/g, ' $1B/s') .replace(/bytes?\/s(\W)/gi, 'B/s$1') // capitalization of prefix with bits and bytes .replace(/K(bit|B)\/s/g, 'k$1/s') .replace(/m(bit|B)\/s/g, 'M$1/s') .replace(/g(bit|B)\/s/g, 'G$1/s') // space with bits and bytes .replace(/(\d)\s?(k|M|G)(bit|B)/g, '$1 $2$3') // Common error with bits and bytes .replace(/mibi(bit|byte)/g, 'mebi$1') //Remove 'Easter egg' diversions (linking unit name to orders of magnitude articles) .replace(/\[\[1\s?_?E\s?\-?\d{1,2}\s?..?\|([^\]]{1,50})\]\]/gi, '$1') .replace(/\[\[Orders\sof\smagnitude\s\([^\)]{1,30}\)\|([^\]]{1,50})\]\]/gi, '$1')    // Convert degree symbols into ° symbol, ensure preceding space    .replace(/&deg;/g, '°')    .replace(/º/g, '°')    .replace(/°\s?([CF])/g, '°$1')    .replace(/°\s?(celsius)/gi, '°C')    .replace(/(\d)\s?(°[CF])/g, '$1 $2')    //Fix spelling errors    .replace(/celsius/gi, 'Celsius')    .replace(/celcius/gi, 'Celsius')    //Fix common naming error (be careful with this one)    .replace(/centigrade/gi, 'Celsius')    // Convert &sup into superscript ² symbol    .replace(/&sup2;/g, '²')    .replace(/&sup3;/g, '³')    // Convert the word ohm(s) or the html entity into the actual O symbol (Omega, not the actual ohm symbol &#8486) and make sure it is spaced    .replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|µ|µ|n|p|f|a|z|y)?\s?(&Omega|ohm|Ohm)s?([\s,.:\)\(\\/)])/g, '$1 $2O$4') // Convert various micro symbols into the actual micro symbol, make sure it's spaced .replace(/(\d)\s?(&mu;|µ|&micro;)(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|O|F|Wb|T|H|S|Bq|Gy|Sv|kat|M)([\s,.:\)\(\\/)])/g, '$1 µ$3$4')   // Convert capital K to lowercase k in units    .replace(/(\d)\s?K(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|O|F|Wb|T|H|S|Bq|Gy|Sv|kat|M)([\s,.:\)\(\\/)])/g, '$1 k$2$3') .replace(/(\d)\-K(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|O|F|Wb|T|H|S|Bq|Gy|Sv|kat|M)([\s,.:\)\(\\/)])/g, '$1 k$2$3')   .replace(/(\d) K(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|O|F|Wb|T|H|S|Bq|Gy|Sv|kat|M)([\s,.:\)\(\\/)])/g, '$1 k$2$3') // Hertz .replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|µ|µ|n|p|f|a|z|y)?hz/gi, '$1 $2Hz') .replace(/(\d)\-(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|µ|µ|n|p|f|a|z|y)?hz/gi, '$1 $2Hz') // Fix kilometres .replace(/(\d)\s?kms?([\s,\.:\)\(\\/)])/gi, '$1 km$2')   .replace(/(\d)\-kms?([\s,\.:\)\(\\/)])/gi, '$1 km$2') .replace(/(\d) kms?([\s,\.:\)\(\\/)])/gi, '$1 km$2')   .replace(/(\d)\s?sq\.?\s?kms?/gi, '$1 km²')    .replace(/sq\.?\s?kms?/gi, 'km²')    .replace(/(\d)\s?sq\.?\s?m([^i])/gi, '$1 m²$2')    .replace(/m²\.\)/gi, 'm²)')    // Standardise kilometres per hour    .replace(/km\/hr/gi, 'km/h')    .replace(/kph/gi, 'km/h')    .replace(/kmph/gi, 'km/h')    .replace(/(\d)\s?kmh/gi, '$1 km/h')    .replace(/km\/h/gi, 'km/h')    .replace(/(\d)\s?km\/h/gi, '$1 km/h')    .replace(/(\d)\-km\/h/gi, '$1 km/h')    .replace(/(\d) km\/h/gi, '$1 km/h')    // Standardise 'per second'    .replace(/(\d)\s?ft\/second/gi, '$1 ft/s')    .replace(/(\d)\s?ft\/sec/gi, '$1 ft/s')    .replace(/(\d)\s?m\/second/gi, '$1 m/s')    .replace(/(\d)\s?m\/sec/gi, '$1 m/s')    .replace(/(\d)\s?km\/sec/gi, '$1 km/s')    // Space before horsepower symbol    .replace(/(\d)\s?hp/gi, '$1 hp')    .replace(/(\d)\s?bhp/gi, '$1 bhp') .replace(/(\d)\s?shp/gi, '$1 shp') // miles per hour .replace(/m\.p\.h\./gi, 'mph') .replace(/mph([\s,\.:\)\(\\/)])/gi, 'mph$1')   .replace(/(\d)\s?mph/gi, '$1 mph')    .replace(/(\d)\-mph/gi, '$1 mph')    // Standardise symbol for pounds    .replace(/(\d)\s?lbs?/gi, '$1 lb')    .replace(/(\d\+?)\s?lbs?/gi, '$1 lb')    .replace(/(\d) lbs?/gi, '$1 lb')    .replace(/(\d)\s?(\[\[lbs\]\])/gi, '$1 \[\[Pound (mass)|lb\]\]')    // Standardise symbol for newton metres    //.replace(/(N•m)/gi, 'N·m')    // Standardise symbol for kilowatts    .replace(/(\d)\s?kW([\s,.:\)\(\\/)])/g, '$1 kW$2') .replace(/(\d)\-kW([\s,.:\)\(\\/)])/g, '$1 kW$2')   // Standardise symbol for foot pounds    .replace(/ft[ -.·•\/]lb[fs]/gi, 'ft·lbf')    .replace(/ft[ -.·•\/]lbf/gi, 'ft·lbf')    .replace(/ft[ -.·•\/]lbff/gi, 'ft·lbf')    .replace(/ft[ -.·•\/]lb\s/gi, 'ft·lbf ')    //the next two suspended until solution is found for wing loading (i.e. pounds per square foot)    //.replace(/lb[fs][ -.•\/]ft/gi, 'ft·lbf')    //.replace(/lb[ -.•\/]ft/gi, 'ft·lbf')    // Symbols for feet and inches    .replace(/([^°][^°]\s)(\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1$2 ft $3 in')    .replace(/([\(\|]\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1 ft $2 in') .replace(/(\d)\s?ft\s(\d)\s?in/gi, '$1 ft $2 in') .replace(/(\d)\s?feet/gi, '$1 feet') .replace(/(\d)\s?foot/gi, '$1 foot') .replace(/(\d)\s?knots/gi, '$1 knots') .replace(/(\d)\s?nmi/gi, '$1 nmi') .replace(/(\d)\s?nm/gi, '$1 nm') //Symbols for square feet .replace(/sq\.?\s?ft?/gi, 'sq ft') .replace(/ft\.\)/gi, 'ft)') // Give digital value a percent symbol '%' instead of word .replace(/(\d)\s?per ?cent([^aei])/gi, '$1%$2') .replace(/(\d)\-per ?cent([^aei])/gi, '$1%$2') // Add a space before dB   .replace(/(\d)\s?(dB)\b/g, '$1 $2') // Add a space before several units that were missed before //.replace(/(\d)\s?(G|M|k|K|h|da|d|c|m|µ|n)?(g|m|Hz|N|W|Pa|V|O|F|)([\s,.:\)\(\\/)])/g, '$1 $2$3$4')   // bps or b/s or bits/s --> bit/s    .replace(/([KkMmGg])(bps|bits?\/s|b\/s)/g, '$1bit/s')    .replace(/(\d)\s?(bps)/gi, '$1 bit/s')    // Bps or byte/s or bytes/s --> B/s    .replace(/([KkMmGg])(Bps|bytes?\/s)/g, ' $1B/s')    // Make capitalization correct    .replace(/K(bit|B)\/s/g, 'k$1/s')    .replace(/m(bit|B)\/s/g, 'M$1/s')    .replace(/g(bit|B)\/s/g, 'G$1/s')    // Ensure space is used    .replace(/(\d)\s?(k|M|G)(bit|B)/g, '$1 $2$3')    // Space before units    .replace(/(\d)\s?cc([\s,\.:\)\(\\/)])/gi, '$1 cc$2') .replace(/(\d)\-cc([\s,\.:\)\(\\/)])/gi, '$1 cc$2')   .replace(/(\d)\s?ft([\s,\.:\)\(\\/)])/gi, '$1 ft$2') .replace(/(\d)\-ft([\s,\.:\)\(\\/)])/gi, '$1 ft$2')   .replace(/(\d)\s?rpm\s/gi, '$1 rpm')    .replace(/(\d)\-rpm\s/gi, '$1 rpm')    .replace(/(\d)\s?kg([\s,\.:\)\(\\/)])/gi, '$1 kg$2') .replace(/(\d)\-kg([\s,\.:\)\(\\/)])/gi, '$1 kg$2')   //space before 'm' only when lower case    .replace(/(\d)\s?m([\s,\.:\)\(\\/)])/g, '$1 m$2') .replace(/(\d)\-m([\s,\.:\)\(\\/)])/g, '$1 m$2')   //.replace(/(\d)\s?ml([\s,\.:\)\(\\/)])/g, '$1 ml$2') //.replace(/(\d)\-ml([\s,\.:\)\(\\/)])/g, '$1 ml$2')   .replace(/(\d)\s?m(\W)/g, '$1 m$2')    .replace(/(\d)\s?m(\w?\W)/g, '$1 m$2');   // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- //    // Written by myself (AndyZ), from no specific script //   // random formatting issues from MoS                  //   // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- //      var cur_d = new Date, cur_m = (cur_d.getMonth + 1).toString; if(cur_m.length == 1) cur_m = '0' + cur_m; //month                            var cur_t = (cur_d.getDate).toString; if(cur_t.length == 1) cur_t = '0' + cur_t; //date   var cur_accessdate = '';   txt.value = txt.value   //MOSNUM more nbsp stuff    .replace(/(\d)\s?(|kilo|hecto|deca|deci|centi|milli|micro|nano)(meter|metre|liter|litre|gram|byte)(s?\W])/gi, '$1 $2$3$4')    .replace(/(\d)\s?(k|d|c|m|µ|µ|µ)(g|l|m)s?(\W)/gi, '$1 $2$3$4')    .replace(/(\d)\s?(inche?|foot|feet|yard|mile|acre|pound|ounce|ton|gallon|quart|pint|cup|angstrom)(s?\W)/gi, '$1 $2$3') .replace(/(\d)\s?(lb|ft|yd|mi|oz)s?(\W)/gi, '$1 $2$3') //MOSNUM, first ones are currency fixes .replace(/\$US(\d)/gi, 'US$$1') .replace(/(\W)EU€/gi, '$1€') //add leading zero to decimals .replace(/\s(\-?)\.(\d+)\s/g, ' $10.$2 ') //times fixing .replace(/\s(\d\d?)\s?(a|p)m\s/g, ' $1 $2.m. ') .replace(/\s(\d\d?)\s?AM\s/g, ' $1 a.m. ') .replace(/\s(\d\d?)\s?PM\s/g, ' $1 p.m. ') .replace(/\s(\d\d?)[\.:](\d\d)\s?(a|p)m\s/g, ' $1:$2 $3.m. ') .replace(/\s(\d\d?)[\.:](\d\d)\s?AM\s/g, ' $1:$2 a.m. ') .replace(/\s(\d\d?)[\.:](\d\d)\s?PM\s/g, ' $1:$2 p.m. ') .replace(/\s12\snoon(\W)/g, ' noon$1') //MOSDATE remove th in dates followed by -th, others .replace(/([^\[])(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d\d?)th/gi, '$1$2 $3') .replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d\d?)\]\]?th(<\/sup>)?/gi, '$1 $2') .replace(/(\D\d\d?)?th(<\/sup>)?\s(January|February|March|April|May|June|July|August|September|October|November|December)/gi, '$1 $4') .replace(/\s(\d{4})'s(\W)/gi, ' $1s$2') .replace(/the\s(January|February|March|April|May|June|July|August|September|October|November|December)\sof\s(\d{4})/gi, '$1 $2') .replace(/(January|February|March|April|May|June|July|August|September|October|November|December)\sof\s(\d{4})/gi, '$1 $2') .replace(/the\s(\d\d?)th\sof\s(January|February|March|April|May|June|July|August|September|October|November|December)/gi, '$2 $1') .replace(/(\d\dth\s)Century/g, '$1century') //MSH to fix captalization issues in headings .replace(/\n(={2,3})(\s?)See\sAlso\s?={2,3}/g, '\n$1$2See also$2$1') .replace(/\n(={2,3})(\s?)Further\sReading\s?={2,3}/g, '\n$1$2Further reading$2$1') .replace(/\n(={2,3})(\s?)Works\sCited\s?={2,3}/g, '\n$1$2Works cited$2$1') .replace(/\n(={2,3})(\s?)External\slink(s?)\s?={2,3}/g, '\n$1$2External link$3$2$1') .replace(/\n(={2,3})(\s?)Foot\s[Nn]otes\s?={2,3}/g, '\n$1$2Footnotes$2$1') //miscellaneous in headings (remove special characters) .replace(/\n(={2,4})(.*)\s&\s(.*)={2,4}/g, '\n$1$2 and $3$1') //dashes .replace(/&#x2012;/g, '-') .replace(/&#(x201[45]|151|8212);/g, '&mdash;') .replace(/&#(150|8211|x2013);/g, "–") //ellipses .replace(/\s(&hellip;|…)\s/g, ' $1 ') .replace(/\s\.\s\.\s\.\s/g, ' . . . ') .replace(/\s\.\.\.\s/g, ' ... ') //expand WP:PDATA, auto-fill in name blank .replace(/\{\{persondata\}\}/gi, '{{Persondata\n|NAME='+wgTitle.replace(/\s\(.*\)/,).substring(wgTitle.replace(/\s\(.*\)/,).lastIndexOf(' '),wgTitle.replace(/\s\(.*\)/,).length) + ', ' + wgTitle.replace(/\s\(.*\)/,).substring(0,wgTitle.replace(/\s\(.*\)/,'').lastIndexOf(' '))+'\n|ALTERNATIVE NAMES=\n|SHORT DESCRIPTION=\n|DATE OF BIRTH=\n|PLACE OF BIRTH=\n|DATE OF DEATH=\n|PLACE OF DEATH=\n}}') //spacing, XHTML .replace(/<([bh])r\s*\/?\s*>/gi, '<$1r />') .replace(/<(\/?)TABLE/g, '<$1table') .replace(/<(\/?)DIV/g, '<$1div') .replace(/<(\/?)SPAN/g, '<$1span') //Template:Cite web //TODO: !1! DD Month instead of Month DD, !2! accessed instead of retrieved //take care of news /*convert <ref( name=)?>[url.pdf title] <ref( name=)?>[url title (YYYY)].? <ref( name=)?>[url title] <ref( name=)?>[url] (w/o brackets) <ref( name=)?>url (w/o brackets) <ref( name=)?>[url title].? Retrieved on? YYYY-MM-DD.? <ref( name=)?>LAST, FIRST. [?url]? <ref( name=)?>LAST, FIRST. [url title] <ref( name=)?>FIRST LAST. [?url]? <ref( name=)?>FIRST LAST. [url title] <ref( name=)?>[url title] (?YYYY)?.? <ref( name=)?>LAST, FIRST (YYYY). [url title].? <ref( name=)?>LAST, FIRST. [url title].? (?YYYY)?.? <ref( name=)?>LAST, FIRST. [url title]. retrieved on? YYYY-MM-DD.? <ref( name=)?>LAST, FIRST (YYYY). [url title]. retrieved on? YYYY-MM-DD.? !2!    <ref( name=)?>LAST, FIRST. [url title]. retrieved on? Month DD, YYYY.? !1! !2!    <ref( name=)?>LAST, FIRST (YYYY). [url title]. retrieved Month DD, YYYY.? !1! !2!    <ref( name=)?>LAST, FIRST (YYYY). [url title]. retrieved on Month DD, YYYY.? !1! !2!    <ref( name=)?>LAST, FIRST MIDDLE. [url title].? <ref( name=)?>LAST, FIRST MIDDLE (YYYY). [url title].? <ref( name=)?> <ref( name=)?>LAST, FIRST. <ref( name=)?>LAST, FIRST. "".      <ref( name=)?>LAST, FIRST. "". [url] <ref( name=)?>[url title] (YYYY). retrieved on Month DD, YYYY. {{sup|[url]}} to Cite web format, respectively*/ .replace(/<ref(\sname=.+?)?>\s*\[?(http:\/\/[^\s]+?\.pdf)\]?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=INSERT TITLE|format=PDF'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[([^\s]+?\.pdf)\s([^\]]+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3|format=PDF'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[([^\[\]]+?)\s([^\]]+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[(.+?)\s([^\]]+?)\s\(\[{0,2}(\d{4})\]{0,2}\)\]\.?\s\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3|year=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[([^\s]+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=INSERT TITLE'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(http:\/\/[^\s]+?)\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=INSERT TITLE'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(\d{4}\-\d{1,2}\-\d{1,2})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3|accessdate=$6}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s\[?([^\s]+?)\]?\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=INSERT TITLE|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s\[([^\s]+?)\s([^\]]+?)\]\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=$5|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\s(\w+)\.\s\[?([^\s]+?)\]?\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=INSERT TITLE|last=$3|first=$2'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\s(\w+)\.\s\[?(http:\/\/.+?)\s(.+?)\]?\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=$5|last=$3|first=$2'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*\[(.+?)\s([^\]]+?)\]\.?\s\(?\[{0,2}(\d{4})\]{0,2}\)?\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3|year=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\s\(\[{0,2}(\d{4})\]{0,2}\)\.\s\[([^\s]+?)\s([^\]]+?)\]\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|year=$4'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s\[([^\s]+?)\s([^\]]+?)\]\.?\s\(?\[{0,2}(\d{4})\]{0,2}\)?\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|year=$4'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(\d{4}\-\d{1,2}\-\d{1,2})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=$5|last=$2|first=$3|accessdate=$8}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\s\(\[{0,2}(\d{4})\]{0,2}\)\.\s\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(\d{4}\-\d{1,2}\-\d{1,2})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|accessdate=$9|year=$4}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s\[([^\s]+?)\s([^\]]+?)\][\.\,]?\sretrieved\s(on\s)?\[{0,2}(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d{1,2})\]{0,2}\,?\s\[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=$5|last=$2|first=$3|accessmonthday=$7 $8|accessyear=$9}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\s\((\d{4})\)\.\s\[([^\s]+?)\s([^\]]+?)\][\.\,]?\sretrieved\s\[{0,2}(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d{1,2})\]{0,2}\,?\s\[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|accessmonthday=$7 $8|accessyear=$9|year=$4}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\s\((\d{4})\)\.\s\[([^\s]+?)\s([^\]]+?)\][\.\,]?\sretrieved\son\s\[{0,2}(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d{1,2})\]{0,2}\,?\s\[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|accessmonthday=$7 $8|accessyear=$9|year=$4}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+\.?\s\w+)\.\s\[([^\s]+?)\s([^\]]+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=$5|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+\.?\s\w+)\s\(\[{0,2}(\d{4})\]{0,2}\)\.\s\[([^\s]+?)\s([^\]]+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$6|last=$2|first=$3|year=$4'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*<(http:\/\/.+?)>\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=INSERT TITLE'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s<(http:\/\/.+?)>\s*<\/ref>/gi, '<ref$1>{{cite web|url=$4|title=INSERT TITLE|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s"(.+?)"\.?\s<(http:\/\/.+?)>\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$4|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/<ref(\sname=.+?)?>\s*(\w+)\,\s(\w+)\.\s"(.+?)"\.?\s\[(http:\/\/.+?)\]\s*<\/ref>/gi, '<ref$1>{{cite web|url=$5|title=$4|last=$2|first=$3'+cur_accessdate+'}} ') .replace(/ \[(http:\/\/.+?)\]<\/sup>/gi, ' ') .replace(/<ref(\sname=.+?)?>\s*\[([^\s]+?)\s([^\]]+?)\]\s\(\[{0,2}(\d{4})\]{0,2}\)[\.\,]\sretrieved\s(on\s)?\[{0,2}(January|February|March|April|May|June|July|August|September|October|November|December)\s(\d{1,2})\]{0,2}\,\s\[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, '<ref$1>{{cite web|url=$2|title=$3|accessmonthday=$6 $7|accessyear=$8|year=$4}} ') //replace "|url=|title=INSERT TITLE" with url doubled .replace(/\|url=(http:\/\/)(.+?)\|title=INSERT\sTITLE/g, '|url=$1$2|title=$2<'+'!'+'--INSERT TITLE--'+'>') //miscellaneous, minor, obvious, or not explicitly stated in style guidelines //replace w/ main article template, minor .replace(/\{\{main\s?article\|/gi, '{{main|') .replace(/\[\[User:AndyZ\/peerreviewer\.js([\]\|])/gi, 'User:AndyZ/peerreviewer$1');  //continue replacing more complex versions to Template:Cite web    //array for converting: in style: <ref( name=)?>[url title].? Retrieved on? [[?month DD?, ?YYYY?.? to Cite web format    var cw_retrieval = new Array(    /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Jan(uary|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi,    /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Feb(ruary|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi,    /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Mar(ch|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi,    /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Apr(il|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(May(\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Jun(e|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Jul(y|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Aug(ust|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Sept?(ember|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Oct(ober|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Nov(ember|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi, /<ref(\sname=.+?)?>\[([^\s]+?)\s([^\]]+?)\][\.\,]?\s(retrieved|accessed|reached)\s(on\s)?\[{0,2}(Dec(ember|\.)?)\s(\d{1,2})\]{0,2}, \[{0,2}(\d{4})\]{0,2}\.?\s*<\/ref>/gi);   for(i=0;i<12;i++) txt.value = txt.value.replace(cw_retrieval[i],'<ref$1>{{cite web|url=$2|title=$3|accessmonthday=$6 $8|accessyear=$9}} ');   // spell checker, based on WP:SPELL: (requires ajax) !!!    if(!noXHR_PR){}   //contractions (be careful!)    if(expandContractions_PR){     txt.value = txt.value     .replace(/(could|did|do|does|had|has|have|is|might|must|should|was|were|would)n't/gi, '$1 not')     .replace(/can't/gi, 'cannot').replace(/won't/gi, 'will not')     .replace(/(could|might|must|should|would)'ve/gi, '$1 have')     .replace(/(\WI|you|he|she|it|we|they|that|who|what|where|when|why|how)'ll/gi, '$1 will')       .replace(/(\WI|you|he|she|it|we|they|that|who|what|where|when|why|how)'d/gi, '$1 had') }  // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* //    // from WikiProject User scripts/Scripts/Formatter // // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* //    txt.value = txt.value               //whitespace .replace(/\t/g, " ") .replace(/^ ? ? \n/gm, "\n") .replace(/(\n\n)\n+/g, "$1") .replace(/== ? ?\n\n==/g, "==\n==") .replace(/\n\n(\* ?\[?http)/g, "\n$1") .replace(/^ ? ? \n/gm, "\n") .replace(/\n\n\*/g, "\n*") .replace(/[ \t][ \t]+/g, " ") .replace(/([=\n]\n)\n+/g, "$1") .replace(/ \n/g, "\n")             //ending sections .replace(/(== ?)(external links:?|outside links|web ?links:?|exterior links:?)( ?==)/gi, "$1External links$3") .replace(/(== ?)(external link:?|web ?link:?|exterior link:?)( ?==)/gi, "$1External link$3") .replace(/(== ?)(reference:?)(s? ?==)/gi, "$1Reference$3") .replace(/(== ?)(source:?)(s? ?==)/gi, "$1Source$3") .replace(/(== ?)(further readings?:?)( ?==)/gi, "$1Further reading$3") .replace(/\[\[ ?[Cc]ategory ?: ?/g, "[[Category:") //categories    //repair bad internal links    .replace(/([^\[]|^)\[?\[([^\]]*?)\]\]?([^\]]|$)/gm, "$1$2$3") .replace(/\[\[ ?([^\]]*?) ?\]\]/g, "$1") .replace(/\[\[([^\]]*?)( |_)#([^\]]*?)\]\]/g, "$1") //repair bad external links .replace(/\[?\[http:\/\/([^\]]*?)\]\]?/gi, "[http://$1]") .replace(/\[http:\/\/([^\]]*?)\|([^\]]*?)\]/gi, "[http://$1 $2]") .replace(/\[\[([^\]\|]+)\|([^\]\|]+)\]\]([A-Za-z\'][A-Za-z]*)([\.\,\;\:\"\!\?\s\n])/g, "$2$3$4");  // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*- // for full documentation, see   // FROM User:Gimmetrow/replace.js //  User:Gimmetrow/fixRefs.js   // *-*-*-*-*-*-*-*-*-*-*-*-*-*-*- //     txt.value = txt.value    .replace(new RegExp("[\n\r\f\t ]+?"+facttags, "gi"), "$1")    .replace(new RegExp("[\n\r\f\t ]+?<ref([ >])", "gi"), "<ref$1")    .replace(new RegExp(" |<ref[^>]*?/>){{sup|[ ]*[,;-]?[ ]*}}<ref", "gi"), "$1<ref");    for (var j=0; j<10; j++){      txt.value = txt.value.replace(new RegExp("([^\.,;:!\?"+qt+"'’])([" + qt + "'’]*)"+facttags+"[ ]*([\.,;:!\?])", "gi"), "$1$2$4$3")      .replace(new RegExp("([!\?])([" + qt + "'’]*)"+facttags+"[ ]*([,;:!\?])", "gi"), "$1$2$4$3")      .replace(new RegExp("([\.,;:])([" + qt + "'’]*)"+facttags+"[ ]*([\.,;:!\?])", "gi"), "$2$4$3")      .replace(new RegExp("([!\?])([" + qt + "'’]*)"+facttags+"[ ]*([\.])", "gi"), "$1$2$3") .replace(new RegExp("([^\.,;:!\?"+qt+"'’])([" + qt + "'’]*) ")     .replace(new RegExp("([!\?])([" + qt + "'’]*) ") .replace(new RegExp("([\.,;:])([" + qt + "'’]*) ")     .replace(new RegExp("([!\?])([" + qt + "'’]*) ") .replace(new RegExp("([^\.,;:!\?"+qt+"'’])([" + qt + "'’]*)<ref([^>]*?[^/])>"+closetag+"[ ]*([\.,;:!\?])", "gi"), "$1$2$6<ref$3>$4<\/ref>") .replace(new RegExp("([!\?])([" + qt + "'’]*)<ref([^>]*?[^/])>"+closetag+"[ ]*([,;:!\?])", "gi"), "$1$2$6<ref$3>$4<\/ref>") .replace(new RegExp("([\.,;:])([" + qt + "'’]*)<ref([^>]*?[^/])>"+closetag+"[ ]*([\.,;:!\?])", "gi"), "$2$6<ref$3>$4<\/ref>") .replace(new RegExp("([!\?])([" + qt + "'’]*)<ref([^>]*?[^/])>"+closetag+"[ ]*([\.])", "gi"), "$1$2<ref$3>$4<\/ref>") .replace(new RegExp("([^\.,;:!\?"+qt+"'’])([" + qt + "'’]*)<ref([^>]*?)/> *?([\.,;:!\?])", "gi"), "$1$2$4<ref$3/>") .replace(new RegExp("([!\?])([" + qt + "'’]*)<ref([^>]*?)/>[ ]*?([,;:!\?])", "gi"), "$1$2$4<ref$3/>") .replace(new RegExp("([\.,;:])([" + qt + "'’]*)<ref([^>]*?)/>[ ]*?([\.,;:!\?])", "gi"), "$2$4<ref$3/>") .replace(new RegExp("([!\?])([" + qt + "'’]*)<ref([^>]*?)/>[ ]*?([\.])", "gi"), "$1$2<ref$3/>"); }   var summary_txt = document.editform.wpSummary, summary = "JS: fixing MoS and other miscellaneous style problems"; if (summary_txt.value.indexOf(summary) == -1) { if (summary_txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) summary_txt.value += " | "; summary_txt.value += summary; }	document.getElementById('wpDiff').click;	//click "View changes" button } // ENDFILE: mos.js // *-*-*-*-*-*-*-*-*-*-*-*-*- // // Comments and closing notes // // *-*-*-*-*-*-*-*-*-*-*-*-*- // // TO DO list                // // *-*-*-*-*-*-*-*-*-*-*-*-*- // /* List of things to do: // Determine the usage of commas with dates                   -- // Determine if conversions are included                      -- //- not necessary to check - Determine if extraneous bolding is used //- not able to do (w/ JS): Determine if quotes have sources (due to huge amounts of ""s) // Prove that images have proper image copyright tags // Show that all fair use images have proper fair use rationales //- not able to do (w/ JS): Determine if sections or paragraphs are too short, outside of {{sect-stub}} or {{sectionexpand}}, etc. //- not able to do (w/ JS): Determine if a list is used //- not able to do (w/ JS): Determine if words in headings are capitalized // Find common redunancies //  *"in order to/for" -> to/for // Check w/ U:SUGG to see if any other things are missing // Help out with WP:FL, maybe even WP:FPO? // simple links for easy copy+paste into sandboxes, talk pages, or WP:PR/A -- //- not important - improving look // embedding solutions beneath text, possibly (using innerHTML, etc., property) -- // more configurable options that will be helpful to users Second priority issues: // Add to/cleanup list of units (for units, conversions, and standard abbreviations) // Add to/subtract from list of weasel words // More infoboxes /////////////////////////////////////////////////   // Note: // I am quite aware // that the layout and documentation // of my coding is pretty terrible; // feel free to edit this page // and help clean it up    //  (for non-admins, leave note on talk page) // -- -- --    // Please be aware that changes // may affect many users // AS OF LAST COUNT: 182 users use this script ///////////////////////////////////////////////// // //cut out code can be found at User:AndyZ/peerreviewer.js/comment

toolbarLink_PR = true;

importScript('User:Lupin/recent2.js');

importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool