User talk:AndyZ/peerreviewer.js


 * For information about the script (including introduction, installation, features, etc.), please see User:AndyZ/peerreviewer.

Basics
If you receive a message on your peer review that states Please see automated peer review suggestions here, the link leads to a certain section in Peer review/Automated/July 2024. The suggestions there were generated semi-automatically by JavaScript, and generally focus on formatting and stylistic (as well as others) issues that tend to appear (based on my experiences) on WP:PR, WP:FAC, and WP:FARC; many of the suggestions are based on WP:MOS, WP:GTL, several other Wikipedia pages, and also from my suggestions page. Though most of the tips are generally accurate, some will not be applicable for the article in question.

The suggestions provided don't have to be acted upon, but the general idea is to improve the quality of Wikipedia's articles. See User:AndyZ/peerreviewer for more information.

Usage

 * More detailed instructions can be found here

You don't need an account to use this, but it would be best to have one (If you don't, please make one). For IP users, see here. Otherwise, to use the script, add  to your monobook.js (or other relevant file depending upon your skin). Then clear your browser's cache.

While editing an article, there should be a "peer review" link right next to your "log out" link. On clicking, it presents suggestions for the article generated by the code. For a longer list of features, see here.

Options
To change a configurable option, add a line to your monobook.js:


 * option = value;

, replacing option with the name of the variable from below, and value with one of the possible values listed below.

=Discussion= Haven't got round to using the results yet - but looks really useful one note - in the intro for a review 'may or may not be accurate' has one may too many suggest 'may be accurate' or 'may not be accurate' either would suffice Leevanjackson 18:10, 13 August 2006 (UTC)
 * Hmm... dunno which sounds better. Any suggestions? AZ t 17:50, 16 August 2006 (UTC)
 * 'may not be accurate' - since it seems to be accurate than not, but I suggest something like 'and may not be entirely applicable' Leevanjackson 12:27, 23 August 2006 (UTC)
 * I like "applicable"; I was looking more for a word like that but just couldn't think of it at the time. AZ t 23:02, 12 September 2006 (UTC)
 * Just one more minor tweak 'so might not be applicable...' sounds a bit more 'solid' Leevanjackson 02:04, 20 November 2006 (UTC)

Problems?
This script worked fine on 'Old Dan Tucker", but the Mac wait icon just keeps chugging along when I run it on minstrel show. Does it take a long time on longer articles or something? — BrianSmithson 05:46, 18 September 2006 (UTC)


 * I just tried it by copying all the code like the instructions says to User:Horus Kol/monobook.js, but the javascript doesn't run in my browser and I get an Invalid Quantifier { error when I use a console to debug it. Horus Kol 13:06, 16 October 2006 (UTC)

I can't get this script to work in Firefox. I tried 2.0 in Ubuntu and 1.5.0.8 in Fedora Core 6. Neither Firefox would show the Peer-review link next to the log out. It works fine in IE on my windows box or Konqueror in FC6. However, Galeon 2.0.2 would not work either. I've tried clearing the cache, purging the server, rebooting and verifing javascript. Help, Morphh (talk) 15:44, 27 December 2006 (UTC)

Doesn't work for protected pages
The script doesn't work for protected pages (ones where you have to click view source. I know you can just copy the source into a different page but still... --WikiSlasher 15:43, 7 October 2006 (UTC)
 * I've never had this problem, being an admin. Thanks for bringing this to my attention, I'll fix it. AZ t 00:25, 22 October 2006 (UTC)

Protected edit request on 21 October 2006
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."

is wrong. 1(2) deals with refs, 2(c) deals with the ToC. 68.39.174.238 20:19, 21 October 2006 (UTC)


 * Good point, WP:WIAFA changed, so I'll have to make quite a few changes. Thanks, AZ t 00:22, 22 October 2006 (UTC)

...did this page get protected with nothing showing in the protection log? 68.39.174.238 20:20, 21 October 2006 (UTC)


 * I think the monobooks of users are protected so that a vandal can't just install a malicious script on the page (but then again, I'm not sure) AZ t 00:25, 22 October 2006 (UTC)

Use the full names of Wikipedia policy articles rather than the shortcut names
Thanks for creating this tool, it has proven to be quite helpful, despite the occasional disgruntled comments I've seen on peer review requests.

