User talk:Dr pda/prosesize.js

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Potential problem[edit]

Very nice tool for looking at the number or words in an article. In playing with the tool I noticed that it does not pick up editable text with the following characteristics:

<:> indented information is excluded
<*> bulletized information is excluded
<#> numbered information is excluded

For individuals working on large articles these are commonly used techniques for presenting information. Looking at a few articles it seems to reduce actual count by 10-20 percent depending on the structure of the article. Sincerely -- BullockTalk 18:38, 24 April 2010 (UTC)

Thanks for your comments. As explained on the script documentation page, there are a couple of reasons why the script acts in the above way. First, WP:SIZE explicitly excludes lists from "readable prose". Second, the script works by counting text within HTML <p></p> tags; the things you mention above are HTML <dl>, <ul>, and <ol> respectively. One reason why it is non-trivial to include these lists in the prose size calculation is that these tags are also used for the lists of references, citations, and external links, as well as in navboxes, templates, etc, and there is no easy way to exclude those in all articles. I'm very busy at the moment, so I don't have time to try to implement a not-so-easy way. Dr pda (talk) 22:46, 30 June 2010 (UTC)

JavaScript error with Internet Explorer 6[edit]

I have a problem with using this script with Internet Explorer 6. Whenever I try pressing the "Page size" script, a JavaScript error shows up, and only empty bullet points show up. Is this possible because the XMLHttpRequest object isn't created correctly? I recall that there are two different versions for different Internet Explorer versions. (And just if you are wondering why I'm using Internet Explorer 6: I am using a public library computer, so I have no choice about my browser. I use Firefox at home.) MC10 (TCGBL) 00:02, 10 July 2010 (UTC)

You might want to consider carrying a copy of Mozilla Firefox, Portable Edition.   — Jeff G. ツ 03:40, 16 July 2010 (UTC)
I am seeing this same error in Internet Explorer 8, although admittedly a corporate edition that uses an older version of Java. Was any kind of workaround ever discovered? Mozilla Firefox, Portable Edition is not an option for me. Will talk 18:50, 27 January 2011 (UTC)

Not working[edit]

I've been using this script for over a month, but it is no longer working. I tried deleting it and adding again, to no avail. Any suggestions? Thanks. Cindamuse (talk) 10:08, 26 July 2010 (UTC)

It still works for me. Maybe there's a clash with something else in your settings. Try switching off other settings and then adding them in again until you find the one that may be doing that.- Wolfkeeper 21:24, 26 July 2010 (UTC)

Mention "characters"?[edit]

