May 11, 2013 2:03:43 GMT -5
Allows you to swap a word / piece of text.
Goes into your global footer, or main footer, depending on where you want it to work.
No HTML, it's just for plain text changes.
Examples at the end of the post.
<script>
var swap = (function(){
return {
it: function(a, b){
if(document.createTreeWalker){
var walker = document.createTreeWalker($("#content")[0], NodeFilter.SHOW_TEXT, function(n){
return n.data.match(new RegExp(a, "gi"))? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}, false);
while(walker.nextNode()){
walker.currentNode.data = walker.currentNode.data.replace(new RegExp(a, "gi"), b);
}
} else if(document.body.createTextRange){
var r = document.body.createTextRange();
r.collapse(true);
while(r.findText(a)){
r.text = b;
r.collapse(false);
}
}
}
};
})();
</script>
To use it, call swap.it, the first parameter is what you are searching for, the second is what you will be replacing it with. Note, this case insensitive.
Example:
<script>
swap.it("Posts", "Skittles");
swap.it("Reply", "Reply Now Dammit!!");
</script>
Can add as many as you want.
Any issues, just post.
Code by Peter.
Nov 6, 2013 7:46:55 GMT -5
@stinky666 i posted both codes in global footer and it aint working