Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
Spam Free Way Of Posting Full Email Address?
This is a discussion on Spam Free Way Of Posting Full Email Address?, within the Javascript section. This forum and the thread "Spam Free Way Of Posting Full Email Address?" are both part of the Programming Your Website category.
![]() ![]() |
Oct 28 2008, 01:30 PM
Post
#1
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
Does anyone know of a simple script that would change the [at] as below to a proper @ simple? Obviously, JavaScript is the job.
edmund[at]simplifiedimpact.com I've seen it done before, just can't remember where. Thanks, Ed. |
|
|
Oct 28 2008, 03:07 PM
Post
#2
|
|
![]() Don deluzione ![]() Posts: 1,175 Joined: 13-February 08 From: Canada eh? |
-------------------- |
|
|
Oct 28 2008, 04:45 PM
Post
#3
|
|
![]() Squeeze Machine ![]() Posts: 510 Joined: 7-October 08 From: Australia |
It's interesting how much focus email obfuscation gets around the place. Use it wisely/carefully though, especially if your content sometimes appears in places you don't control (i.e. Google Reader, other feed readers, etc.) as it can look pretty weird sometimes. I read a blog post once about email obfuscation, and it made no sense, cause I was reading it in Google Reader. The poster's example of "me@myemail.com" looked like "email<NOSPAM>@</NOSPAM>myemail<NOSPAM>.com</NOSPAM>", until I went and looked at the original post.
-------------------- The more you visit, the more I'll post: http://japheththomson.com/
|
|
|
Oct 28 2008, 05:32 PM
Post
#4
|
|
![]() Don deluzione ![]() Posts: 1,175 Joined: 13-February 08 From: Canada eh? |
It's interesting how much focus email obfuscation gets around the place. Use it wisely/carefully though, especially if your content sometimes appears in places you don't control (i.e. Google Reader, other feed readers, etc.) as it can look pretty weird sometimes. I read a blog post once about email obfuscation, and it made no sense, cause I was reading it in Google Reader. The poster's example of "me@myemail.com" looked like "email<NOSPAM>@</NOSPAM>myemail<NOSPAM>.com</NOSPAM>", until I went and looked at the original post. Yeah, but when you use a feed reader, you know you can expect those kind of quirks.. That's why you should read the original in the first place. Designers put a lot of effort in the design, just so you can see it.. so GO SEE IT! -------------------- |
|
|
Oct 28 2008, 05:44 PM
Post
#5
|
|
![]() Squeeze Machine ![]() Posts: 510 Joined: 7-October 08 From: Australia |
That's very much a designer's response
-------------------- The more you visit, the more I'll post: http://japheththomson.com/
|
|
|
Oct 28 2008, 06:41 PM
Post
#6
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
Thanks, but I'm interested in one that just replaces '[at]' with '@'. And, um, I'm so bad with JavaScript, and PHP, so when you link me to something I'd appreciate if you could explain where to put what, like if there's PHP, where do I put it, and where do I put the JS, etc, etc. Or else it's just pointless... Thanks, Ed. |
|
|
Oct 28 2008, 07:19 PM
Post
#7
|
|
![]() Don deluzione ![]() Posts: 1,175 Joined: 13-February 08 From: Canada eh? |
Thanks, but I'm interested in one that just replaces '[at]' with '@'. And, um, I'm so bad with JavaScript, and PHP, so when you link me to something I'd appreciate if you could explain where to put what, like if there's PHP, where do I put it, and where do I put the JS, etc, etc. Or else it's just pointless... Thanks, Ed. Oh, pretty simple.. read the page, and you're done Type the mailaddress in the text-field, copy the javascript code, and paste it in the html where you want to show the email address. Done.. -------------------- |
|
|
Oct 28 2008, 07:36 PM
Post
#8
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
That one makes my Accordian on my page fail.
Do you have any other, easy ones? Thanks. |
|
|
Oct 28 2008, 07:51 PM
Post
#9
|
|
![]() Squeeze Machine ![]() Posts: 510 Joined: 7-October 08 From: Australia |
CODE <script src="/js/jquery.js"></script> <script> $(document).ready(function () { $('body *').each(function () { $(this).text($(this).text().replace('[at]', '@')); }); }); </script> Try that? It's pretty simple, and probably will have limited application, but it does what you're hoping for I think!! Obviously you'll need to have jQuery in the right place, as the first line shows (adjust the first line for your situation). -------------------- The more you visit, the more I'll post: http://japheththomson.com/
|
|
|
Oct 28 2008, 07:56 PM
Post
#10
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
Forgive me! I'm obviously doing something wrong..
Here's the page: http://simplifiedimpact.com/653757/contact/ It's the code that's lower down in the page (the first, similar looking bit is for users with JavaScript off), like the one below. CODE <div class="ccontent"> <script type="text/javascript"> $(document).ready(function () { $('body *').each(function () { $(this).text($(this).text().replace('[at]', '@')); }); }); </script> <div class="boldpush"> Get Information </div> <div class="pushanswer"> info[at]simplifiedimpact.com </div> <div class="boldpush"> Say Hello </div> <div class="pushanswer"> hello[at]simplifiedimpact.com </div> <div class="boldpush"> Client Login </div> <div class="pushanswer"> simplifiedimpact.clientsection.com </div> </div> </div> <!-- END OF RIGHT --> Thanks, Ed. |
|
|
Oct 28 2008, 08:12 PM
Post
#11
|
|
![]() Squeeze Machine ![]() Posts: 510 Joined: 7-October 08 From: Australia |
Hmm... the javascript I posted above should appear in between your <head></head> tags, after the other script includes. See if that helps first of all
-------------------- The more you visit, the more I'll post: http://japheththomson.com/
|
|
|
Oct 28 2008, 08:17 PM
Post
#12
|
|
![]() Squeeze Machine ![]() Posts: 766 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
Going through the every element contained within the body and applying a function to every single one is not very efficient.
It is unlikley that you will ever have thousands of emails in your page so why not wrap each email in a span and give it a not-so-obvious class. Then you can use CODE <div class="ccontent"> <script type="text/javascript"> $(document).ready(function () { $('.swapper').each(function () { $(this).html( $(this).html().replace('[at]', '@') ); }); }); </script> <div class="boldpush"> Get Information </div> <div class="pushanswer"> <span class="swapper">info[at]simplifiedimpact.com</span> </div> <div class="boldpush"> Say Hello </div> <div class="pushanswer"> <span class="swapper">hello[at]simplifiedimpact.com</span> </div> <div class="boldpush"> Client Login </div> <div class="pushanswer"> s<span class="swapper">implifiedimpact.clientsection.com</span. </div> </div> </div> <!-- END OF RIGHT --> I have added spans to that markup above but you can just as easily use the class "pushanswer" that already exists. The reason you were getting problems with things like accordions is that you are replacing the text found in every element regardless of if it has an email address contained within not. This will mean that some event handlers and things would be replaced on functions you have already bound. The above method is much safer and more efficient as it is targeting only the spans you set as email addresses. -------------------- |
|
|
Oct 28 2008, 08:25 PM
Post
#13
|
|
![]() Squeeze Machine ![]() Posts: 510 Joined: 7-October 08 From: Australia |
Absolutely better than my solution... I thought as I was doing it "this is so inefficient... I should mention an identifying class..." but then I got side-tracked!
-------------------- The more you visit, the more I'll post: http://japheththomson.com/
|
|
|
Oct 28 2008, 08:34 PM
Post
#14
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
The thing is though, it's just not working.
Any ideas? Ed. |
|
|
Oct 28 2008, 08:43 PM
Post
#15
|
|
![]() Squeeze Machine ![]() Posts: 766 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
I saved your page and without modifying a single thing, it works for me locally. This means that one of thje following scripts s either hijacking the $ global variable or has a fatal error
CODE <script src="../js/accordion.js" type="text/javascript"></script> <script src="../js/form.js" type="text/javascript"></script> <script src="../js/yesscript.js" type="text/javascript"></script> <script src="../js/mail.js" type="text/javascript"></script> Using Firbug on your site I found that in yesscript.js there is a fatal error CODE Error: $(document) is null Source File: http://simplifiedimpact.com/653757/js/yesscript.js Line: 1 Error: syntax error Source File: http://simplifiedimpact.com/653757/js/mail.js Line: 2 Source Code: } Error: $(document) is null Source File: http://simplifiedimpact.com/653757/contact/ Line: 356 This is causing your latest script to fail because JavaScript has packed up by this stage. Fix the above errors and the rest will work -------------------- |
|
|
Oct 28 2008, 08:54 PM
Post
#16
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
As I said, I am SHOCKINGLY hopeless with JavaScript, and have no idea what those errors mean.
HELP! Ed. |
|
|
Oct 28 2008, 09:01 PM
Post
#17
|
|
![]() Squeeze Machine ![]() Posts: 766 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
In you mail.js file remove the first }
That should do it. -------------------- |
|
|
Oct 28 2008, 09:07 PM
Post
#18
|
|
|
Squeezing ![]() ![]() ![]() Posts: 65 Joined: 24-February 08 |
Uh, nope.
Sorry about this. Any other ideas? Thanks, Ed. |
|
|
Oct 28 2008, 09:53 PM
Post
#19
|
|
![]() Squeeze Machine ![]() Posts: 766 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
Well the only thing that could be causing the problem now is your accordion script. Remove that for a second and see if the script works. I can't help with debugging that code though because it is minified and encoded.
-------------------- |
|
|






Oct 28 2008, 01:30 PM









