| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | $opt_out_message_clicking_opt_out = sprintf( |
| 49 | 49 | fs_text_inline( 'By clicking "Opt Out", we will no longer be sending any data from %s to %s.', 'opt-out-message-clicking-opt-out', $slug ), |
| 50 | 50 | $plugin_title, |
| 51 | 51 | sprintf( |
| 52 | - '<a href="%s" target="_blank">%s</a>', | |
| 52 | + '<a href="%s" target="_blank" rel="noopener">%s</a>', | |
| 53 | 53 | 'https://freemius.com', |
| 54 | 54 | 'freemius.com' |
| 55 | 55 | ) |
| 56 | 56 | ); |
| @@ -97,22 +97,23 @@ | ||
| 97 | 97 | + '</div>', |
| 98 | 98 | $modal = $(modalHtml), |
| 99 | 99 | $adminNotice = $( <?php echo json_encode( $admin_notice_html ) ?> ), |
| 100 | 100 | action = '<?php echo $action ?>', |
| 101 | - $actionLink = $( 'span.opt-in-or-opt-out.<?php echo $slug ?> a' ), | |
| 101 | + actionLinkSelector = 'span.opt-in-or-opt-out.<?php echo $slug ?> a', | |
| 102 | 102 | $optOutButton = $modal.find( '.button-opt-out' ), |
| 103 | 103 | $optOutErrorMessage = $modal.find( '.opt-out-error-message' ), |
| 104 | 104 | $extensionsTracking = $modal.find( '.fs-permission-extensions' ), |
| 105 | + $body = $( 'body' ), | |
| 105 | 106 | moduleID = '<?php echo $fs->get_id() ?>'; |
| 106 | 107 | |
| 107 | - $actionLink.attr( 'data-action', action ); | |
| 108 | - $modal.appendTo( $( 'body' ) ); | |
| 108 | + $modal.data( 'action', action ); | |
| 109 | + $modal.appendTo( $body ); | |
| 109 | 110 | |
| 110 | 111 | function registerActionLinkClick() { |
| 111 | - $actionLink.click(function( evt ) { | |
| 112 | + $body.on( 'click', actionLinkSelector, function( evt ) { | |
| 112 | 113 | evt.preventDefault(); |
| 113 | 114 | |
| 114 | - if ( 'stop_tracking' == $actionLink.attr( 'data-action' ) ) { | |
| 115 | + if ( 'stop_tracking' == $modal.data( 'action' ) ) { | |
| 115 | 116 | showModal(); |
| 116 | 117 | } else { |
| 117 | 118 | optIn(); |
| 118 | 119 | } |
| @@ -150,14 +151,14 @@ | ||
| 150 | 151 | resetModal(); |
| 151 | 152 | |
| 152 | 153 | // Display the dialog box. |
| 153 | 154 | $modal.addClass( 'active' ); |
| 154 | - $( 'body' ).addClass( 'has-fs-modal' ); | |
| 155 | + $body.addClass( 'has-fs-modal' ); | |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | function closeModal() { |
| 158 | 159 | $modal.removeClass( 'active' ); |
| 159 | - $( 'body' ).removeClass( 'has-fs-modal' ); | |
| 160 | + $body.removeClass( 'has-fs-modal' ); | |
| 160 | 161 | } |
| 161 | 162 | |
| 162 | 163 | function resetOptOutButton() { |
| 163 | 164 | enableOptOutButton(); |
| @@ -177,8 +178,10 @@ | ||
| 177 | 178 | sendRequest(); |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | 181 | function sendRequest() { |
| 182 | + var $actionLink = $( actionLinkSelector ); | |
| 183 | + | |
| 181 | 184 | $.ajax({ |
| 182 | 185 | url: ajaxurl, |
| 183 | 186 | method: 'POST', |
| 184 | 187 | data: { |
| @@ -215,9 +218,9 @@ | ||
| 215 | 218 | $adminNotice.remove(); |
| 216 | 219 | } |
| 217 | 220 | } |
| 218 | 221 | |
| 219 | - $actionLink.attr( 'data-action', action ); | |
| 222 | + $modal.data( 'action', action ); | |
| 220 | 223 | } else { |
| 221 | 224 | showError( resultObj.error ); |
| 222 | 225 | resetOptOutButton(); |
| 223 | 226 | } |
| @@ -314,9 +317,13 @@ | ||
| 314 | 317 | href = (('stop_tracking' != action) ? |
| 315 | 318 | '<?php echo ( $fs->is_registered() ? '' : esc_js( $reconnect_url ) ) ?>' : |
| 316 | 319 | ''); |
| 317 | 320 | |
| 318 | - $actionLink = $('<a id="fs_theme_opt_in_out" href="' + encodeURI(href) + '" class="button" data-action="' + action + '">' + label + '</a>'); | |
| 321 | + var $actionLink = $('<a id="fs_theme_opt_in_out" href="' + encodeURI(href) + '" class="button">' + label + '</a>'); | |
| 322 | + | |
| 323 | + actionLinkSelector = '#fs_theme_opt_in_out'; | |
| 324 | + | |
| 325 | + $modal.data( 'action', action ); | |
| 319 | 326 | |
| 320 | 327 | $('.theme-wrap .theme-actions .active-theme').append($actionLink); |
| 321 | 328 | |
| 322 | 329 | if ('' === href) { |