User:Ravedave/peerreviewer.js

/* Semi-automatic javascript peer reviewer - note that this is NOT a WP:BOT (but it may be a semi-bot) */

/* My personal redirect: U:JPR */

/* // Adding User:AndyZ/peerreviewer.js to your /monobook.js will create a "peer review" link next to the "log out" link; onclicking, it creates a layer with suggestions in User:AndyZ/PR template form.

/*List of things to do: // Determine the usage of commas with dates // Determine the length of a lead (number of paragraphs) // Figure out if the lead is too short (1 paragraph) or too long (>=4 paragraphs), depending upon size of article // Determine if no-break spaces are used // Determine if conversions are included // Determine if standard abbreviations are used for conversions // Determine if units are spelled out in text // Determine if last few sections (see also, references, notes, external links) follow WP:GTL // Determine if extraneous bolding is used // Determine if categories and interlanguage links are alphabetized // Determine if quotes have sources // Prove that images have proper image copyright tags // Show that all fair use images have proper fair use rationales // Determine if all images have captions // Find out the number of sections // Determine if sections or paragraphs are too short // Determine if a list is used // Determine if footnote spacing standards are used (as in WP:FOOTNOTE) // Determine if words in headings are capitalized // Find common redunancies // Time/future issues // Check w/ U:SUGG to see if any other things are missing // Automatic archiving // Improving efficiency

Second priority issues: // Add to list of units (for units, conversions, and standard abbreviations) // Add to list of weasel words // Improve the headingre function to exclude "the" and words in parentheses // infoboxes...

// start code

function review1{ //theText is the variable for the text of a document theText = document.editform.wpTextbox1.value

theTitle = document.location.href

if(theTitle.indexOf("section=")!=-1){ theTitle = document.location.href.substring(42,document.location.href.length-22) } else{ theTitle = document.location.href.substring(42,document.location.href.length-12) }

theTitle2 = theTitle.replace(/\_/gi," ")

theTitle = theTitle.replace(/\D27/gi,"'") theTitle = theTitle.replace(/\D28/gi,"(") theTitle = theTitle.replace(/\D29/gi,")") theTitle = theTitle.replace(/\D2C/g,",") theTitle = theTitle.replace(/\_/gi," ")

document.theForm.theResponse.value = "==="+theTitle+"===\n"+document.theForm.theResponse.value

//lead stuff //determine the number of paragraphs in the lead

theTextlead = theText longstring = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" for(i=0;i<150;i++){ longstring+="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } theTextlead = theTextlead.replace(/==/,longstring) theTextlead = theTextlead.substring(0,7200) newLine = /\n[A-Z]/g if(newLine.test(theTextlead)){ NumPara = theTextlead.match(newLine) theLength = theText.length theNumPara = NumPara.length theNumPara++ } else{ theNumPara=1 } if(theNumPara==1){ document.theForm.theResponse.value+="\n" } if((theNumPara==2)&&(theLength>=30000)){ document.theForm.theResponse.value+="\n" } if((theNumPara==3)&&(theLength<=15000)){ document.theForm.theResponse.value+="\n" } if((theNumPara==4)&&(theLength<=30000)){ document.theForm.theResponse.value+="\n" } if(theNumPara>=5){ document.theForm.theResponse.value+="\n" document.theForm.theResponse.value+="\n" }

//checks linking in comparison to # of words words = theText.split(" "); links = theText.split("[["); if(.03 * words.length >= links.length)	document.theForm.theResponse.value+="\n"; else if(.1* words.length <= links.length)	document.theForm.theResponse.value+="\n";

//checks if document follows WP:CONTEXT guidelines regExContxt = /[^,\]]\s\[\[\d{4}\]\]/gi contxt = regExContxt.test(theText) if (contxt==true){document.theForm.theResponse.value+="\n"} if (contxt==false){ //days of the week mon= /\[\[Monday\]\]/gi tue = /\[\[Tuesday\]\]/gi wed = /\[\[Wednesday\]\]/gi thu = /\[\[Thursday\]\]/gi fri= /\[\[Friday\]\]/gi sat= /\[\[Saturday\]\]/gi sun= /\[\[Sunday\]\]/gi

//months jan= /\[\[January\]\]/gi feb= /\[\[February\]\]/gi mar= /\[\[March\]\]/gi apr= /\[\[April\]\]/gi may= /\[\[May\]\]/gi jun= /\[\[June\]\]/gi jul= /\[\[July\]\]/gi aug= /\[\[August\]\]/gi sep= /\[\[September\]\]/gi oct= /\[\[October\]\]/gi nov= /\[\[November\]\]/gi dec= /\[\[December\]\]/gi

if(mon.test(theText) || mon.test(theText) || tue.test(theText) || wed.test(theText) || thu.test(theText) || fri.test(theText) || sat.test(theText) || sun.test(theText) || jan.test(theText) || feb.test(theText) || mar.test(theText) || apr.test(theText) || may.test(theText) || jun.test(theText) || jul.test(theText) || aug.test(theText) || sep.test(theText) || oct.test(theText) || nov.test(theText) || dec.test(theText)){ document.theForm.theResponse.value+="\n" } }

//about WP:MOS var mostime = new Array var mostime2 = new Array mostimestring = "" goodmostime = true mostime[0] = /recently/gi mostime2[0] = "recently" mostime[1] = /last month.[^o]/gi mostime2[1] = "last month" mostime[2] = /last year.[^o]/gi mostime2[2] = "last year" mostime[3] = /yesterday/gi mostime2[3] = "yesterday" mostime[4] = /\.\ssoon/gi mostime2[4] = "soon" mostime[5] = /last week.[^o]/gi mostime2[5] = "last week" mostime[6] = /previous (month|year|day|week)/gi mostime2[6] = "previous [day/week/month/year]" mostime[7] = /(\.\s|\n)next (week|month|year)/gi mostime2[7] = "next [week/month/year]"

for(t=0;t<mostime.length;t++){ if(mostime[t].test(theText)){ goodmostime = false mostimestring = mostimestring+"|"+mostime2[t] } }

if(goodmostime==false){ document.theForm.theResponse.value+="\n" }

//searches for images regExImg = /\[\[Image/gi regExImg2 = /\[\[image/gi thereisanimage = regExImg.test(theText) if(thereisanimage==false){ thereisanimage=regExImg2.test(theText) if(thereisanimage==false){ document.theForm.theResponse.value+="\n" } }

//sees if lead image exists (may not be accurate if template is at front if((theText.substring(0,7)=="[[Image")||(theText.substring(0,6)=="[[image")||(theText.substring(0,2)=="{{")||(theText.substring(0,2)=="<!")||(theText.substring(0,3)==":''")){} else{ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/leadimg}} " }

var imgcap = new Array nocap = false imgcap[0] = /\d{2}px\]\]/i imgcap[1] = /\|none\]\]/i imgcap[2] = /\|left\]\]/i imgcap[3] = /\|center\]\]/i imgcap[4] = /\|right\]\]/i imgcap[5] = /\|thumb\]\]/i imgcap[6] = /\|thumbnail\]\]/i imgcap[7] = /\|frame\]\]/i imgcap[8] = /\.jpg\]\]/i imgcap[9] = /\.png\]\]/i imgcap[10] = /\.svg\]\]/i for(i=0;i<imgcap.length;i++){ if(imgcap[i].test(theText)){ nocap = true } } if(nocap==true){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/caption}}" }

//imgtest

//searches for infobox infobox = /\{\{infobox/gi infobox2 = /\{\{taxobox/gi infobox3 = /\{\{.{1,}infobox(\s|)\|/gi infobox4 = /\{\{[^or]/i if(!(infobox.test(theText) || infobox2.test(theText) || infobox3.test(theText) || infobox4.test(theText.substring(0,200)))){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/infobox}} (Note that there might not be an applicable infobox; remember that these suggestions are not generated manually)" }

//searches for {{persondata}} catbirth = /\[\[Category\:\d{1,}\s(BC\s|)births/gi catdeath = /\[\[Category\:\d{1,}\s(BC\s|)deaths/gi infobio = /\{\{Infobox(\_|\s)(biography|philosopher|Military\sPerson)/gi persondata = /\{\{persondata/gi

if((catbirth.test(theText) || catdeath.test(theText) || infobio.test(theText)) && (!persondata.test(theText))){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/persondata}}" }

//WP:MOSNUM and WP:MOSDATE: //nbsp checker: distances

km = /\d(\s|)(km|kilometer|kilometre)/gi mi = /\d(\s|)(mi[\s\)]|mile)/gi ft = /\d(\s|)(ft|foot|feet)/gi yd = /\d(\s|)(yd|yard)/gi //in = /\d(\s|)in/gi inch = /\d(\s|)in(ch|ches|\s)/gi cm = /\d(\s|)(cm|centi)/gi dm = /\d(\s|)(dm|decim)/gi nm = /\d(\s|)(nm|nano)/gi

//weights/mass lb = /\d(\s|)(lb|pound)/gi ton = /\d(\s|)ton[s\s]/gi mton = /\d(\s|)(metric ton)/gi gram = /\d(\s|)(g\s|gram|g\))/gi

//area sqin = /\d(\s|)(in 2<\/sup>|squared inches)/gi sqft = /\d(\s|)(ft 2<\/sup>|squared feet)/gi sqmt = /\d(\s|)(m 2<\/sup>|squared meter)/gi sqkm = /\d(\s|)(km 2<\/sup>|squared kilo)/gi sqcm = /\d(\s|)(cm 2<\/sup>|squared centi)/gi sqmi = /\d(\s|)(mi 2<\/sup>|squared mile)/gi

//volume cuin = /\d(\s|)(in 3<\/sup>|cubic inch)/gi cuft = /\d(\s|)(ft 3<\/sup>|cubic feet)/gi cumt = /\d(\s|)(m 3<\/sup>|cubic meter)/gi cukm = /\d(\s|)(km 3<\/sup>|cubic kilo)/gi cucm = /\d(\s|)(cm 3<\/sup>|cubic centi)/gi cumi = /\d(\s|)(mi 3<\/sup>|cubic mile)/gi

if(km.test(theText) || mi.test(theText) || ft.test(theText) || yd.test(theText) || cm.test(theText) || nm.test(theText) || inch.test(theText) || dm.test(theText) || lb.test(theText) || ton.test(theText) || gram.test(theText) || mton.test(theText) || sqin.test(theText) || sqft.test(theText) || sqmt.test(theText) || sqkm.test(theText) || sqcm.test(theText) || sqmi.test(theText) || cuin.test(theText) || cuft.test(theText) || cumt.test(theText) || cukm.test(theText) || cucm.test(theText) || cumi.test(theText)){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/nbsp}}" }

//checks for usage of standard abbreviations in parentheses (for conversions) kmSA = /(kilometer|kilometer|kilometers|kilometres)\)/gi miSA = /mile(s|)\)/gi ftSA = /(foot|feet)\)/gi ydSA = /yard(s|)\)/gi inchSA = /(inch|inches)\)/gi cmSA = /centimeter(s|)\)/gi dmSA = /decimeter(s|)\)/gi nmSA = /nanometer(s|)\)/gi

//weights/mass lbSA = /(pound|pounds)\)/gi gramSA = /(gram|grams)\)/gi kgSA = /(kilogram|kilograms)\)/gi

//area sqinSA = /squared inch(es|)\)/gi sqftSA = /squared feet\)/gi sqmtSA = /squared meter(s|)\)/gi sqkmSA = /squared (kilometer|kilometer|kilometers|kilometres)\)/gi sqcmSA = /squared centimeter(s|)\)/gi sqmiSA = /squared mile(s|)\)/gi

//volume cuinSA = /cubic inch(es|)\)/gi cuftSA = /cubic (foot|feet)\)/gi cumtSA = /cubic meter(s|)\)/gi cukmSA = /cubic kilometer(s|)\)/gi cucmSA = /cubic centimeter(s|)\)/gi cumiSA = /cubic mile(s|)\)/gi

if(kmSA.test(theText) || miSA.test(theText) || ftSA.test(theText) || ydSA.test(theText) || cmSA.test(theText) || nmSA.test(theText) || inchSA.test(theText) || dmSA.test(theText) || lbSA.test(theText) || gramSA.test(theText) || kgSA.test(theText) || sqinSA.test(theText) || sqftSA.test(theText) || sqmtSA.test(theText) || sqkmSA.test(theText) || sqcmSA.test(theText) || sqmiSA.test(theText) || cuinSA.test(theText) || cuftSA.test(theText) || cumtSA.test(theText) || cukmSA.test(theText) || cucmSA.test(theText) || cumiSA.test(theText)){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/abbrev}}" }

//checks that units are spelled out in text kmSN = /km\s/gi miSN = /\smi\s/gi ftSN = /\sft\s/gi ydSN = /yd\s/gi cmSN = /cm\s/gi dmSN = /dm\s/gi nmSN = /nm\s/gi

//weights/mass lbSN = /\slb\s/gi gramSN = /\d\sg\s/gi kgSN = /kg\s/gi

//area sqinSN = /in 2<\/sup>\s/gi sqftSN = /ft 2<\/sup>\s/gi sqmtSN = /m 2<\/sup>\s/gi sqkmSN = /km 2<\/sup>\s/gi sqcmSN = /cm 2<\/sup>\s/gi sqmiSN = /mi 2<\/sup>\s/gi

//volume cuinSN = /in 3<\/sup>\s/gi cuftSN = /ft 3<\/sup>\s/gi cumtSN = /mt 3<\/sup>\s/gi cukmSN = /km 3<\/sup>\s/gi cucmSN = /cm 3<\/sup>\s/gi cumiSN = /mi 3<\/sup>\s/gi

if(kmSN.test(theText) || miSN.test(theText) || ftSN.test(theText) || ydSN.test(theText) || cmSN.test(theText) || nmSN.test(theText) || dmSN.test(theText) || lbSN.test(theText) || gramSN.test(theText) || kgSN.test(theText) || sqinSN.test(theText) || sqftSN.test(theText) || sqmtSN.test(theText) || sqkmSN.test(theText) || sqcmSN.test(theText) || sqmiSN.test(theText) || cuinSN.test(theText) || cuftSN.test(theText) || cumtSN.test(theText) || cukmSN.test(theText) || cucmSN.test(theText) || cumiSN.test(theText)){ document.theForm.theResponse.value+="\n{{subst:User:AndyZ/PR/spellnum}}" }

//checks for usage of standard abbreviations in parentheses (for conversions) kmSN2 = /kms(\s|\))/gi miSN2 = /mis(\s|\))/gi ftSN2 = /\sfts(\s|\))/gi ydSN2 = /yds(\s|\))/gi inchSN2 = /\sins(\s|\))/gi cmSN2 = /cms(\s|\))/gi dmSN2 = /dms(\s|\))/gi nmSN2 = /nms(\s|\))/gi

//weights/mass lbSN2 = /lbs(\s|\))/gi gramSN2 = /\sgs(\s|\))/gi kgSN2 = /kgs(\s|\))/gi

if(kmSN2.test(theText) || miSN2.test(theText) || ftSN2.test(theText) || ydSN2.test(theText) || cmSN2.test(theText) || nmSN2.test(theText) || inchSN2.test(theText) || dmSN2.test(theText) || lbSN2.test(theText) || gramSN2.test(theText) || kgSN2.test(theText)){ document.theForm.theResponse.value+="\n*When writing standard abbreviations, the abbreviations should not have a 's' to demark plurality (change kms to km and lbs to lb)." }

/* km2 = /\d(\s|)(km|kilometer|kilometre)[^\}\s][^\(]/gi mi2 = /\d(\s|)(mi|mile)[^\}\s][^\(]/gi ft2 = /\d(\s|)(ft|foot|feet)[^\}\s][^\(]/gi yd2 = /\d(\s|)(yd|yard)[^\}\s][^\(]/gi //in2 = /\d(\s|)in[^\}\s][^\(]/gi inch2 = /\d(\s|)in[^\}\s][^\(]/gi cm2 = /\d(\s|)(cm|centi)[^\}\s][^\(]/gi dm2 = /\d(\s|)(dm|decim)[^\}\s][^\(]/gi nm2 = /\d(\s|)(nm|nano)[^\}\s][^\(]/gi

//weights/mass lb2 = /\d(\s|)(lb|pound)[^\}\s][^\(]/gi ton2 = /\d(\s|)(ton)[^\}\s][^\(]/gi mton2 = /\d(\s|)(metric ton)[^\}\s][^\(]/gi gram2 = /\d(\s|)(g\s|gram|g\))[^\}\s][^\(]/gi

//area sqin2 = /\d(\s|)(in 2<\/sup>|squared inches)[^\}\s][^\(]/gi sqft2 = /\d(\s|)(ft 2<\/sup>|squared feet)[^\}\s][^\(]/gi sqmt2 = /\d(\s|)(m 2<\/sup>|squared meter)[^\}\s][^\(]/gi sqkm2 = /\d(\s|)(km 2<\/sup>|squared kilo)[^\}\s][^\(]/gi sqcm2 = /\d(\s|)(cm 2<\/sup>|squared centi)[^\}\s][^\(]/gi sqmi2 = /\d(\s|)(mi 2<\/sup>|squared mile)[^\}\s][^\(]/gi

//volume cuin2 = /\d(\s|)(in 3<\/sup>|cubic inch)[^\}\s][^\(]/gi cuft2 = /\d(\s|)(ft 3<\/sup>|cubic feet)[^\}\s][^\(]/gi cumt2 = /\d(\s|)(m 3<\/sup>|cubic meter)[^\}\s][^\(]/gi cukm2 = /\d(\s|)(km 3<\/sup>|cubic kilo)[^\}\s][^\(]/gi cucm2 = /\d(\s|)(cm 3<\/sup>|cubic centi)[^\}\s][^\(]/gi cumi2 = /\d(\s|)(mi 3<\/sup>|cubic mile)[^\}\s][^\(]/gi

if(km2.test(theText) || mi2.test(theText) || ft2.test(theText) || yd2.test(theText) || cm2.test(theText) || nm2.test(theText) || inch2.test(theText) || dm2.test(theText) || lb2.test(theText) || ton2.test(theText) || gram2.test(theText) || mton2.test(theText) || sqin2.test(theText) || sqft2.test(theText) || sqmt2.test(theText) || sqkm2.test(theText) || sqcm2.test(theText) || sqmi2.test(theText) || cuin2.test(theText) || cuft2.test(theText) || cumt2.test(theText) || cukm2.test(theText) || cucm2.test(theText) || cumi2.test(theText)){ document.theForm.theResponse.value+="\n" }

//looks for unlinked dates jan2= /\sJanuary\s(\d)(\d|)\D/gi feb2= /\sFebruary\s(\d)(\d|)\D/gi mar2= /\sMarch\s(\d)(\d|)\D/gi apr2= /\sApril\s(\d)(\d|)\D/gi may2= /\sMay\s(\d)(\d|)\D/gi jun2= /\sJune\s(\d)(\d|)\D/gi jul2= /\sJuly\s(\d)(\d|)\D/gi aug2= /\sAugust\s(\d)(\d|)\D/gi sep2= /\sSeptember\s(\d)(\d|)\D/gi oct2= /\sOctober\s(\d)(\d|)\D/gi nov2= /\sNovember\s(\d)(\d|)\D/gi dec2= /\sDecember\s(\d)(\d|)\D/gi if(jan2.test(theText) || feb2.test(theText) || mar2.test(theText) || apr2.test(theText) || may2.test(theText) || jun2.test(theText) || jul2.test(theText) || aug2.test(theText) || sep2.test(theText) || oct2.test(theText) || nov2.test(theText) || dec2.test(theText)){ document.theForm.theResponse.value+="\n" }

//date-th dateth = /(january|february|march|april|may|june|july|august|september|october|november|december)\s\d(\d|)(th|st|nd|rd)/gi dateth1 = /\[\[(january|february|march|april|may|june|july|august|september|october|november|december)\s\d(\d|)\]\](th|st|nd|rd)/gi dateth2 = /(january|february|march|april|may|june|july|august|september|october|november|december)\s\d(\d|) (th|st|nd|rd)<\/sup>/gi dateth2 = /\[\[(january|february|march|april|may|june|july|august|september|october|november|december)\s\d(\d|)\]\] (th|st|nd|rd)<\/sup>/gi dateth3 = /\d(\d|) (th|st|nd|rd)<\/sup>\s(of\s|)(january|february|march|april|may|june|july|august|september|october|november|december)/gi dateth4 = /\d(\d|)(th|st|nd|rd)\s(january|february|march|april|may|june|july|august|september|october|november|december)/gi if(dateth.test(theText) || dateth1.test(theText) || dateth2.test(theText) || dateth3.test(theText) || dateth4.test(theText)){ document.theForm.theResponse.value+="\n" }

//checks for correct MOS heading styles //occurence of "the" at beginning if(theText.indexOf("==The ")!= -1 || theText.indexOf("== The ")!= -1) document.theForm.theResponse.value+="\n"

//existence of link in heading headinglink1 = /==.{0,}\[\[.{1,}\]\].{0,}==/gi if(headinglink1.test(theText)){ document.theForm.theResponse.value+="\n" }

//sets variable thePRTitle equal to the title of the article thePRTitle = document.location.href.substring(42,document.location.href.length-12) thePRTitle = thePRTitle.replace(/_/g," ")

//checks if title is repeated in headings

var regHeadingRe = new RegExp("==.{0,}"+thePRTitle+".{0,}==","gi") if(regHeadingRe.test(theText)){ document.theForm.theResponse.value+="\n" }

//looks for ==trivia==, ==other facts==, ==miscellaneous==, etc. triv = /==(\s|)Trivia==/gi triv2 = /==(\s|)Other f/gi triv3 = /==(\s|)Miscellaneous/gi triv4 = /==(\s|)Interesting/gi if(triv.test(theText) || triv2.test(theText) || triv3.test(theText) || triv4.test(theText)){ document.theForm.theResponse.value+="\n" }

//double checks if last sections follow WP:GTL in terms of order (see also - references - external links)

isgtl = true

seealso = "==See also" extlink = "External link"

var Refsection = new Array Refsection[0] = "==Reference" Refsection[1] = "==Source" Refsection[2] = "==Footnote" Refsection[3] = "==Cit" Refsection[4] = "==Note"

Refsection[5] = "==Reference" Refsection[6] = "==Source" Refsection[7] = "==Footnote" Refsection[8] = "==Cit" Refsection[9] = "==Note"

Refsection[10] = "== Reference" Refsection[11] = "== Source" Refsection[12] = "== Footnote" Refsection[13] = "== Cit" Refsection[14] = "== Note"

Refsection[15] = "== Reference" Refsection[16] = "== Source" Refsection[17] = "== Footnote" Refsection[18] = "== Cit" Refsection[19] = "== Note"

if(theText.indexOf(seealso)==-1){ if(theText.indexOf("== See also")!=-1){ seealso = "== See also" } }

if((theText.indexOf(seealso)>theText.indexOf(extlink)) && (theText.indexOf(extlink)!=-1)){ isgtl = false } for(i=0;itheText.indexOf(Refsection[i])) && (theText.indexOf(Refsection[i])!=-1)){ isgtl = false } if((theText.indexOf(extlink)<theText.indexOf(Refsection[i])) && (theText.indexOf(extlink)!=-1)){ isgtl = false } }

if(isgtl==false){ document.theForm.theResponse.value+="\n" }

//looks for section named "List of..." list = /==(\s|)List/gi if(list.test(theText)){ document.theForm.theResponse.value+="\n" }

//Checks if categories are in alphabetical order cat1 = /\[\[Category:.{1,}\]\]/gi alphed = true if(cat1.test(theText)){ theCats = theText.match(cat1) //moves categories to lower case for(i=0;itheCats[i]){} else{ alphed = false } } } else{ document.theForm.theResponse.value+="\n*This article does not have any categories. Please categorize it with relevant ." }

alphed2 = true il1 = /\[\[(.{2}|als|ang|frp|ast|zh-min-nan|pdc|ilo|jbo|nah|nrm|nds|sco|scn|simple|tpi|chr|vec|zh-yue):.{1,}\]\]/gi

if(il1.test(theText)){ theIL = theText.match(il1) for(i=0;itheIL[i]){} else{ alphed2 = false } } }

if((!alphed)&&(alphed2)){ //document.theForm.theResponse.value+="\ncategories" } if((!alphed2)&&(alphed)){ document.theForm.theResponse.value+="\ninterlanguage links" } if((!alphed)&&(!alphed2)){ document.theForm.theResponse.value+="\n" }

//looks at length of article: //summary style -ToC and entire article- theLength = theText.length newHeading = /\n==/g if(newHeading.test(theText)){ theSections = document.editform.wpTextbox1.value.match(/\n==/g) if(theSections.length<=5){ document.theForm.theResponse.value+="\n" } if(theSections.length>=24){ document.theForm.theResponse.value+="\n" }

if((theLength<=7500)&&(theSections.length>5)){ document.theForm.theResponse.value+="\n" } } else{ theSections = "none" }

if((theLength<=7500)&&(theSections=="none")){ document.theForm.theResponse.value+="\n" }

if(theLength>=50000){ document.theForm.theResponse.value+="\n" } awtstring = ""

//looks for section-stub template //Template:sectstub, section stub, section-stub, sect-stub, stub-section nosectstub = true var tempsectstub = new Array tempsectstub[0] = /\{\{sectstub\}\}/gi tempsectstub[1] = /\{\{sect-stub\}\}/gi tempsectstub[2] = /\{\{section stub\}\}/gi tempsectstub[3] = /\{\{section-stub\}\}/gi tempsectstub[4] = /\{\{stub-section\}\}/gi for(s=0;s<tempsectstub.length;s++){ if(tempsectstub[s].test(theText)){ nosectstub = false } }

if(nosectstub==false){ document.theForm.theResponse.value+="\n" }

//looks for weasel words var ww = new Array isww = false ww[0] = /some people sa/gi ww[1] = /it has been/gi ww[2] = /many people have/gi ww[3] = /many scientists believe/gi ww[4] = /allege/gi ww[5] = /many people sa/gi ww[6] = /many people believe/gi ww[7] = /arguably/gi ww[8] = /it is claimed/gi ww[9] = /correctly/gi ww[10] = /apparently/gi ww[11] = /people considered/gi ww[12] = /many considered/gi ww[13] = /is considered/gi ww[14] = /are considered/gi

var ww2 = new Array ww2[0] = "some people sa" ww2[1] = "it has been" ww2[2] = "many people have" ww2[3] = "many scientists believe" ww2[4] = "allege" ww2[5] = "many people sa" ww2[6] = "many people believe" ww2[7] = "arguably" ww2[8] = "it is claimed" ww2[9] = "correctly" ww2[10] = "apparently" ww2[11] = "people considered" ww2[12] = "many considered" ww2[13] = "is considered" ww2[14] = "are considered"

for(i=0;i=8)&&(theaddnum.length>=theText.length/2500)){ redun1[0] = "1" } }

vaguesize = /(some\s|a\svariety\sof|a\snumber\sof|a\smajority\sof|several|a\sfew|\smany|\sany\s|\sall\s)/gi if(vaguesize.test(theText)){ thevsnum = theText.match(vaguesize) if((thevsnum.length>=8)&&(thevsnum.length>=theText.length/2500)){ redun1[1] = "1" } }

temporal = /(over\sthe\syears|currently|\snow\s|from\stime\sto\stime)/gi if(temporal.test(theText)){ thetempnum = theText.match(temporal) if(thetempnum.length>=5){ redun1[2] = "1" } }

intheyear = /(in\sthe\syear|in\sthe\syear\sof)\s(\[\[|)(\d\d\d\d)/gi if(intheyear.test(theText)){ //exyear = RegExp.$3 redun1[3] = "1" }

if((redun1[0]=="1") || (redun1[1]=="1") || (redun1[2]=="1") || (redun1[3]=="1")){ document.theForm.theResponse.value+="\n*Watch for redundancies that make the article too wordy instead of being crisp and concise. (You may wish to try Tony1's redundancy exercises.)" if(redun1[0]=="1"){ document.theForm.theResponse.value+="\n**While additive terms like “also”, “in addition”, “additionally”, “moreover”, and “furthermore” may sometimes be useful, overusing them when they aren't necessary can instead detract from the brilliancy of the article. This article has "+theaddnum.length+" additive terms, a bit too much." } if(redun1[1]=="1"){ document.theForm.theResponse.value+="\n**Vague terms of size often are unnecessary and redundant - “some”, “a variety/number/majority of”, “several”, “a few”, “many”, “any”, and “all”. For example, “ All pigs are pink, so we thought of  a number of ways to turn them green.”" } if(redun1[2]=="1"){ document.theForm.theResponse.value+="\n**Temporal terms like “over the years”, “currently”, “now”, and “from time to time” often are too vague to be useful, but occasionally may be helpful. “I am  now using a semi-bot to generate your peer review.”" } if(redun1[3]=="1"){ document.theForm.theResponse.value+="\n**“In  the year [of] 1990”" } }

//searches for footnotes Ref = /\<ref/gi Refa = /<ref/gi Ref2 = /\{\{ref/gi Ref3 = /\{\{fn/gi Ref4 = /\{\{harv/gi Ref5 = /\{\{Harv/gi if(Ref.test(theText)||Refa.test(theText)){ references="1" } else if(Ref2.test(theText) || Ref3.test(theText) || Ref4.test(theText) || Ref5.test(theText)){ references="2" } else{ references="0" } if(references=="0"){ document.theForm.theResponse.value+="\n" } else if(references=="2"){ document.theForm.theResponse.value+="\n*You may wish to convert your form of references to the cite.php footnote system that WP:WIAFA 2(c) highly recommends." }

//checks spacing sRefa = /<\/ref>\./gi sRefb = /\.\s /gi sRef2a = /\{\{ref\|.{1,}\}\}\./gi sRef2b = /\.\s\{\{ref\|.{1,}\}\}/gi sRef3a = /\.\s\{\{fn\|.{1,}\}\}/gi sRef3b = /\{\{fn\|.{1,}\}\}\./gi

if(sRefa.test(theText) || sRefb.test(theText) || sRef2a.test(theText) || sRef2b.test(theText) || sRef3a.test(theText) || sRef3b.test(theText)){ document.theForm.theResponse.value+="\n" }

//searches for reference section Refsect = /==(\s|)Reference/gi Refsect2 = /==(\s|)Source/gi Refsect3 = /==(\s|)Footnote/gi Refsect4 = /==(\s|)Cit/gi Refsect5 = /==(\s|)Note/gi if(Refsect.test(theText) || Refsect2.test(theText) || Refsect3.test(theText) || Refsect4.test(theText) || Refsect5.test(theText)){} else{ document.theForm.theResponse.value+="\n" }

//all articles can always use copyediting: document.theForm.theResponse.value+="\n"

//closing + signature document.theForm.theResponse.value+="\nYou may wish to browse through User:AndyZ/Suggestions for further ideas. Thanks, ~\n"

//show feedback document.getElementById("theFeedback").style.visibility = "visible"

// if((theTitle.indexOf("Wikipedia:Peer review")!=-1)&&(document.location.href.indexOf("Automated")==-1)&&(document.editform.wpTextbox1.value.indexOf("*Please see automated peer review")==-1)&&(automsg)){ document.editform.wpTextbox1.value += "\n*Please see automated peer review suggestions 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:PR/A"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) { txt.value += " | "; }		txt.value += summary; }

thehide; } //

PRheader = /\{\{PR\-/gi theArchive = ""

// - archiving of automated peer reviews if(document.location.href=="http://en.wikipedia.org/w/index.php?title=Wikipedia:Peer_review/Automated&action=edit"){ if(PRheader.test(document.theForm.theResponse.value)){ thePRarticle = theText.match(/===\[\[(.{1,})\]\]===/gi) for(i=0;i<thePRarticle.length;i++){ if(document.theForm.theResponse.value.indexOf(thePRarticle[i].substring(5,thePRarticle[i].length-5))==-1){ loc1 = theText.indexOf(thePRarticle[i]) theText2 = theText.substring(loc1+5,theText.length) loc2 = ((theText2.indexOf("===| (theText2.indexOf("==Requests")==-1)) ? theText2.indexOf("===[[") : theText2.indexOf("==Requests")				theArchive+="\n===[["				theArchive+=theText2.substring(0,loc2)				document.editform.wpTextbox1.value = theText.substring(0,loc1) + theText2.substring(loc2,theText2.length) 				theText = document.editform.wpTextbox1.value			}	}	document.theForm.theResponse.value = theArchive	// Add a tag to the summary box - stolen from [[User:Bobblewik    var txt = document.editform.wpSummary;    var summary = "JS - archiving closed peer reviews";	if (txt.value.indexOf(summary) == -1) {		if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {			txt.value += " | ";		}		txt.value += summary;	} }			}

//

//ending brace for first function }

/* ////////////////////////////////////////////////Not working as of now////////////////////////////////////// function imgtest{ //checks image status img = /\[\[image\:.{1,}(\||\])/gi

notag="" futag="" alltagged = true allfurat = true

if(img.test(theText)){ var imglist = theText.match(img)

for(i=0;i ") x=0 while(x<10000){ if(imgWin.theImgWin.document.editform.wpTextbox1.value){ imgtest2 break; } x++ } }

if(alltagged==false){ document.theForm.theResponse.value+="\n" }

if(allfurat==false){ document.theForm.theResponse.value+="\n" } }

function imgtest2{ theImgText = imgWin.theImgWin.document.editform.wpTextbox1.value if(theImgText!=null){alert("finally")}

templ1 = /\{\{/gi templPD = /\{\{PD\}\}/gi if(templ1.test(theImgText)){ if(templPD.test(theImgText)){ alltagged = false notag=notag+"|"+imglist[i] }	} else{ alltagged = false notag=notag+"|"+imglist[i] }

templFU = /\{\{.{0,}(Music sample|Speech|Sheet music|Albumcover|Boardgamecover|Book cover|Comiccover|DVDcover|Gamecover|Softwarecover|Magazinecover|Time|Newspapercover|Video tape cover|Logo|Computer hardware logo|Disneylogo|PreK12\-logo|Restaurant|Radiologo|Schoolboard\-logo|Scoutlogo|Sports\-logo|Hqfl logo|Olympics\-logo|Tv\-logo|Tv\-program\-logo|Univ\-logo|Symbol|Seal|Icon|Game\-icon|Wayfinding|Stamp|USPSstamp|Money|Promotional|DisneyAttractionPoster|Eventposter|Sportsposter|Movie poster|Political poster|Film\-screenshot|Machinima\-screenshot|Musicpromo\-screenshot|Tv\-screenshot|Video\-screenshot|Game\-screenshot|Cvg\-titlescreen|screenshot|screen|art|photo|sign|cover|artwork|Digimonimage|DisneyCharacter|Pokeimage|Yugiohimage|Comicpanel|comicscene|Public Library images|Otto Perry image|Robert Richardson image|Parody|Smithsonian|Standard test|Fair use in|Fairusein\d)/gi FUrat = /rationale/gi

if((templFU.test(theImgText))&&(!FUrat.test(theImgText))){ allfurat = false futag=futag+"|"+imglist[i] }

imgWin.close

} }

function thehide{ document.getElementById("theFeedback").style.visibility = "hidden" document.getElementById("restore").style.visibility = "visible" }

function theshow{ document.getElementById("theFeedback").style.visibility = "visible" document.getElementById("restore").style.visibility = "hidden" }

document.write('[ X ] The following suggestions were generated by a semi-automatic javascript program, and may or may not be accurate for the article in question. ' +'[restore] ')

// Script from User:Omegatron/monobook.js/addlink.js document.write('<script type="text/javascript" src="'             + 'http://en.wikipedia.org/w/index.php?title=User:Omegatron/monobook.js/addlink.js'              + '&action=raw&ctype=text/javascript&dontcountme=s"> ');

//adds peer review link to top bar (with your username, talk page, preferences, watchlist, etc.) $(function {    if(document.forms.editform) {        addLink('p-personal', 'javascript:review1', 'peer review', 'ca-peerreviewer', 'Semi-automatic peer reviewer by javascript', , );    } });

// end