One request I have is addressing one of my pet peeves about making wikipedia more inclusive to new editors who don't know all the shortcuts and jargon, is that when referring to elements of Wikipedia policy or the manual of style, the automated suggestions refer to the shortcuts names of the articles, rather than the full name. For example, one of the lines I received was:
 * Per WP:CONTEXT and WP:MOSDATE, 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.

The first time I saw this, I was thinking to myself, "huh? MOSDATE?" It would be clearer and easier to understand if the script would include the full name of the article, "Manual of Style (dates and numbers)" rather than "MOSDATE". When I'm manually typing comments to people, I frequently get lazy and use the shortcut name rather than the full name, especially if I feel like the reader I'm writing to would know what MOSDATE means, but with an automated script, it shouldn't be too difficult to put the full name and would reduce the amount of deciphering required. Neil916 (Talk) 00:44, 19 November 2006 (UTC)
 * Good suggestion, I guess I'm really lazy ;). I'll start fixing them. AZ t 02:55, 19 November 2006 (UTC)
 * I've gone through and fixed all of the non-obvious ones (leaving shortcuts like WP:FOOTNOTE where they were obvious). AZ t 14:24, 19 November 2006 (UTC)
 * Thanks, and no, I wasn't calling you lazy! :) Nice work. Neil916 (Talk) 06:22, 20 November 2006 (UTC)

