PluginProbe ʕ •ᴥ•ʔ
Email Encoder – Protect Email Addresses and Phone Numbers / 0.21
Email Encoder – Protect Email Addresses and Phone Numbers v0.21
2.5.2 2.5.1 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
124 lines
1 (function( $ ){
2
3 $(function(){
4
5 /**
6 * Encoded Form
7 */
8 (function(){
9 var prevEmail, getEncoded,
10 $wrap = $( 'div.email-encoder-form' ),
11 $email = $wrap.find( '#email' ),
12 $display = $wrap.find( '#display' );
13
14 // hide output
15 $wrap.find( '.nodis' ).hide();
16
17 // auto-set display field
18 $email.keyup(function(){
19 var email = $email.val(),
20 display = $display.val();
21
22 if ( ! display || display == prevEmail )
23 $display.val( email );
24
25 prevEmail = email;
26 });
27
28 // get encoded email ( ajax call )
29 getEncoded = function () {
30 // stop when email field is empty
31 if ( ! $email.val() )
32 return;
33
34 // empty output
35 $wrap.find( '#encoded_output' ).val( '' );
36
37 // get the encoded email link
38 $.get( '', {
39 ajax: true,
40 email: $email.val(),
41 display: $display.val() || $email.val(),
42 method: $wrap.find( '#encode_method' ).val()
43 },
44 function(data){
45 $wrap.find( '#encoded_output' ).val( data );
46 $wrap.find( '.output' ).slideDown();
47 });
48 };
49
50 // get encoded link on these events
51 $wrap.find( '#email, #display' ).keyup(function(){
52 // show example how it will appear on the page
53 $wrap.find( '#example' ).html( '<a href="mailto:'+ $email.val() +'">'+ $display.val() +'</a>' );
54
55 // clear code field
56 $wrap.find( '.output' ).slideUp();
57 $wrap.find( '#encoded_output' ).val( '' );
58 })
59 .keyup();
60
61 $wrap.find( '#encode_method' ).bind( 'change keyup', function(){
62 getEncoded();
63 });
64
65 $wrap.find( '#ajax_encode' ).click(function(){
66 getEncoded();
67 });
68 }());
69
70 /**
71 * Admin Panel
72 */
73 (function(){
74 // skip rest when not admin
75 if ( $( '#adminmenu' ).size() == 0 )
76 return;
77
78 // prevent toggle when dragging
79 var toggle = true;
80
81 // set info text for selected encoding method
82 $( '.method-info-select' ).bind( 'change blur keyup', function(){
83 var method = $( this ).val(),
84 $desc = $( this ).parent().find( 'span.description' );
85
86 if ( methodInfo && methodInfo[ method ] ) {
87 $desc.html( methodInfo[ method ][ 'description' ] || '' );
88 } else {
89 $desc.html( '' );
90 }
91 })
92 .blur();
93
94 // set sortable boxes
95 $( '.meta-box-sortables' ).sortable({
96 items: '.postbox',
97 handle: 'h3',
98 placeholder: 'sortable-placeholder',
99 forcePlaceholderSize: true,
100 stop: function () {
101 toggle = false;
102 }
103 });
104
105 // set box content toggle
106 $( 'h3.hndle, div.handlediv' ).click(function(){
107 if( toggle )
108 $( this ).parent().find( '.inside' ).toggle();
109
110 toggle = true;
111 });
112
113 // set margins
114 $( 'div.postbox div.inside' )
115 .css({ 'margin-left': '10px', 'margin-right': '10px' });
116
117 // add form-table class to Encoder Form tables
118 $( '.email-encoder-form table' ).addClass( 'form-table' );
119 }());
120
121 });
122
123 })( jQuery );
124