| 1 |
(function($) { |
| 2 |
|
| 3 |
CopyTheCodeOptIn = { |
| 4 |
|
| 5 |
/** |
| 6 |
* Init |
| 7 |
*/ |
| 8 |
init: function() |
| 9 |
{ |
| 10 |
this._bind(); |
| 11 |
}, |
| 12 |
|
| 13 |
_bind: function() |
| 14 |
{ |
| 15 |
$( document ).on('click', '.copy-the-code-opt-in-notice-welcome .notice-dismiss', CopyTheCodeOptIn.welcome ); |
| 16 |
}, |
| 17 |
|
| 18 |
/** |
| 19 |
* Welcome |
| 20 |
*/ |
| 21 |
welcome: function( event ) { |
| 22 |
event.preventDefault(); |
| 23 |
|
| 24 |
$.ajax({ |
| 25 |
url: copy_the_code_opt_in.ajax_url, |
| 26 |
type: 'POST', |
| 27 |
data: { |
| 28 |
action: 'copy_the_code_opt_in', |
| 29 |
opt_in: 'welcome', |
| 30 |
security: copy_the_code_opt_in.security, |
| 31 |
}, |
| 32 |
success: function( response ) { |
| 33 |
if( response.success ) { |
| 34 |
$('.copy-the-code-opt-in-notice-welcome').remove(); |
| 35 |
} |
| 36 |
} |
| 37 |
}); |
| 38 |
} |
| 39 |
|
| 40 |
}; |
| 41 |
|
| 42 |
/** |
| 43 |
* Initialization |
| 44 |
*/ |
| 45 |
$(function() { |
| 46 |
CopyTheCodeOptIn.init(); |
| 47 |
}); |
| 48 |
|
| 49 |
})(jQuery); |
| 50 |
|
| 51 |
|