| 1 |
/* script to monitor and validate plugin update */ |
| 2 |
(function($){ |
| 3 |
'use strict'; |
| 4 |
|
| 5 |
var $cf7sgPlugin = $('#cf7-grid-layout-update'); |
| 6 |
if($cf7sgPlugin){ |
| 7 |
$(document).on('wp-plugin-update-success',function(e, response){ |
| 8 |
if('undefined' != typeof response['slug'] && 'cf7-grid-layout'==response['slug']){ |
| 9 |
//check if the update requires a form update. |
| 10 |
$('.updated-message.notice-success p',$cf7sgPlugin).append('<span class="cf7sg-msg">'+cf7sg.msg+'<span class="spinner"></span></span>'); |
| 11 |
//check form version. |
| 12 |
$.post(ajaxurl,{ |
| 13 |
'action':'validate_cf7sg_version_update', |
| 14 |
'nonce' : cf7sg.nonce |
| 15 |
}, function(response){ |
| 16 |
$('.cf7sg-msg', $cf7sgPlugin).html(response); |
| 17 |
}).fail(function(){ |
| 18 |
$('.cf7sg-msg', $cf7sgPlugin).html(cf7sg.error); |
| 19 |
}) |
| 20 |
} |
| 21 |
}) |
| 22 |
} |
| 23 |
})(jQuery) |
| 24 |
|