admin_bar_menu.js
4 years ago
bootstrap.bundle.min.js
4 years ago
bootstrap.min.js
6 years ago
metabox.js
6 years ago
np_notices.js
4 years ago
np_safemode.js
4 years ago
overlay.js
6 years ago
popper.min.js
4 years ago
admin_bar_menu.js
42 lines
| 1 | jQuery(window).on("load", _ => { |
| 2 | |
| 3 | function clearCacheSingleHandler(clearCacheAction, elem) { |
| 4 | jQuery.ajax({ |
| 5 | url: frontendajax.ajaxurl, |
| 6 | type: 'POST', |
| 7 | data: { |
| 8 | action: "nitropack_" + clearCacheAction + "_single_cache", |
| 9 | postUrl: window.location.href.split('#')[0], |
| 10 | postId: -1 |
| 11 | }, |
| 12 | dataType: 'json', |
| 13 | beforeSend: function () { |
| 14 | elem.find('i').remove(); |
| 15 | elem.find('a').first().append('<i class="fa fa-refresh fa-spin nitro"></i>'); |
| 16 | }, |
| 17 | success: function (data) { |
| 18 | if (data.type == 'error') { |
| 19 | elem.find('i').removeClass('fa-refresh').removeClass('fa-spin').addClass('fa-exclamation'); |
| 20 | alert(data.message); |
| 21 | } else { |
| 22 | elem.find('i').removeClass('fa-refresh').removeClass('fa-spin').addClass('fa-check'); |
| 23 | } |
| 24 | } |
| 25 | }); |
| 26 | } |
| 27 | |
| 28 | jQuery('.nitropack-invalidate-cache').click(function (e) { |
| 29 | e.preventDefault(); |
| 30 | clearCacheSingleHandler("invalidate", jQuery(this)) |
| 31 | return false; |
| 32 | }); |
| 33 | |
| 34 | jQuery('.nitropack-purge-cache').click(function (e) { |
| 35 | e.preventDefault(); |
| 36 | clearCacheSingleHandler("purge", jQuery(this)) |
| 37 | return false; |
| 38 | }); |
| 39 | |
| 40 | }); |
| 41 | |
| 42 |