inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 20, 2012 16:04:27 GMT -8
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.
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 21, 2012 10:20:42 GMT -8
Thanks. 2 questions:
1. It does not work when part of the text we are trying to switch has a link in it. Is their anyway to fix this? 2. Could we have it in the form of a plug-in? Thanks. It is not a big deal though, I know you are busy.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 21, 2012 15:55:31 GMT -8
1. Text only nodes. 2. If someone else wishes to use it in a plugin where you could specify the words, then sure.
If I find time over the weekend, I'll convert it to a plugin.
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 21, 2012 20:05:24 GMT -8
1. Text only nodes. 2. If someone else wishes to use it in a plugin where you could specify the words, then sure. If I find time over the weekend, I'll convert it to a plugin. 1. What are nodes? 2. Thanks a lot
|
|
inherit
167641
0
Apr 22, 2020 14:34:12 GMT -8
Kent Laiton
193
June 2011
bxrxw
|
Post by Kent Laiton on Nov 22, 2012 10:16:26 GMT -8
Hello, if possible, could you make a Swap It Script for replacing text with images? I would like to use it to replace category names with images, and I know it's possible with the Multicolored Categories Plugin to add images but they'll only be 30px in height and I'd like them to be bigger. (700px × 125px) Thanks in advance. :]
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 22, 2012 16:39:46 GMT -8
Hello, if possible, could you make a Swap It Script for replacing text with images? I would like to use it to replace category names with images, and I know it's possible with the Multicolored Categories Plugin to add images but they'll only be 30px in height and I'd like them to be bigger. (700px × 125px) Thanks in advance. :] For this code, it will do text only, it stays true to what the original "Switch It" code does that I created 7 years ago (wow lol). Edit: Feel free to ask in a new thread though
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 22, 2012 17:00:03 GMT -8
I made it into a plug-in myself, it is not that good though. It is my first plugin, and I spent 5 hours on it. Here it is: support.proboards.com/thread/432956/If you want to improve it, I can send you an unlocked copy.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 22, 2012 17:32:28 GMT -8
I made it into a plug-in myself, it is not that good though. It is my first plugin, and I spent 5 hours on it. Here it is: support.proboards.com/thread/432956/If you want to improve it, I can send you an unlocked copy. No offence, but with that copyright added to the forum footer, and copyrighting the whole plugin with minimal input from yourself (aka my script done it all). Then I would rather you removed the script and created your own, that way you can do what you like with the plugin and copyrights.
|
|
inherit
167641
0
Apr 22, 2020 14:34:12 GMT -8
Kent Laiton
193
June 2011
bxrxw
|
Post by Kent Laiton on Nov 23, 2012 7:20:56 GMT -8
Hello, if possible, could you make a Swap It Script for replacing text with images? I would like to use it to replace category names with images, and I know it's possible with the Multicolored Categories Plugin to add images but they'll only be 30px in height and I'd like them to be bigger. (700px × 125px) Thanks in advance. :] For this code, it will do text only, it stays true to what the original "Switch It" code does that I created 7 years ago (wow lol). Edit: Feel free to ask in a new thread though Ah okay, I understand. :] And I will.
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 23, 2012 10:40:44 GMT -8
I made it into a plug-in myself, it is not that good though. It is my first plugin, and I spent 5 hours on it. Here it is: support.proboards.com/thread/432956/If you want to improve it, I can send you an unlocked copy. No offence, but with that copyright added to the forum footer, and copyrighting the whole plugin with minimal input from yourself (aka my script done it all). Then I would rather you removed the script and created your own, that way you can do what you like with the plugin and copyrights. Okay, sorry. If I remove the message at the bottom of the forum, and put something in the plug-in description that says: Can I re-post it? Thanks.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 23, 2012 11:55:01 GMT -8
I don't need credit, I posted the code to be used by anyone, it's just the way you gone about it with the copyrighting when all the work is done by my script.
If you add made extra additions, and added more of your own code to enhance the plugin, then copyrighting it is fine.
For a credit, just link to the topic if you feel the needed too.
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 25, 2012 11:46:14 GMT -8
I don't need credit, I posted the code to be used by anyone, it's just the way you gone about it with the copyrighting when all the work is done by my script. If you add made extra additions, and added more of your own code to enhance the plugin, then copyrighting it is fine. For a credit, just link to the topic if you feel the needed too. Huh? If you want credit, that's fine. You said you didn't need credit, yet, you don't like how I copied the code. What else do you want me to do?
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 25, 2012 12:18:03 GMT -8
I don't need credit, I posted the code to be used by anyone, it's just the way you gone about it with the copyrighting when all the work is done by my script. If you add made extra additions, and added more of your own code to enhance the plugin, then copyrighting it is fine. For a credit, just link to the topic if you feel the needed too. Huh? If you want credit, that's fine. You said you didn't need credit, yet, you don't like how I copied the code. What else do you want me to do? I think you need to re-read what has been said in this topic and your other one, because you are clearly not understanding what you have done at all.
|
|
flyoffacliff
Junior Member
My post count here is 592 posts too low.
Posts: 261
inherit
182684
0
Jul 23, 2015 21:30:54 GMT -8
flyoffacliff
My post count here is 592 posts too low.
261
September 2012
flyoffacliff
|
Post by flyoffacliff on Nov 28, 2012 13:50:29 GMT -8
Huh? If you want credit, that's fine. You said you didn't need credit, yet, you don't like how I copied the code. What else do you want me to do? I think you need to re-read what has been said in this topic and your other one, because you are clearly not understanding what you have done at all. Okay, I re-read this topic... What about it? I don't know what other topic you are talking about. Is is not that difficult, could you please select an option from this multiple choice list: A. Allow flyoffacliff to repost the code in current condition. B. Allow flyoffacliff to repost the code with certain changes made such as credit being added. C. Do not allow flyoffacliff to re-post the code at all. Even though he already spent 5 hours on it, and Peter said he was going to do the same thing over the weekend. D. None of the above / Other I would prefer option A or B, but you have the legal right to select option C. I was really proud of myself for making it though. Since I have no programming skills. I can not simply "re-write" it. That choice is yours.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Nov 28, 2012 14:18:40 GMT -8
DBecause you haven't took the time to understand the issue, the answer is no, you may not include it with any of your plugins.
|
|