PluginProbe ʕ •ᴥ•ʔ
Email Encoder – Protect Email Addresses and Phone Numbers / 0.40
Email Encoder – Protect Email Addresses and Phone Numbers v0.40
2.5.0 2.4.8 trunk 0.10 0.11 0.12 0.20 0.21 0.22 0.30 0.31 0.32 0.40 0.41 0.42 0.50 0.60 0.70 0.71 0.80 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.5 1.5.2 1.51 1.53 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7
email-encoder-bundle / js / email-encoder-bundle.js
email-encoder-bundle / js Last commit date
email-encoder-bundle.js 15 years ago
email-encoder-bundle.js
65 lines
1 // Email Encoder Bundle Plugin
2 jQuery(function( $ ){
3
4 var prevEmail, getEncoded,
5 $wrap = $( 'div.email-encoder-form' ),
6 $email = $wrap.find( '#email' ),
7 $display = $wrap.find( '#display' );
8
9 // hide output
10 $wrap.find( '.nodis' ).hide();
11
12 // auto-set display field
13 $email.keyup(function(){
14 var email = $email.val(),
15 display = $display.val();
16
17 if ( ! display || display == prevEmail )
18 $display.val( email );
19
20 prevEmail = email;
21 });
22
23 // get encoded email ( ajax call )
24 getEncoded = function () {
25 // stop when email field is empty
26 if ( ! $email.val() )
27 return;
28
29 // empty output
30 $wrap.find( '#encoded_output' ).val( '' );
31
32 // get the encoded email link
33 $.get( '', {
34 ajax: true,
35 email: $email.val(),
36 display: $display.val() || $email.val(),
37 method: $wrap.find( '#encode_method' ).val()
38 },
39 function(data){
40 $wrap.find( '#encoded_output' ).val( data );
41 $wrap.find( '.output' ).slideDown();
42 });
43 };
44
45 // get encoded link on these events
46 $wrap.find( '#email, #display' ).keyup(function(){
47 // show example how it will appear on the page
48 $wrap.find( '#example' ).html( '<a href="mailto:'+ $email.val() +'">'+ $display.val() +'</a>' );
49
50 // clear code field
51 $wrap.find( '.output' ).slideUp();
52 $wrap.find( '#encoded_output' ).val( '' );
53 })
54 .keyup();
55
56 $wrap.find( '#encode_method' ).bind( 'change keyup', function(){
57 getEncoded();
58 });
59
60 $wrap.find( '#ajax_encode' ).click(function(){
61 getEncoded();
62 });
63
64 });
65