Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#4807 closed enhancement (fixed)

Word Count

Reported by: mdawaffe's profile mdawaffe Owned by: mdawaffe's profile mdawaffe
Milestone: 2.6 Priority: normal
Severity: minor Version: 2.3
Component: Administration Keywords: has-patch blessed
Focuses: Cc:

Description

Add word count thingummy to the Write Post screen. Should work in Visual view, Code view and tinyMCE-just-plain-off view.

Patch accomplishes this in Firefox, Safari, IE6/7, Opera.

Is it core?

Attachments (6)

4807.diff (3.3 KB) - added by mdawaffe 18 years ago.
4807b.diff (3.5 KB) - added by mdawaffe 18 years ago.
patch update: this is what's currently running on WP.com
word-count.patch (6.5 KB) - added by azaozz 17 years ago.
word-count2.patch (6.6 KB) - added by azaozz 17 years ago.
word-count3.patch (6.4 KB) - added by azaozz 17 years ago.
word-count3.2.patch (6.3 KB) - added by azaozz 17 years ago.

Download all attachments as: .zip

Change History (47)

@mdawaffe
18 years ago

#1 @Stevie212
18 years ago

  • Priority changed from normal to low
  • Severity changed from normal to trivial

Try the ideas section to pledge your idea, Go here It's trivial if we need it or not, thats why I am changing it to "low" however it is a good idea.

#2 @Viper007Bond
18 years ago

-1

I don't really see the point. I mean who cares how many words are in your post? I bet 99% of people don't.

Best left to a plugin IMO.

#3 @rob1n
18 years ago

I'm on the fence with this one. While it's cool and I can definitely see the use (and I'd probably pay attention to it when I'm writing a post), I question whether it's really something that a wide range of users will use. But then again, it's unobtrusive enough that I also can't decide if it's plugin material or just a trivial addition to the core.

#4 @rob1n
18 years ago

  • Keywords has-patch 2nd-opinion added

#5 @JeremyVisser
18 years ago

+1. WordPress.com has this feature.

#6 follow-up: @jaroche
18 years ago

-1.

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

#7 in reply to: ↑ 6 @JeremyVisser
18 years ago

Replying to jaroche:

Really, i don't see why have this in wordpress editor. If i wanna have a word counter and other goodies, I gonna use a real word procesor.

That's true. Word count is a small feature of a word processor. If we include word counting, then we're showing favouritism by not also turning it into a mini word processor.

(Oh boy, I wrote 'word processor' twice. Both times, I actually wrote 'WordPress', then had to hit backspace and correct it.) :)

@mdawaffe
18 years ago

patch update: this is what's currently running on WP.com

#8 @mdawaffe
18 years ago

  • Owner changed from anonymous to mdawaffe
  • Status changed from new to assigned

Patch updated.

As an aside, since this is completly JS, the feature can be easily disabled by plugin with the following.

wp_deregister_script( 'word-count' );

(Not a mark for/against the idea, just an FYI.)

#9 @matt
18 years ago

+1 in new implementation.

#10 @Otto42
18 years ago

+1. I see no issues with it being on the write page. Okay, so it's bling, but users notice bling. And given that this is extremely minor bling, I'm for it.

#11 @johnbillion
18 years ago

-1. Surely plugin territory. I don't see how this is of any interest to 99% of users.

#12 @johnbillion
18 years ago

Although I -1'd it, I've been testing anyway and there are a couple of bugs with 4807b:

  • Write two or more words, word count is immediately out by one.
  • Write any amount of text, delete some and continue writing, word count is now very wrong.

Trunk at r6054, Firefox 2.0 on Vista, applies to RTE and non-RTE. Affects WP.com too.

#13 @markjaquith
18 years ago

-1 for core. The vast majority of people don't care. Blogs are supposed to liberate writers from the draconian word-count restrictions of their print ancestors.

Plugin.

#14 @filosofo
18 years ago

-1. It seems like a great idea for a plugin. Most users don't care, and those who do probably won't be satisfied anyways unless the count appears publicly.

#15 @PaulGregory
17 years ago

Can I solve the plugin/core dilemma with the "on the fence" solution?

Surely everyone would be happy with:
+1 for Plugin Distributed With Core, like Dolly. Not active by default.

Obviously, only if the plugin is actually adding things up correctly...

#16 @davidszp
17 years ago

+1. I currently use a plugin for this but would love to have it built in. It helps me get a feel for when to stop writing (as I can be wordy). Right now will work for this comment... :-)

#17 @hansengel
17 years ago

+1. I'm sure many people would appreciate a word-counter for many different reasons... if they are posting essays that must be a certain length, et cetera.

#18 @sillybean
17 years ago

I have a word count script that might be of use. It counts correctly, but I'm still learning JS and I don't know yet how to work around IE's broken event handling. Works great in other browsers.

#19 @johnbillion
17 years ago

  • Keywords needs-patch added; has-patch removed

Changing to needs-patch. With the current patch, the live update count becomes incorrect once any text has been deleted.