APR script
This script rawks. I love the new auto-fix tabs, they are great. One of the things I noticed is that it doesn't nbsp measurements when the measure is cm. See Climate_of_Minnesota for an example. Also do you think the spell checker could be it's own little tab thing? I was trying to use it, and I think it fires off when you hit "peer review" but it didn't seem to do anything. Thanks and keep up the great work. -Ravedave (help name my baby) 01:27, 22 November 2006 (UTC)
 * Also my tabs, except send to wp:pr seem to have dissapeared since your last edit... -Ravedave (help name my baby) 01:34, 22 November 2006 (UTC)
 * The tabs are from User:Bobblewik's scripts, you'll have to contact him about the nbsp thing. The spell-checker is literally nothing compared to others (like MS Word's); it works by finding comon mispelings based upon the torough list (but far from complete…) at Lists of common misspellings/For machines. It is similar to the spellchecker provided in User:Lupin's anti-vandal tool. Thanks for the feedback! AZ t 22:55, 30 November 2006 (UTC)
 * Could you please remove the date component of Bobblewik's script? There is no consensus to use it; in fact, if you look at Bobblewik's talk page, I think there's a consensus not to use it, and there's been minimal trouble with this for quite a long tiem. I'd really hate to see another outbreak of disputes on this front. Rebecca 23:12, 25 December 2006 (UTC)
 * Yes, I would hate to start it again. I carefully excised Bobblewik's year de-linking part of the script (I kept the noncontroversial part in), and tests I ran didn't affect the delinking of dates. Could you point me to a diff? Thanks, 72.68.51.86 17:17, 1 January 2007 (UTC)

Logged out by script
I installed this script and tried it out on one page and found it helpful, but then found the following problem, which led me to uninstall it: Almost every time I open something that requires me to be logged in, such as Special:Watchlist in a new tab, it thinks that I'm logged out even though I'm still logged in in the other tab. Similarly, when I'm in a page (article, talk page, etc) and go to edit, history, watch, etc., it suddenly decides that I'm not logged in and I have to log in, go back to the page, then go back to the action again. That's a real pain when reverting vandalism, etc.! --Athol Mullen 07:59, 15 December 2006 (UTC)
 * This happens to me occasionally when I open a new window, but I'm not quite sure if this script has anything to do with it. There's nothing in the script that should log anyone out, but I'll look into it more. AZ t 15:43, 1 January 2007 (UTC)

Changes to English words consistent
I made a bunch of changes to the part that checks which English variant your using. I've got an edited copy up User:J2000ca/peerreviewer.js. I still have to: So I wouldn't do anything with it yet. --J2000ca 03:47, 10 May 2007 (UTC)
 * Check whether a word appears in all languages and delete it if it does
 * Check a whether one language covers all caught words.
 * Test in other browsers besides FF.

Too much vs too many
Your script counts the number of 'additional' 'in addition' etc, and then suggest that they are a bit too much. May I recommend the suggestion that there are a bit too many instead. Wim van Dorst (Talk)'' 21:26, 6 June 2007 (UTC).

Extra options
I'd like an option to disable the contraction checking; most uses of "can't," "won't," etc on Wikipedia are actually inside quotes and don't need to be changed. —Disavian (talk/contribs) 02:43, 17 July 2007 (UTC)

Bugs in automated PR
I applied your tool to Jimbo's page and I committed this diff, but you will see on Line 85 of the diff that is insert is big hunk of text that was a copy from a paragraph earlier. This is probably a bug in your script that you might want to investigate.

Here is another case at about line 10.

Here is another bug I found when running the script on the Astronomy page: The script converts
 * km/s/Mpc

to
 * km/s/Mpc

which is not what we want. I added parenthesis to avoid the problem, but you might want to fix this bug.

URLs: And another in Charles Darwin: http://www.asa3.org/ASA/PSCF/2001/PSCF9-01Miles.html. You put the nbsp in between 01 and Miles. I suppose one could escape the "M with the capital-M hex value.

And other: Thomas More http://www.bl.uk/learning/histcitizen/21cc/utopia/more1/moreutopia.html

There were others. You might want to skip over URLs in your parsing.

Also, since editors love to stick in &#91;sic&#93; in single square brackets, I have to use &amp;#91; and &amp;#93; instead. This also applies for elided phrases which [expletive delete] me up sometimes. Also, for the citations of legal decisions, the year is usually in single square brackets. You might want to make a list of "how to keep my tool happy". And also: it would be nice if there was an option to not expand out contractions. Many personal quotes and article titles have contractions. I personally think that quotations are used far too often at Wikipedia, but news reports often contain quotes and the younger editors seem to pick up on that style. It seems that neither &amp;apos; nor &#21; can be used to always keep the tool happy because it does not always render correctly. See List of XML and HTML character entity references

From List of banned books: Here is one case (among several) where we double-square-bracket something that is single-square-bracket: [. I suppose one could argue that these expressions belong in templates.

In chemical kinetics, such as Ethanol, the single-square bracket must be preserved.

Here is an obvious bug from Malthusian catastrophe where year and title get confused:

http://www.gutenberg.org/dirs/etext03/prppl10.txt An Essay on the Principle of Population by T. R. Malthus ] 1798

got changed to

cite web|url=http://www.gutenberg.org/dirs/etext03/prppl10.txt | title=An Essay on the Principle of Population by T. R. Malthus | year=An Essay on the Principle of Population by T. R. Malthus


 * May be difficult to fix due to complexity of references.

Another trivial problem: I think that search for "==Cit" and "== Cit" is a little too sloppy. You should look for Cita because articles about large cities will include sections that start with the word City such as "City proper" or Cityscape.

I noticed that the script tends to nuke years links to specific areas. By this, I mean that some editors will link the year 1930 in an article about a film to 1930 in film, or for a building to 1930 in architecture, 1970 in television and so on. The script just unlinks these kinds of wikilinks altogether. Now, I see that this is a growing trend in timelines. See Category:Events by year. And some of these have subcats, such as Category:Video games by year, so this problem is not going away. We should probably change the tool to account for this.
 * Strange, I thought I took care of that. Will go back and fix.

Here is an odd one: when the script converted an ampersand in a section title to the word "and", it also introduced an one extra equals sign, causing the equals signs to become unbalanced. See Line 27 of the diff.

Some traditional subjects do not have a lot of web links. E.g. Felice Beato. The article is FA, but most of the links are just "author-last-name page-number", but you try to treat this as a URL and turn it into a "web cite".

You do not recognize an https: URL as such and change it to a wikilink. https://www.cia.gov/library/publications/the-world-factbook/index.html is an example of a site that only works well with https:--SallyForth123 16:57, 1 August 2007 (UTC)

For refs that do not contain URLs, the script often converts to a web cite incorrectly, either assigning an incorrect author or year. For example, see the url-free refs in Felice Beato.

Here is another case where we trip over our own technology:

$$ x=\!\ \sqrt[n]{e} $$

We use a single-square-bracket in the math formula but the script alters (and breaks) it.

It tuns out that Template:Convert requires one to use keywords like sqkm for square kilometers in the wikisource and it then does the conversion to km2. I ran across this in European Union.

Here is a blatant bug: We convert "8:10 PM EDT" to "8:10 P.m. EDT". We convert "3:02 AM EDT" to "3:02 A.m.EDT". The MOS say that should be both letters lowercase. Where do we treat time in the code? See this diff.
 * Fixed, I believe.

--SallyForth123 05:44, 31 July 2007 (UTC)

Please add option to disable contraction conversion
It seems that AndyZ has not been around the past few months. Could we either drop this down to semi-protection or could an admin pick up the slack?

I really need an option to disable contraction expansions. If should be easy to implement. The comments label the "contractions" section of the code.--SallyForth123 10:27, 5 August 2007 (UTC)
 * All CSS and JS user subpages are automatically protected so that only the specific user and admins can edit those pages. Thus, it's impossible for anyone to reduce the protection level to semi- in this particular case. If there is a specific change to this page you'd like, feel free to write the code below and I can add it, or you can copy the code from this page to your own JS subpage. Cheers. --MZMcBride 16:43, 5 August 2007 (UTC)


 * To develop/test my changes, I had to copy the whole script over to my User:SallyForth123/monobook.js. I have that working now. Pls see this diff. What I did was to add a new option, so changes occur in a few places.  Also, my working copy has two options set that are personal and should not go into the shared script. The changes are:


 * 1) Declare the new variable. The line that begins with "var allSpaces_PR, defaultView_PR,..." now ends with "...simple_PR, expandContractions_PR;"
 * 2) Add a line "if(expandContractions_PR==undefined) expandContractions_PR = true;" somewhere around line 55.
 * 3) Put an if around the relevant code. When I first tried this in the obvious fashion, the script stopped working for reasons I do not understand. What I did was to move the contractions code down to the end of the long block of .replace code and re-assert the "txt.value = txt.value" line.
 * Please make these changes, then I will go back to importing this script and I will add the documentation to User talk:AndyZ/peerreviewer.js/options.--SallyForth123 22:03, 5 August 2007 (UTC)

