Beluga Posted July 27, 2015 Posted July 27, 2015 I think you are talking about a different issue than joey102030 as you are using PageTable. My complete code: $kuvaus = ''; $tapahtumat = $pages->find("template=tapahtuma, sort=paivamaara"); foreach($tapahtumat as $tapahtuma) { $kuvaus .= $tapahtuma->render(); }
Beluga Posted July 30, 2015 Posted July 30, 2015 Bah! I mixed this with the other EMO module! This is what I've been using all the time, without any problems with render: https://github.com/BlowbackDesign/emo https://processwire.com/talk/topic/2916-email-obfuscation-emo/ Andreas: did you try it? 1
AndZyk Posted July 31, 2015 Posted July 31, 2015 Thank you, I didn't knew about this module. I just tried it out and it seems to work fine with my rendered output from the PageTable-Field. 1
tpr Posted June 27, 2016 Posted June 27, 2016 Old topic update: here's a plain JavaScript version of the module JS for those who don't use jQuery: https://github.com/rolandtoth/EmailObfuscator/blob/master/EmailObfuscator.js 2
joe_ma Posted June 28, 2016 Posted June 28, 2016 I have some kind of database in processwire that contains a whole lot of pages with addresses. These addresses are output in a table by a template that gets all the relevant information from these pages. To obfuscate the email addresses coming out of the database I use this module. Something seems to go wrong though, because the part in the <a> tag is not obfuscated, only the link part. This is what the source code of the page looks like: <a href='mailto:blb.op.biel-bienne@erz.be.ch' class='link_mail'><span style="unicode-bidi:bidi-override; direction: rtl;" class="email-obfuscator-unreverse">hc.eb.zre@enneib-leib.po.blb</span></a> And this is the line from the template, that outputs the email address: if($l->adr_email) $out .= "<a href='mailto:$l->adr_email' class='link_mail'>$l->adr_email</a> <br>"; The module is configured so that the javascript is being inserted before the </body> tag.
Soma Posted July 1, 2016 Posted July 1, 2016 I think actually the problem is in the details. The module's regex doesn't seem to account for href=' only for href=" So this should be: if($l->adr_email) $out .= "<a href=\"mailto:$l->adr_email\" class='link_mail'>$l->adr_email</a> <br>"; 1
Soma Posted July 1, 2016 Posted July 1, 2016 I just updated the module to support also href='mailto 2
tpr Posted July 19, 2016 Posted July 19, 2016 A minor feature request: make the loading of the JavaScript optional. This could be achieved emptying the script_location field, but the module uses the default value when doing this. I load the JS dynamically using JS, that's why I have a need for this.
Soma Posted July 19, 2016 Posted July 19, 2016 @tpr http://modules.processwire.com/modules/email-obfuscation/ does what you need. I'm not the creator of this module, and have no plans to develop it further. I will gladly take pull request if anyone has the time to do so.
tpr Posted July 19, 2016 Posted July 19, 2016 Ok, thanks. It's not the first time I got into this trap, these two modules are easy to mix It seems that EMO also has an issue in what I try to achieve. It adds an inline script at the bottom that tries to call a function which is unavailable if I load the module's JS manually. It seems that there are two PMs to make :) 1
joe_ma Posted March 15, 2017 Posted March 15, 2017 I encounter problems using this module and jquery datatables together. Datatables is used to filter and paginate big address lists. The problem: EmailObfuscator works nicely on the first page of the paginated addresses. But it doesn't on the following pages of the paginated address table. Email addresses on the first page are correctly resolved to links like "mailto:name@domain.com". From the second page of the paginated table onward links keep the "GOSPAM:" prefix and the email address is following in reverse. jquery and datatables scripts are called before the </body> tag, as is EmailObfuscator. My script for the datatables looks like this: $("#myTable").DataTable( { paging: true, lengthChange: false, pageLength: 5, pagingType: "simple_numbers", info: false, responsive: true, language: { search: "_INPUT_", zeroRecords: "Ihre Suche ergab kein Resultat<br>Votre recherche n'a pas reçu des resultats", searchPlaceholder: "Tabelle filtern nach … / filtrer le tableau pour …", paginate: { previous: '‹', next: '›' }, aria: { paginate: { previous: 'Previous', next: 'Next' } } } }); Thanks for help.
Macrura Posted March 15, 2017 Posted March 15, 2017 you would likely have to re-init the js on the DT page change - look at the drawCallback and then in that callback function you can re-init the js for EMO
joe_ma Posted March 16, 2017 Posted March 16, 2017 Thanks Macrura I am not sure how to do this though … Would this be correct? $("#myTable").DataTable( { paging: true, lengthChange: false, pageLength: 5, pagingType: "simple_numbers", info: false, responsive: true, language: { search: "_INPUT_", zeroRecords: "Ihre Suche ergab kein Resultat<br>Votre recherche n'a pas reçu des resultats", searchPlaceholder: "Tabelle filtern nach … / filtrer le tableau pour …", paginate: { previous: '‹', next: '›' }, aria: { paginate: { previous: 'Previous', next: 'Next' } } } "drawCallback": (function() { // restore mailto: links $("a[href^='GOSPAM:']").each(function(){ var email = $(this).attr("href").substr(7); // replace email with its reversed version email = email.split("").reverse().join(""); // replace "GOSPAM:" with "mailto:" $(this).attr("href","mailto:" + email); }); $(".email-obfuscator-unreverse").each(function() { $(this).replaceWith($(this).text().split("").reverse().join("")); }); }); });
Macrura Posted March 16, 2017 Posted March 16, 2017 Haven't used emo in a while, but you can just call whichever function you need to on the callback... "drawCallback": (function() { emo_replace(); }),
joe_ma Posted March 16, 2017 Posted March 16, 2017 Hmm … I just became aware, that this problem doesn't occur on my local installation, only on the live server. And with the drawCallback function on the live server, pagination doesn't work any more.
Soma Posted March 17, 2017 Posted March 17, 2017 Please! You guys mix up those two modules "EmailObfuscation" and "EmailObfuscator" This thread is for http://modules.processwire.com/modules/email-obfuscator/. The other is http://modules.processwire.com/modules/email-obfuscation/ alias EMO, There's no "EMO" and such in this module.
joe_ma Posted March 17, 2017 Posted March 17, 2017 I don't think so, at least I don't. The module I use is Email Obfuscator and the link for «more information» on this module lead me to this thread.
Soma Posted March 17, 2017 Posted March 17, 2017 No you asked in the correct forum, I meant the other guys. Unfortunately I also don't have an answer to your problem, except that if the result are loaded via ajax, the JS needs to be executed again somehow after load.
joe_ma Posted March 17, 2017 Posted March 17, 2017 I am releaved! I think the problem is that dataTables modifies the DOM when you navigate to another table page. So the obfuscator only «sees» the addresses of the first table page and resolves them to their correct email address. So I thought it was a good idea to call EmailObfuscator before the </head> tag instead of the </body> tag. But this doesn't work either. In this case not even the emails of the first table page are being resolved.
Soma Posted March 17, 2017 Posted March 17, 2017 You seem to have the callback wrong. It should be a funtion not a self executing closure... (function(){}) ... dont just copy the code into the callback. A callback in this case is usually always just a anonymous function. Example: callback: function(){ ... code.... },
joe_ma Posted March 18, 2017 Posted March 18, 2017 16 hours ago, Soma said: callback: function(){ ... code.... }, Exactly. That did the trick, everything is fine now. Thank you very much, Soma.
PWaddict Posted January 14, 2019 Posted January 14, 2019 @Soma Please update the module with the following fix to avoid breaking "Live Search" in Languages. Replace the 92 line with this: $field->notes = __("Example </head> or </body>."); 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now