PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.3.7
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.3.7
7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / lib / free-dashboard / admin.js
wordpress-popup / lib / free-dashboard Last commit date
README.md 5 years ago admin.css 5 years ago admin.js 5 years ago module.php 5 years ago
admin.js
124 lines
1 jQuery(function() {
2 var el_notice = jQuery( ".frash-notice" ),
3 type = el_notice.find( "input[name=type]" ).val(),
4 plugin_id = el_notice.find( "input[name=plugin_id]" ).val(),
5 url_wp = el_notice.find( "input[name=url_wp]" ).val(),
6 inp_email = el_notice.find( "input[name=EMAIL]" ),
7 btn_act = el_notice.find( ".frash-notice-act" ),
8 btn_dismiss = el_notice.find( ".frash-notice-dismiss" ),
9 ajax_data = {};
10
11 ajax_data.plugin_id = plugin_id;
12 ajax_data.type = type;
13
14 function init_email() {
15 if ( ! inp_email.length ) { return; }
16
17 // Adjust the size of the email field to its contents.
18 function adjust_email_size() {
19 var width, tmp = jQuery( "<span></span>" );
20
21 tmp.addClass( "input-field" ).text( inp_email.val() );
22 tmp.appendTo( "body" );
23 width = parseInt( tmp.width() );
24 tmp.remove();
25
26 inp_email.width( width + 34 );
27 }
28
29 function email_keycheck( ev ) {
30 if ( 13 === ev.keyCode ) {
31 btn_act.click();
32 } else {
33 adjust_email_size();
34 }
35 }
36
37 inp_email.keyup( email_keycheck ).focus().select();
38 adjust_email_size();
39 }
40
41 // Display the notice after the page was loaded.
42 function initialize() {
43 el_notice.fadeIn( 500 );
44 init_email();
45 }
46
47 // Hide the notice after a CTA button was clicked
48 function remove_notice() {
49 el_notice.fadeTo( 100 , 0, function() {
50 el_notice.slideUp( 100, function() {
51 el_notice.remove();
52 });
53 });
54 }
55
56 // Open a tab to rate the plugin.
57 function act_rate() {
58 var url = url_wp.replace( /\/plugins\//, "/support/plugin/" ) + "/reviews/?rate=5#new-post",
59 link = jQuery( '<a href="' + url + '" target="_blank">Rate</a>' );
60
61 link.appendTo( "body" );
62 link[0].click();
63 link.remove();
64 }
65
66 // Submit the user to our email list.
67 function act_email() {
68
69 var form = inp_email.parent('form');
70 //Submit email to mailing list
71 jQuery.ajax({
72 type: form.attr('method'),
73 url: form.attr('action'),
74 data: form.serialize(),
75 cache: false,
76 dataType: 'json',
77 contentType: 'application/json; charset=utf-8',
78 success: function (data) {
79 console.log(data.msg);
80 }
81 });
82 }
83
84 // Notify WordPress about the users choice and close the message.
85 function notify_wordpress( action, message ) {
86 el_notice.attr( "data-message", message );
87 el_notice.addClass( "loading" );
88
89 ajax_data.action = action;
90 jQuery.post(
91 window.ajaxurl,
92 ajax_data,
93 remove_notice
94 );
95 }
96
97 // Handle click on the primary CTA button.
98 // Either open the wp.org page or submit the email address.
99 btn_act.click(function( ev ) {
100 ev.preventDefault();
101
102 //Do not submit form if the value is not set
103 var email_inpt = btn_act.parent().find('input[type="email"]');
104 if( ( !email_inpt.length || !email_inpt.val() ) && type === 'email' ) {
105 return;
106 }
107
108 switch ( type ) {
109 case 'rate': act_rate(); break;
110 case 'email': act_email(); break;
111 }
112
113 notify_wordpress( "frash_act", btn_act.data( "msg" ) );
114 });
115
116 // Dismiss the notice without any action.
117 btn_dismiss.click(function( ev ) {
118 ev.preventDefault();
119
120 notify_wordpress( "frash_dismiss", btn_dismiss.data( "msg" ) );
121 });
122
123 window.setTimeout( initialize, 500 );
124 });