Just a small suggestion: perhaps you could change references to "b [bytes]" to "b (characters)" (and "Kb" to, I don't know, "Kb (1,024 characters)"?), or something along those lines? I was trying to use the tool to figure out if articles achieve the 1,500-character minimum required for DYK, and had to ask someone before discovering that one byte equals one character. — Cheers, JackLee talk 12:13, 13 August 2010 (UTC)

Actually, a character can be more than one byte, for example the mdash — (U+2014) is three bytes when stored in UTF-8 (e2 80 94). However, this is turn of the ASCII characters since UTF-8 was specifically designed to be a superset of it. — Dispenser 14:11, 30 August 2010 (UTC)

Request for readable prose (in lists) count[edit]

Per Wikipedia:Article_size#Occasional_ exceptions and Wikipedia:Manual of Style (embedded lists)#Appropriate use, list text should be counted, if separately. Could you add a readable prose(in lists) count? --Lexein (talk) 18:43, 23 August 2010 (UTC)

Wikipedia:Article size#Occasional exceptions refers to the fact that articles which are lists need not be broken up if they exceed 30–50 kB. It doesn't refer to calculation of readable prose, and as such should probably be moved to before the preceding section to avoid confusion. I agree that embedded lists are sometimes appropriate as described in Wikipedia:Manual of Style (embedded lists)#Appropriate use, however see the first section on this talk page for why it is non-trivial to include such lists in the prose size calculation. Unfortunately I am still busy. Dr pda (talk) 22:37, 23 August 2010 (UTC)
Thanks for the prompt response. Food for thought, and grounds for further research. --Dave Emory. --Lexein (talk) 01:24, 24 August 2010 (UTC)


File:Kingdom Hearts new.JPG
Today's featured article, with the page size and other scripts visible in the sidebar, using Firefox 3.6.13 for Windows.
File:Kingdom Hearts old.JPG
An older revision of the same article, with page size and other scripts missing from the sidebar.

Hi Dr pda, I noticed something odd recently with your script. In an effort to reduce article size, I moved some blockquotes out of the text, and placed them instead in footnotes. The result was that the readable prose size increased, though I thought words in footnotes were not counted. (I realize that words in blockquotes aren't counted.) Can you advise? SlimVirgin talk|contribs 23:10, 6 January 2011 (UTC)

Another query: I noticed that something changed recently. It used to be the case that we could go back into old revisions and see your prosesize button in the toolbox, which meant we could compare versions in terms of word count. Now, for me at least, your tool is only visible in the latest revision. Is that something you can fix? SlimVirgin TALK|CONTRIBS 18:07, 28 January 2011 (UTC)
On a page like this? Still works for me. Amalthea 20:02, 28 January 2011 (UTC)
Looking at that old revision with Firefox, in the toolbox I see only What links here, Related changes, Upload files, Special pages, permanent link, and Cite this page. On new revisions I have two further links in the toolbox -- WP:RFPP (a protection tool), and Page size. I just tried it with Google chrome, and I can see the page size tool in old revisions there too, so I wonder if I need to update Firefox or something. Will do that and report back. SlimVirgin TALK|CONTRIBS 20:10, 28 January 2011 (UTC)
No, it didn't work. SlimVirgin TALK|CONTRIBS 01:28, 7 February 2011 (UTC)
This script works fine for me in Firefox 3 and 4 when viewing old revisions, as it always has (for me). Gary King (talk · scripts) 03:41, 7 February 2011 (UTC)
Any idea what might have changed my end? It was visible in old revisions in Firefox until around four weeks ago, and is still visible to me with browsers other than Firefox. I'd like to try to fix it, because I do a lot of copy-editing to tighten texts, so I'm often comparing word counts between revisions, which now I can't do. The RfPP script that I have in my toolbox has also disappeared in old revisions. SlimVirgin TALK|CONTRIBS 15:07, 7 February 2011 (UTC)
I assume that some script in your monobook causes an error, which in turn prevents all subsequent scripts from loading. You can have a look into your javascript error console to find out if there are any errors logged (Ctrl+Shift+J in Firefox). Amalthea2 (talk) 15:16, 7 February 2011 (UTC)
Thanks, Amalthea, I'll try to do that and see what it says. SlimVirgin TALK|CONTRIBS 15:29, 7 February 2011 (UTC)
The problem is not with any of your scripts in User:SlimVirgin/monobook.js, since I just imported it to test, and received no JS errors. Your scripts also appeared for me in Firefox when viewing an old revision. The problem could either be with one of the gadgets you're using, although that's a bit unlikely, too, since those are usually held to a higher standard than most scripts, meaning they're less likely to throw errors—or maybe it's a Firefox extension you recently installed. You could try creating a new profile in Firefox, to see if the problem still exists there. Gary King (talk · scripts) 18:25, 7 February 2011 (UTC)
Thanks, Gary. I started trying to do that, but then got worried about losing my bookmarks, and never finding my way back, so I didn't complete it. :) I haven't changed anything recently in Firefox—haven't installed or uninstalled anything—so I can't think what might have caused it. I may just have to live with it. SlimVirgin TALK|CONTRIBS 19:09, 7 February 2011 (UTC)

Hi, as you can see from here I've just fixed a couple of issues with the script, addressing the cases you mentioned (and have now made it count blockquotes). One other thing I discovered is that diffs now have action=historysubmit in the URL, and not action=submit. This must be a recent change. Since I explicitly checked for the type of action being done on the page before adding the "Page Size" link to the toolbox, this may explain why it wasn't showing up for you in some cases. If you bypass your cache this might allow you to see the page size link on old revisions. However, rereading what has been written above, it seems like you also experience this problem also on old revisions, rather than diffs between old revisions, and it is browser-specific, so maybe it's something different. Dr pda (talk) 08:44, 9 February 2011 (UTC)

I also recommend making these changes, so that the link doesn't appear on pages that have no content. Or, the script should at least not throw an error when clicking on it on pages with no content. Gary King (talk · scripts) 18:54, 9 February 2011 (UTC)

Not working for just one article[edit]

I use this tool all the time, and it seems to work great, but I just found one article, Prince Ferdinand Philippe, Duke of Orléans, for which most of the numbers come up as 0. Spock of Vulcan (talk) 20:38, 17 January 2011 (UTC)

☑Y Fixed. Amalthea 21:49, 17 January 2011 (UTC)

I ran into a similar problem while looking at Barak Obama. The tool only returns the File size, and 4 empty bullet locations below that. Cliff (talk) 18:40, 8 April 2011 (UTC)


Is there an easy option to show raw numeric counts, rather than (or in addition to) "11 kB"? Values <10000 show four digits of precision, while values >10000 show two. Readable prose size precision does matter somewhat when calculating 5x article size changes for WP:Did you know. Example: Steven Matheson (revision 413440046), actual size 11497 (by my count). --Lexein (talk) 00:15, 14 February 2011 (UTC)

Yes - install User talk:Dr_pda/prosesizebytes.js instead. Doh. --Lexein (talk) 00:37, 14 February 2011 (UTC)

Hi Dr pda, Your tool is wonderful. I like it. I am preparing a series of studies about Wikipedia. I would like to know whether or not your tool can count the number of sentences only in PROSE section on a Wikipedia article as your word count function works. cooldenny (talk) 18:25, 30 April 2011 (UTC)

My page size tool is not working.[edit]

I have noticed since yesterday that when I want the page size to be shown, all that pops up are four bullet points with emptiness to their right while the respective statistics are supposed to be there instead. I don't know what the problem is there; I signed up for the copyediting drive, and I question how much I am capable of doing without that tool. What should happen for the tool to work again? Backtable Speak to meconcerning my deeds. 03:55, 17 May 2011 (UTC)

Not sure why measuring prose size is required for copy-editing, but: Still works for me when I tried it on Jimmy Thorpe. Which page doesn't work for you? If all: what browser are you using (exact version please), and are you getting any messages in your javascript console? Amalthea 07:51, 17 May 2011 (UTC)
Script works fine for me. It hasn't been modified in a while and you haven't edited any .js pages in a while, either. Perhaps it's a gadget you recently enabled? Try using a different browser to see if it works there, then we can eliminate one variable. Gary King (talk · scripts) 12:08, 17 May 2011 (UTC)
The browser that I am using is Internet Explorer 9, and all pages I've tried the page size gadget on have yielded no success. I tried using page size on another computer, this time with Internet Explorer 8, and I found the yellow higlights and the statistics that I was looking for. Also, I'm not sure or confident that I have another internet browser on my computer, which, for this situation at least, is somewhat undesirable. Also, when Amalthea states "Not sure why measuring prose size is required for copy-editing", that page size tool is used in the Guild of Copy Editors' Backlog elemination drives to determine the amount of words a page has; the words are important in those contests. Backtable Speak to meconcerning my deeds. 22:31, 17 May 2011 (UTC)
On second thought, when I said that I wasn't confident that I had another browser on my computer, that was before I remembered that I also have Google Chrome. I tested the tool on that browser, and it worked there. Thanks for the tip about alternate browsers. Backtable Speak to meconcerning my deeds. 01:55, 19 May 2011 (UTC)
Scripts typically work fine in most browsers but Internet Explorer, so when using scripts in IE, do so at your own risk. The one major difference is in how IE counts empty nodes compared to the other browsers, but there are also other differences as well. Gary King (talk · scripts) 02:15, 19 May 2011 (UTC)


Ever sice the "Technical maintenance will be performed soon. Temporary issues may arise but will be resolved shortly." notice has been displayed at the top of the page, the page size tool has not been working. pluma Ø 01:45, 5 October 2011 (UTC)

Fixed pluma Ø 23:12, 5 October 2011 (UTC)

Not sure where you see that message, but yeah, script does not appear to be working. Gary King (talk · scripts) 16:23, 5 October 2011 (UTC)
Ouch. I wonder if the recent WP page mods, or the recent server upgrade, or switching to FF 7/7.01 broke it? --Lexein (talk) 17:18, 5 October 2011 (UTC)
I created a fix for the script, and admin User:Fox added it to User:Dr pda/prosesize.js. Hit CTRL + R a bunch of times on that page and on an article and it should work. --Odie5533 (talk) 18:07, 5 October 2011 (UTC)
Ok, can you have that change rolled into User:Dr_pda/prosesizebytes.js as well? Thanks. --Lexein (talk) 18:31, 5 October 2011 (UTC)
What does that script do? Anything different? --Odie5533 (talk) 18:32, 5 October 2011 (UTC)
Keeps all displayed sizes in bytes, instead of shifting to kilobytes. It's in the docs. --Lexein (talk) 18:34, 5 October 2011 (UTC)
I am not an admin, but changing
 if( == contentDivName || para.parentNode.nodeName == "BLOCKQUOTE"){


 if( == contentDivName || para.parentNode.parentNode.nodeName == "BLOCKQUOTE"){

should fix it. --Odie5533 (talk) 18:39, 5 October 2011 (UTC)

Yep, works. Gary King (talk · scripts) 20:38, 5 October 2011 (UTC)

A similar edit needs to be made elsewhere in the script, for when you click on the link and Prose Size is already activated, then this will properly deactivate it by uncoloring the article. Gary King (talk · scripts) 07:11, 7 October 2011 (UTC)

No longer works for sections[edit]

In the Guild of Copy Editors backlog-reduction drives, sometimes only a section of a very long article needs copyediting and this script worked well in edit-preview mode until recently (I can still get page sizes for whole articles, but not for sections). I recently added a duplicate-links highlighting tool, but am now unable to delete the duplicate-links script from my .js page to see if that's the problem (which exists in both Firefox and Chrome, so I don't think it's a browser issue). Any help much appreciated!--Miniapolis (talk) 02:25, 13 November 2011 (UTC)

It still works in sections for me. Try removing other scripts and just keeping this one, then bypassing your cache. Gary King (talk · scripts) 07:27, 13 November 2011 (UTC)
Thanks for the advice, but I took the other three scripts out:
importScript('User:Topbanana/RLRL_SR_Utility.js' );
if(wgAction == 'edit') {
addOnloadHook(function minorEdit() {
document.getElementById('wpMinoredit').checked = true;

and bypassed the cache and it still doesn't work. My JS error console has many entries for this script; is it possible my version got corrupted somehow?--Miniapolis (talk) 14:36, 13 November 2011 (UTC)

It might be conflicting with one of your other scripts. I have my own version of the script at User:Gary King/prose size.js if you want to try it out, although it's not that different from the original anymore so I doubt it would fix the problem. Gary King (talk · scripts) 19:16, 13 November 2011 (UTC)
Thanks again; two other folks have reported the same problem, and one has suggested it may be related to the recent mediawiki software upgrade. We'll see. All the best,--Miniapolis (talk) 21:46, 13 November 2011 (UTC)
This problem is now fixed; see my talk page. Dr pda (talk) 18:28, 14 November 2011 (UTC)

Disabled by a template[edit]

On pages with the template {{Timeline geological timescale}}, the page size counter does not work. It can only count text up to the start of the template and most of the summary statistics are bullets with nothing following them. RockMagnetist (talk) 22:26, 18 April 2012 (UTC)

For example, the page count for Geology looks like this:

  • File size: 258 kB

RockMagnetist (talk) 15:35, 11 May 2012 (UTC)

I'm not seeing this problem any more. RockMagnetist (talk) 14:42, 24 July 2014 (UTC)


For the article Ra.One, I am getting the following things while checking the size :-

Document statistics:

  • File size: 33 kB
  • Prose size (including all HTML code): 331 B
  • References (including all HTML code): 0 B
  • Wiki text: null B
  • Prose size (text only): 73 B (12 words) "readable prose size"
  • References (text only): 0 B

I am certain something is pretty wrong here. Can somebody help me with this? ~*~AnkitBhatt~*~ 13:07, 11 May 2012 (UTC)

Maybe it's browser dependent. I get:
  • File size: 422 kB
  • Prose size (including all HTML code): 72 kB
  • References (including all HTML code): 13 kB
  • Wiki text: 123 kB
  • Prose size (text only): 43 kB (7450 words) "readable prose size"
  • References (text only): 1197 B
RockMagnetist (talk) 15:32, 11 May 2012 (UTC)
Yes, maybe so. I am using Google Chrome. Which server are you using Rock? ~*~AnkitBhatt~*~ 10:02, 12 May 2012 (UTC)
Google Chrome. That inspired me to try Safari and Firefox: same result. Any chance your browser is not up to date? RockMagnetist (talk) 15:28, 12 May 2012 (UTC)
Could be. I'll try updating it. ~*~AnkitBhatt~*~ 16:46, 12 May 2012 (UTC)

Not working on old revisions[edit]

I've been trying to use the page size script to compare past and current revisions of a page, but the "file size" statistic isn't working. Any past revision of any page invariably displays a file size of 58kB. Everything else (prose size, image size, etc) works normally. I'm using IE, but the problem's the same on Firefox. Any ideas? DoctorKubla (talk) 17:02, 5 July 2012 (UTC)

URL feature of the script not working[edit]

Please see Wikipedia:Help desk#Script for article size (permanent link). Best regards--Fuhghettaboutit (talk) 23:16, 19 September 2012 (UTC)

Tool breaks on Frog[edit]

This tool breaks on the Frog article right before some extended content, and does not count any of the subsequent 3/4 of the article. Please fix. • Jesse V.(talk) 00:09, 26 September 2012 (UTC)


Mention ofvector.js should be added next to monobook. --Piotr Konieczny aka Prokonsul Piotrus| reply here 03:55, 6 April 2013 (UTC)


Hi, could this not be one of those bot type meta tools instead of a somewhat daunting DIY million bytes of code, and don't forget to bypass your systems..? I know, the code is probably excellent, but I'm not quite sure that I am, and then, I thought I managed to measure prose before without having to set up scripts and fiddle with my browser settings. If you start playing with words like "bypass" in machine code and you don't know what you are doing, you are asking for trouble no? ~ R.T.G 01:58, 15 July 2013 (UTC)

DYK RfC[edit]

  • As a listed DYK participant, you are invited to contribute to a formal Request for Comment on the question of whether Good Articles should appear in the Did You Know? slot in future. Please see the proposal on its subpage here, or on the main DYK talk page. To add the discussion to your watchlist, click this link. Thank you in advance. Gilderien Chat|Contributions00:21, 1 August 2013 (UTC)

Codes for general interface[edit]

Hello. Will the codes be same as "User:Dr pda/prosesize.js" if I want to add this gadget to my local wikipedia by creating a page like "Mediawiki:Gadget-Prosesize.js"? Gitartha.bordoloi (talk) 13:45, 28 December 2013 (UTC)

Somehow conflicting with hotcat[edit]

I had been using this for a long time. Suddenly it seems to be breaking my use of Wikipedia:HotCat. When I have nothing other than importScript('User:Dr pda/prosesize.js'); in my common.js I get the prosesize tool working but my HotCat breaks. When I remove it HotCat works again. I thought I would share. Blue Rasberry (talk) 16:50, 17 February 2014 (UTC)

How to install on Chrome?[edit]

I am new to this whole area, so maybe I am doing something wrong... Trying to follow the instructions, I clicked on the link to "your skin script file" which says there is no such user page "Gronk Oz/vector.js" - I accepted the option to create it.

However, when I pasted the line of code {{subst:js|User:Dr_pda/prosesize.js}} into the top of this new page, it would not allow me to save the changes. The top line (where I pasted the code) had a red cross to the left, and when I hovered the cursor over it, it displays the following error messages:

  • Expected a string and instead saw {.
  • Expected ':' and instead saw 'subst'.
  • Expected a JSON value.
  • Expected '}' and instead saw ':'.
  • Expected '(end)' and instead saw 'js'.

Has anybody else installed it on Chrome and can advise how to address this problem? --Gronk Oz (talk) 05:17, 23 July 2014 (UTC)

 DoneI got the solution, thanks to Khamar. The correct code that needs to be pasted onto the script page is:
mw.loader.load('//'); // [[User:Dr_pda/prosesize.js]]

List-defined references not included?[edit]

Prosesize returned the following for 2014 Ferguson unrest. The article has a mix of list-defined references and in-body references. The references numbers seemed too small to include the LDRs, so I copied-and-pasted the LDRs into a .txt file and saved it on my computer. The resulting file was 81 kB in size. I conclude that Prosesize does not include LDRs. It would be great if it could be modified to do so; if that is not feasible, the documentation should be updated to clarify this.

File size: 497 kB
Prose size (including all HTML code): 45 kB
References (including all HTML code): 13 kB
Wiki text: 183 kB
Prose size (text only): 28 kB (4683 words) "readable prose size"
References (text only): 831 B ‑‑Mandruss  01:42, 26 November 2014 (UTC)

This breaks the script[edit]

on Chrome 52.0.2743.116 m on W10. Thanks! Lfstevens (talk) 21:33, 3 September 2016 (UTC)

Script not working on a particular page I encountered[edit]

Hi. The script is not working for the article Glushkov's construction algorithm. Thanks for the splendid tool, though. I hope it can be fixed soon. BroVic (talk) 23:38, 15 November 2016 (UTC)

Yeah, it's the <math> markup. I have the same problem on Project Y. Hawkeye7 (talk) 21:06, 10 January 2017 (UTC)
I tried using the {{Tmath}} template, but the problem remained. Removed the math entirely. Hawkeye7 (talk) 21:36, 10 January 2017 (UTC)

Link to WP:RPS[edit]

FYI, I have created a shortcut WP:RPS to the guideline about readable prose size. It may be useful to point there from the script's page size stats. I suggest those changes to lines 221–226 of the source. — JFG talk 02:17, 29 November 2016 (UTC)

  prose_value.innerHTML='Prose size (text only): '+((prose_size-refmark_size)/1024).toFixed(0)+' kB ('+word_count+' words) "readable prose size"';
  prose_value.innerHTML='Prose size (text only): '+(prose_size-refmark_size)+' B ('+word_count+' words) "readable prose size"';

Script recording prose size of zero[edit]


  • File size: 39 kB
  • Prose size (including all HTML code): 0 B
  • References (including all HTML code): 0 B
  • Wiki text: 4307 B
  • Prose size (text only): 0 B (0 words) "readable prose size"
  • References (text only): 0 B

Also seen in Giovanni Gribodo, any ideas why? Quetzal1964 20:17, 1 June 2017 (UTC) talk

  • Same issue for me.- MrX 20:37, 1 June 2017 (UTC)
@MrX:, @Quetzal1964: The page structure changed slightly today, causing the script to no longer be able to recognize the parts of the page. I've sort of fixed it. —TheDJ (talkcontribs) 21:32, 1 June 2017 (UTC)
Thanks TheDJ. I tried it after your first edit and it seemed to work fine.- MrX 21:35, 1 June 2017 (UTC)
Yeah, thanks for that! Hawkeye7 (talk) 23:21, 1 June 2017 (UTC)

User:Shubinator/DYKcheck.js seems to have the same problem. Would it be possible to fix it too? Hawkeye7 (talk) 01:06, 2 June 2017 (UTC)

Awesome script[edit]

Thank you. -Ammarpad (talk) 13:17, 12 October 2017 (UTC)