Godfrey Daniel says: I'm going to try to edit this script to include other excessive punctuation. Can't figure why the author would write this and leave out question marks. Done, Godfrey: // Based on a script in Mark Pilgram's upcoming "Dive into Greasemonkey", as well as "renamer" // ==UserScript== // @name Eliminate excessive exclamation points // @namespace http://www.zieak.com // @description Turns 2-42 exclamation points into just one // @include * // ==/UserScript== // Why 42? We should ask Earth before it is too late. (function() { var replacements, regex, key, textnodes, node, s; replacements = { "!{2,}": "!", "\\?{2,}": "?", "\\.{4,}": "...", }; regex = {}; for (key in replacements) { regex[key] = new RegExp(key, 'g'); } textnodes = document.evaluate( "//body//text()", document, null, XPath... A better version: replacements = { "!+": "!", "\\?+": "?", "\\?(?:\\?|!)+": "?", "!(?:\\?|!)+": "!", "![!1]+": "!", "\\.{4,}": "...", }; Yeah, thanks, I just did it myself, but I like your second version better. Unfortunately doesn't appear to be working here at The Clip. My mistake. I had an error in the code. Nice. Hey Kankamuso, how about writing one for smileys? I can tweak and edit with some success, but have never written one from scratch. I can tweak and edit with some success, but have never written one from scratch.Mr Daniel, regular expressions or javascript? I'm definitely at fault of this one. What do you exactly mean with the smileys, Godfrey? Wipe them out completely? Completely BTW, if you could point me to a quick and slick tutorial on how to write these things, I would appreciate it. Hey Godfrey, is that crazy ostrich chick still after you? You've been gone for days. This is great! And thanks to Kankamuso for the code. |
View the Top Clips from January 20, 2007
Embed This Clip In Your Site...
|
||||||||||||
|
|
|||||||||||||