So, we added the feature but we left the default as expandContractions_PR = true. It would be nice to think that somebody is at the driving wheel and that we could decide to set the default to false because it is a major stumbling block for this script: for every one contraction that it detects, it seems to expand 10 contractions that are in quotes or reference titles that should NOT be expanded. AndyZ has been inactive for the past two months. Is anyone else in charge of this thing? Do 100 othere users really use it?--SallyForth123 04:35, 6 August 2007 (UTC)

Spelling
In 'For example, if the article is United States, than an appropriate subpage...', 'than' should rather read 'then'. Classical geographer 20:54, 20 August 2007 (UTC)

Problem with Firefox 3
Something is breaking Firefox 3 beta 5. Every time I load a page I get a popup error Replaced by addPortletLink

Error: addLink is not defined Source File: http://en.wikipedia.org/w/index.php?title=User%3AAndyZ%2Fpeerreviewer.js&action=raw&ctype=text/javascript Line: 106

This happened recently. Carlosguitar (Yes Executor?) 15:25, 4 April 2008 (UTC)

addLink
Just wanted to let you know, that the script you are importing at the top of the page is no longer active. The script originally contained of an addLink function, which helped to add tabs to Wikipedia's interface. However, the script was blanked and replaced with a notice that the function has now been replaced by addPortletLink. I suggest you replace all of the calls to the addLink function with addPortletLink, because the script will not work until that is done. — Parent5446 (t n c k e l) 17:57, 4 April 2008 (UTC)
 * Just to let you guys know, I'm keeping this version of this script updated: User:Gary King/peer reviewer.js. It works fine without the addLink error. Gary King (talk) 18:55, 4 April 2008 (UTC)

Error with Autoformat
I experimented with Autoformat on Putana. The Autoformat suggests conversion of into This is not required.--Redtigerxyz (talk) 12:38, 29 September 2008 (UTC)

Autoformat generates improper sq mi for sqmi in Convert template
The "Autoformat article per MOS" button improperly changes Convert templates using sqmi to use sq mi. These templates then call the nonexistent conversion template Convert/sq mi. For example



which displays as

275 sqmi

is changed to



