I’m not militant about punctuation but i do find it annoying when people write things with lots of exclamation points. So i created a Greasemonkey script that turns anything more than two exclamation points into just one. Greasemonkey has to be installed and you need to be using Firefox in order for this to work. If you have them both already then grab my excessive exclamation points script. There is some excessive punctuation below for you to test. After you have installed the script just refresh this page and you should see the exclamation points disappear from this post’s title and the lines below.
Two exclamation points!!
Ten exclamation points!!!!!!!!!!
Five exclamation points and a number one!!!!!1
Forty Two!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I’ve also uploaded the script to userscripts.org here.
(Thank you for all the code suggestion and corrections!)
Nice script,
but why not use RegExp the way they’re meant.
If you use “!+” as a pattern it will replace strings of !’s of any length >0. Even greater than 42. :)
I love this script!!!!!!!!!!!!!!!! And it works as well.
Larixk – Thanks for the tip. I’m definitely not a coder.
Regarding this line: for (var i = 0; i
Ergh, it ate my post. :(
Regarding this line: for (var i = 0; i %lt; textnodes.snapshotLength; i++)
I’d be a liar if I said I knew what snapshotLength does. I can’t help but think, though, that assigning textnodes.snapshotLength to a variable before hitting the loop would be faster than having to compute textnodes.snapshotLength every time. Especially on pages with lots of text nodes.
Great script!
Multiple exclamation points annoy me very much and it’s good to see that somebody came up with a solution for this.
[...] Eliminate extra exclamation points!!! on Zieak’s Blog [...]
Nice–thanks!!!
// ==UserScript==
// @name Eliminate excessive exclamation points
// @namespace http://www.zieak.com
// @description Turns exclamation points into just one
// @include *
// ==/UserScript==
(function() {
var regex, textnodes, node, length;
textnodes = document.evaluate( “//body//text()”, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
length = textnodes.snapshotLength;
regex = new RegExp(’![!1]+’, ‘g’);
for (var i = 0; i
[...] Over on digg, I saw a very Mattie-like script for GreaseMonkey/Firefox– it’s used to eliminate extra exclamation points on webpages. Using this, now I never have to look at web sites with painful exclamations. This is a comforting thought. [...]
Are you serious?
(function(){
for (var nodes = document.selectNodes(’//body//text()[contains(.,"!!")]‘), i = 0, node; node = nodes[i]; i++)
node.data = node.data.replace(/!!+/g, ‘!’);
})()
Not sure if Firefox supports selectNodes
This blog post was linked on Lifehacker, and there were alot of comments there “challenging” what it couldn’t do. I took a few minutes to add a few patterns to deal with those cases as well.
Here, enjoy some more regexes (drop these into the script in place of the existing portion)
This should cover ??????, !?!?!?!?!, and !!!11!!!!!11!!1!1
http://www.doorknobsoft.com/codetests/exclam_regex.txt
thanks. my hero.
Thanks Billy – i wanted to include a way to fix those also but making those changes doesn’t seem to work for me.
[...] Today’s download is a Greasemonkey script for Firefox that removes excessive exclamation points from websites. One thing I hate about the Internet even more than msypace is when is LOL!!!!!!!! somewhere. This script, once installed, removes the annoyingly high number of exclamation points, leaving you with just one (so LOL!!!!!!!! become LOL!, which is marginally less annoying). [...]
[...] OMG!!!! If you’re just as sick as I am of seeing excessive exclamation points on the web (!!!), automatically eliminate ‘m with the Excessive Exclamation Point Greasemonkey script!!! This only works in Firefox!!! [...]
[...] And just for fun, a nifty little Greasemonkey script for getting rid of the extra exclamation points seen on LJ, myspace, and anywhere else people don’t get that it just takes one to express excitement (and for those that mock them as well). [...]
Wow, great app. I’m going to link you to my blog.
-Joe
[...] Eliminate extra exclamation points!!! on Zieak’s Blog [...]
[...] Eliminate extra exclamation points!!! on Zieak’s Blog Greasemonkey script to eliminate extra exclamation points!!!!!!!!!!!!!!!!!!!! Categories: The Copyright Convention [...]
My coding knowledge is virtually nil, or I’d take a stab at this myself, so here’s a suggestion.
Is there any way to make the replacement exclamation mark colored? Maybe a dark red so it’s noticeable without being blatant?
Good idea – I’ll take a stab at it sometime and if i get it working i’ll email you and let you know.
This one makes sence “One’s first step in wisdom is to kuesstion everything – and one’s last is to come to terms with everything.”
Great! And I would just love to hav the same kind of script for interrogation marks.