| @@ 241-280 (lines=40) @@ | ||
| 238 | var message = jQuery(xhr.responseText).text(); |
|
| 239 | message = message.substring(0, message.indexOf("Call Stack")); |
|
| 240 | swal({ |
|
| 241 | type: 'error', |
|
| 242 | title: monsterinsights_admin.redirect_loading_error_title, |
|
| 243 | text: message, |
|
| 244 | confirmButtonText: monsterinsights_admin.ok_text, |
|
| 245 | }).catch(swal.noop); |
|
| 246 | }); |
|
| 247 | }); |
|
| 248 | ||
| 249 | // Reauth |
|
| 250 | jQuery('#monsterinsights-google-reauthenticate-submit').on( "click", function( e ) { |
|
| 251 | e.preventDefault(); |
|
| 252 | swal({ |
|
| 253 | type: 'info', |
|
| 254 | title: monsterinsights_admin.redirect_loading_title_text, |
|
| 255 | text: monsterinsights_admin.redirect_loading_text_text, |
|
| 256 | allowOutsideClick: false, |
|
| 257 | allowEscapeKey: false, |
|
| 258 | allowEnterKey: false, |
|
| 259 | onOpen: function () { |
|
| 260 | swal.showLoading(); |
|
| 261 | } |
|
| 262 | }).catch(swal.noop); |
|
| 263 | var data = { |
|
| 264 | 'action': 'monsterinsights_maybe_reauthenticate', |
|
| 265 | 'nonce': monsterinsights_admin.admin_nonce, |
|
| 266 | 'isnetwork': monsterinsights_admin.isnetwork |
|
| 267 | }; |
|
| 268 | jQuery.post(ajaxurl, data, function( response ) { |
|
| 269 | if ( response.success ) { |
|
| 270 | window.location = response.data.redirect; |
|
| 271 | } else { |
|
| 272 | swal({ |
|
| 273 | type: 'error', |
|
| 274 | title: monsterinsights_admin.redirect_loading_error_title, |
|
| 275 | text: response.data.message, |
|
| 276 | confirmButtonText: monsterinsights_admin.ok_text, |
|
| 277 | }).catch(swal.noop); |
|
| 278 | } |
|
| 279 | }).fail( function(xhr, textStatus, errorThrown) { |
|
| 280 | var message = jQuery(xhr.responseText).text(); |
|
| 281 | message = message.substring(0, message.indexOf("Call Stack")); |
|
| 282 | swal({ |
|
| 283 | type: 'error', |
|
| @@ 199-238 (lines=40) @@ | ||
| 196 | fields_changed = false; |
|
| 197 | return true; |
|
| 198 | } else { |
|
| 199 | e.preventDefault(); |
|
| 200 | return false; |
|
| 201 | } |
|
| 202 | } |
|
| 203 | }); |
|
| 204 | ||
| 205 | ||
| 206 | // Auth Actions |
|
| 207 | // Auth and Reauth |
|
| 208 | jQuery('#monsterinsights-google-authenticate-submit').on( "click", function( e ) { |
|
| 209 | e.preventDefault(); |
|
| 210 | swal({ |
|
| 211 | type: 'info', |
|
| 212 | title: monsterinsights_admin.redirect_loading_title_text, |
|
| 213 | text: monsterinsights_admin.redirect_loading_text_text, |
|
| 214 | allowOutsideClick: false, |
|
| 215 | allowEscapeKey: false, |
|
| 216 | allowEnterKey: false, |
|
| 217 | onOpen: function () { |
|
| 218 | swal.showLoading(); |
|
| 219 | } |
|
| 220 | }).catch(swal.noop); |
|
| 221 | var data = { |
|
| 222 | 'action': 'monsterinsights_maybe_authenticate', |
|
| 223 | 'nonce': monsterinsights_admin.admin_nonce, |
|
| 224 | 'isnetwork': monsterinsights_admin.isnetwork |
|
| 225 | }; |
|
| 226 | jQuery.post(ajaxurl, data, function( response ) { |
|
| 227 | if ( response.success ) { |
|
| 228 | window.location = response.data.redirect; |
|
| 229 | } else { |
|
| 230 | swal({ |
|
| 231 | type: 'error', |
|
| 232 | title: monsterinsights_admin.redirect_loading_error_title, |
|
| 233 | text: response.data.message, |
|
| 234 | confirmButtonText: monsterinsights_admin.ok_text, |
|
| 235 | }).catch(swal.noop); |
|
| 236 | } |
|
| 237 | }).fail( function(xhr, textStatus, errorThrown) { |
|
| 238 | var message = jQuery(xhr.responseText).text(); |
|
| 239 | message = message.substring(0, message.indexOf("Call Stack")); |
|
| 240 | swal({ |
|
| 241 | type: 'error', |
|