which displays as

275 sq mi

--Uncia (talk) 13:59, 29 August 2009 (UTC)

Doesn't work with beta
The script doesn't appear to show up on the beta as a selectable option. When I leave the beta it's fine. Tried this on several pages. 陣 内 Jinnai 22:35, 31 August 2009 (UTC)


 * Does User:Gary King/peer reviewer.js work?  Gary King ( talk ) 00:12, 1 September 2009 (UTC)


 * Where should that script option be showing up? I added the importscript to my noonbook.js but can't find it on beta or non-beta. 陣 内 Jinnai 00:52, 1 September 2009 (UTC)


 * Actually I suggest that you use the web version of the script instead, found here. You can avoid the hassle of installing the script.  Gary King ( talk ) 02:36, 1 September 2009 (UTC)


 * okay thanks. 陣 内 Jinnai 03:49, 1 September 2009 (UTC)
 * I did a bit of cleanup, and it should be better now, but this script still requires major work. It is terribly browser specific. —Th e DJ (talk • contribs) 13:48, 25 May 2010 (UTC)
 * One of those browser specific problem is that all the regex are marked with g (global) flag, IE recompile the regex each time, but in other browsers it uses the same one. If you run the script more than one some of those regex will not work correctly.  — Dispenser 00:53, 26 May 2010 (UTC)

Images to files
Many images are now called files so we get false reporting of User:AndyZ/G. Regards, SunCreator (talk) 14:44, 22 May 2010 (UTC)
 * Check file code. Regards, SunCreator (talk) 01:44, 26 May 2010 (UTC)
 * I have fixed this as well. —Th e DJ (talk • contribs) 13:48, 26 May 2010 (UTC)

No longer working?
I just went to use the script, but it is no longer appearing when I enter edit mode. I've not added or removed any other scripts recently, though I noticed there has been some recent edit activity to the script itself. Any known issues? — Huntster (t @ c) 08:27, 3 June 2010 (UTC)
 * It is not working for me, either. I have tried reintalling it and bypassing cache with no help. For the record, I have made one change to my monobook recently, but I am pretty sure it is not broken (I reverted it, bypassed cache, and it didn't restore the reviewer). --Piotr Konieczny aka Prokonsul Piotrus 19:51, 6 June 2010 (UTC)
 * PS. A temporary solution is to use the web front for the script, that does appear to be working: . I do miss the peer review tab, though - hopefully this will be fixed soon. --Piotr Konieczny aka Prokonsul Piotrus 19:55, 6 June 2010 (UTC)
 * I need a better description than "not working". It works for me on FF 3.6. You can use Tools->Error Console. —Th e DJ (talk • contribs) 22:46, 6 June 2010 (UTC)
 * Hmmm. I don't see the peer review tab. I tried SeaMonkey 1.1.19 (last 1.x build), 2.0.4 (latest 2.x build) and Chrome (5.0.375.55, also the latest build) and IE 8. None of those seem to have the Error Console under Tools, I am afraid. --Piotr Konieczny aka Prokonsul Piotrus 02:24, 7 June 2010 (UTC)


 * Okay, I've found that while in edit mode, if you hit F5, the "peer review" text will appear, and clicking it will create the suggestion box at the very bottom of the screen, in the large empty space. Everything should work fine from there, but from my testing, it looks like you'll have to hit F5 for every edit window you want to use the script on. Very strange indeed, and yes DJ, I'm using FF 3.6.3. — Huntster (t @ c) 00:21, 7 June 2010 (UTC)

Improvement suggestions
If anybody would like to improve the script, here are some things I'd like to see: --Piotr Konieczny aka Prokonsul Piotrus 19:57, 6 June 2010 (UTC)
 * spotting and commenting on unreferenced paragraphs and sections
 * indicate the need to remove stub templates from long articles and the lack of stub templates on short ones
 * on talk pages, missing or unassessed WikiProject tags

Legacy JavaScript
Hello! This script has been detected as using deprecated parameters that need to be replaced with the updated version. Examples include  needs to be replaced with   or   (depending on use);  all wgGlobalVariables need to be properly gotten with  ; and   needs to be called with. Please see ResourceLoader/Legacy JavaScript for details. Thank you. —  20:31, 19 January 2015 (UTC)