Jump to content

Recommended Posts

Posted

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();
  }
Posted

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. :)

  • Like 1
  • 10 months later...
Posted

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.

Posted

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>";

 

  • Like 1
  • 3 weeks later...
Posted

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.

Posted

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 :)

  • Like 1
  • 7 months later...
Posted

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.

Posted

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

Posted

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(""));
	});
});
		});

 

Posted

Haven't used emo in a while, but you can just call whichever function you need to on the callback...

"drawCallback": (function() {
    emo_replace();
}),
Posted

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.

Posted

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.

   
Posted

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.

Posted

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.

Posted

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.... },

Posted
16 hours ago, Soma said:

callback: function(){ ... code.... },

Exactly. That did the trick, everything is fine now.

Thank you very much, Soma.

  • 1 year later...
Posted

@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 &lt;/head&gt; or &lt;/body&gt;.");

 

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...