#20 @pishmishy
17 years ago

  • Milestone changed from 2.5 to 2.6

-1.
There's enough debate to conclude that the feature is in plugin territory. I can see how it may be useful to some authors but I don't see it as something that most blog authors would find useful. I'm going to recommend closing, in any case it should be bumped to 2.6

#21 @markjaquith
17 years ago

  • Milestone 2.6 deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

#22 @michaelpark
17 years ago

  • Milestone set to 2.5.1
  • Priority changed from low to normal
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Version changed from 2.3 to 2.5

I'm in need of this for 2.5. Could anyone update this patch?

#23 follow-up: @ffemtcj
17 years ago

  • Milestone 2.5.1 deleted
  • Resolution set to wontfix
  • Status changed from reopened to closed

This was closed as wontfix. If you need this, you could make a plugin for it.

#24 @Viper007Bond
17 years ago

  • Priority changed from normal to low
  • Version changed from 2.5 to 2.3

#25 in reply to: ↑ 23 @michaelpark
17 years ago

Replying to ffemtcj:

This was closed as wontfix. If you need this, you could make a plugin for it.

I would if I could. :(

#26 @DavidSzp
17 years ago

There is a plugin that does word counting already (but not live, just on save) called Word Statistics, and it also shows some readability numbers as well. I use it on 2.5 and it seems to work fine.

#27 follow-up: @azaozz
17 years ago

  • Keywords has-patch added; needs-patch 2nd-opinion removed
  • Milestone set to 2.5.1
  • Priority changed from low to normal
  • Resolution wontfix deleted
  • Severity changed from trivial to minor
  • Status changed from closed to reopened

Adapted the script from 4807b for WordPress 2.5/TinyMCE 3, also changed the counting regexp to make it faster and added re-counting on pressing Backspace.

@azaozz
17 years ago

#28 in reply to: ↑ 27 ; follow-up: @michaelpark
17 years ago

THANK YOU!

#29 in reply to: ↑ 28 @azaozz
17 years ago

Replying to michaelpark:

THANK YOU!

You're welcome, but it was Matt's idea.

#30 follow-up: @michaelpark
17 years ago

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

#31 in reply to: ↑ 30 @azaozz
17 years ago

Replying to michaelpark:

Count reduction by pressing Backspace key doesn't seem to work, and it's counting punctuations as words if they are followed by a space.

It re-counts on pressing a key after pressing backspace, so if you delete something by holding down backspace, it will re-count when you start typing again. Same as when typing: it increases the count after pressing the space bar, not when it's pressed.

Yes, special characters/punctuation is counted as a word if it's separate from the end of the previous word. So "Hello!" would be 1 word, but "Hello !" would be 2 words. As far as I can tell all word counting works this way (is separate punctuation considered words? Perhaps non-verbal form of expression? Is this a word " :-) "?).

#32 @michaelpark
17 years ago

No, it's not a word. Words should be consist of only alphabets -- no numbers or punctuations.

@azaozz
17 years ago

#33 @azaozz
17 years ago

OK, fixed. Now it only counts words consisting of letters or mixed letters/numbers, no numbers only or any punctuation/special characters. Still supports all extended ASCII characters, like è, é, ë, ñ, ü, etc.

#34 follow-up: @michaelpark
17 years ago

Hmmm, I think it's still counting punctuations as words.

#35 in reply to: ↑ 34 @azaozz
17 years ago

Replying to michaelpark:

Hmmm, I think it's still counting punctuations as words.

Now it strips all characters except the letters and spaces before counting. While typing, it still increases the count on every pressing of the spacebar (as it did before), so the count would go higher if typing numbers for example, but then it's corrected when pressing Enter or after pressing Backspace.

It's not practical to re-count on every pressing of the spacebar as in large posts with a lot of HTML tags on slower computers it would interfere with the speed of typing.

The alternative would be to disable the increase of the count on pressing the spacebar and to update it only on Enter and after Backspace (at the end of each paragraph).

Also tried to make it remember the position of the last full re-count (user pressed Enter), then count only the extra words after that on each pressing of the spacebar (the current paragraph). That would make it more accurate while typing, but if the user goes back and deletes some text, then continues typing without triggering full re-count, it still would be wrong. Can put this back in.

#36 @michaelpark
17 years ago

That's a good idea actually. I can live with having to press enter.

Thanks again!

#37 @matt
17 years ago

  • Keywords blessed added
  • Milestone changed from 2.5.1 to 2.6

@azaozz
17 years ago

#38 @azaozz
17 years ago

Simplified it a bit: now counts only on Enter, or after Backspace or Delete keys are pressed. The word count is updated less frequently but is always right.

#39 @michaelpark
17 years ago

2.5.1 doesn't have this, right?

Feature Request: An option to specify the number of seconds for re-count regardless of when Enter, Backspace and Delete keys are pressed. Or, re-count on automatic save.

#40 @ryan
17 years ago

(In [7854]) Word count from azaozz. see #4807

#41 @ryan
17 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.