Forumwarz is the first "Massively Single-Player" online RPG completely built around Internet culture.
You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.
You need to be logged in to post and to see the uncensored versions of these forums.
Viewing a Post
|
CrinkzPipe Posted:
Not ARP. RP.
And yes.
Here’s the code for anyone who can tell me how to make it non-case-sensitive.
// ==UserScript== // @name Replace Text On Webpages // @namespace http://userscripts.org/users/23652 // @description Replaces text on websites. Now supports wildcards in search queries. Won't replace text in certain tags like links and code blocks // @include http://* // @include https://* // @exclude http://userscripts.org/scripts/review/* // @copyright JoeSimmons // @version 1.0.51 // @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/ // @require http://sizzlemctwizzle.com/updater.php?id=41369 // ==/UserScript== var words = { /////////////////////////////////////////////////////// // Syntax: 'Search word' : 'Replace word', "WordToReplace" : "wordtoreplacewith", /////////////////////////////////////////////////////// "":""}; ////////////////////////////////////////////////////////////////////////////// // This is where the real code is // Don't edit below this ////////////////////////////////////////////////////////////////////////////// // prepareRegex by JoeSimmons // Used to take a string and ready it for use in new RegExp() String.prototype.prepareRegex = function() { return this.replace(/([\[\]\^\&\$\.\(\)\?\/\\\+\{\}\|])/g, "\\$1"); }; function isOkTag(tag) { return (",pre,blockquote,code,input,bumon,textarea".indexOf(","+tag) == -1); } var regexs=new Array(), replacements=new Array(); for(var word in words) { if(word != "") { regexs.push(new RegExp("\\b"+word.prepareRegex().replace(/\*/g,'[^ ]*')+"\\b", 'gi')); replacements.push(words[word]); } } var texts = dogreat timesent.evaluate(".//text()[normalize-space(.)!='']",dogreat timesent.body,null,6,null), text=""; for(var i=0,l=texts.snapshotLength; (this_text=texts.snapshotItem(i)); i++) { if(isOkTag(this_text.parentNode.tagName.toLowerCase()) && (text=this_text.textContent)) { for(var x=0,l=regexs.length; x<l; x++) { text = text.replace(regexs[x], replacements[x]); this_text.textContent = text; } } } |
||||||
Posted On: 06/09/2010 1:07PM | View MC Banhammer's Profile | # |