backup
2 years ago
notices
2 years ago
analytics-consent-modal.js
2 years ago
analytics-consent-modal.js.map
2 years ago
analytics-consent-modal.min.js
2 years ago
analytics-consent-modal.min.js.map
2 years ago
wpstg-admin-beta.js
2 years ago
wpstg-admin-beta.js.map
2 years ago
wpstg-admin-beta.min.js
5 years ago
wpstg-admin-beta.min.js.map
2 years ago
wpstg-admin-corrupt-settings.js
2 years ago
wpstg-admin-corrupt-settings.js.map
2 years ago
wpstg-admin-corrupt-settings.min.js
2 years ago
wpstg-admin-corrupt-settings.min.js.map
2 years ago
wpstg-admin-plugins.js
2 years ago
wpstg-admin-plugins.js.map
2 years ago
wpstg-admin-plugins.min.js
2 years ago
wpstg-admin-plugins.min.js.map
2 years ago
wpstg-admin-rating.js
2 years ago
wpstg-admin-rating.js.map
2 years ago
wpstg-admin-rating.min.js
2 years ago
wpstg-admin-rating.min.js.map
2 years ago
wpstg-admin.js
2 years ago
wpstg-admin.js.map
2 years ago
wpstg-admin.min.js
2 years ago
wpstg-admin.min.js.map
2 years ago
wpstg-blank-loader.js
2 years ago
wpstg-blank-loader.js.map
2 years ago
wpstg-blank-loader.min.js
2 years ago
wpstg-blank-loader.min.js.map
2 years ago
wpstg-sweetalert2.js
2 years ago
wpstg-sweetalert2.js.map
2 years ago
wpstg-sweetalert2.min.js
2 years ago
wpstg-sweetalert2.min.js.map
2 years ago
wpstg.js
2 years ago
wpstg.js.map
2 years ago
wpstg.min.js
2 years ago
wpstg.min.js.map
2 years ago
wpstg-admin-rating.js
116 lines
| 1 | (function () { |
| 2 | 'use strict'; |
| 3 | |
| 4 | var wpstgTimesWaited = 0; |
| 5 | |
| 6 | /* |
| 7 | Let's wait for jQuery to be available to show the rating. |
| 8 | We need it to dispatch AJAX requests. |
| 9 | */ |
| 10 | var wpstgWaitForJQuery = setInterval(function () { |
| 11 | if (wpstgTimesWaited > 100) { |
| 12 | // Give up waiting. |
| 13 | clearInterval(wpstgWaitForJQuery); |
| 14 | } |
| 15 | if (typeof jQuery != 'undefined') { |
| 16 | wpstgRegisterRatingEvents(); |
| 17 | clearInterval(wpstgWaitForJQuery); |
| 18 | } |
| 19 | wpstgTimesWaited = wpstgTimesWaited + 1; |
| 20 | }, 100); |
| 21 | function wpstgRegisterRatingEvents() { |
| 22 | // Show the rating once jQuery is loaded. |
| 23 | jQuery('.wpstg_fivestar').show(); |
| 24 | |
| 25 | /** |
| 26 | * Dispatch the request to hide the notice after user clicks to rate the plugin. |
| 27 | */ |
| 28 | jQuery(document).on('click', '#wpstg_clicked_deserved_it', function (e) { |
| 29 | jQuery.ajax({ |
| 30 | url: ajaxurl, |
| 31 | type: 'POST', |
| 32 | data: { |
| 33 | action: 'wpstg_hide_rating', |
| 34 | nonce: wpstg.nonce |
| 35 | }, |
| 36 | error: function error(xhr, textStatus, errorThrown) { |
| 37 | console.log(xhr.status + ' ' + xhr.statusText + '---' + textStatus); |
| 38 | console.log(textStatus); |
| 39 | alert('Unknown error. Please get in contact with us to solve it support@wp-staging.com'); |
| 40 | }, |
| 41 | success: function success(data) { |
| 42 | jQuery('.wpstg_fivestar').slideUp('fast'); |
| 43 | return true; |
| 44 | }, |
| 45 | statusCode: { |
| 46 | 404: function _() { |
| 47 | alert('Something went wrong; can\'t find ajax request URL! Please get in contact with us to solve it support@wp-staging.com'); |
| 48 | }, |
| 49 | 500: function _() { |
| 50 | alert('Something went wrong; internal server error while processing the request! Please get in contact with us to solve it support@wp-staging.com'); |
| 51 | } |
| 52 | } |
| 53 | }); |
| 54 | }); |
| 55 | jQuery('.wpstg_hide_rating').on('click', function (e) { |
| 56 | e.preventDefault(); |
| 57 | jQuery.ajax({ |
| 58 | url: ajaxurl, |
| 59 | type: 'POST', |
| 60 | data: { |
| 61 | action: 'wpstg_hide_rating', |
| 62 | nonce: wpstg.nonce |
| 63 | }, |
| 64 | error: function error(xhr, textStatus, errorThrown) { |
| 65 | console.log(xhr.status + ' ' + xhr.statusText + '---' + textStatus); |
| 66 | console.log(textStatus); |
| 67 | alert('Unknown error. Please get in contact with us to solve it support@wp-staging.com'); |
| 68 | }, |
| 69 | success: function success(data) { |
| 70 | jQuery('.wpstg_fivestar').slideUp('fast'); |
| 71 | return true; |
| 72 | }, |
| 73 | statusCode: { |
| 74 | 404: function _() { |
| 75 | alert('Something went wrong; can\'t find ajax request URL! Please get in contact with us to solve it support@wp-staging.com'); |
| 76 | }, |
| 77 | 500: function _() { |
| 78 | alert('Something went wrong; internal server error while processing the request! Please get in contact with us to solve it support@wp-staging.com'); |
| 79 | } |
| 80 | } |
| 81 | }); |
| 82 | }); |
| 83 | jQuery('.wpstg_rate_later').on('click', function (e) { |
| 84 | e.preventDefault(); |
| 85 | jQuery.ajax({ |
| 86 | url: ajaxurl, |
| 87 | type: 'POST', |
| 88 | data: { |
| 89 | action: 'wpstg_hide_later', |
| 90 | nonce: wpstg.nonce |
| 91 | }, |
| 92 | error: function error(xhr, textStatus, errorThrown) { |
| 93 | console.log(xhr.status + ' ' + xhr.statusText + '---' + textStatus); |
| 94 | console.log(textStatus); |
| 95 | alert('Unknown error. Please get in contact with us to solve it support@wp-staging.com'); |
| 96 | }, |
| 97 | success: function success(data) { |
| 98 | jQuery('.wpstg_fivestar').slideUp('fast'); |
| 99 | return true; |
| 100 | }, |
| 101 | statusCode: { |
| 102 | 404: function _() { |
| 103 | alert('Something went wrong; can\'t find ajax request URL! Please get in contact with us to solve it support@wp-staging.com'); |
| 104 | }, |
| 105 | 500: function _() { |
| 106 | alert('Something went wrong; internal server error while processing the request! Please get in contact with us to solve it support@wp-staging.com'); |
| 107 | } |
| 108 | } |
| 109 | }); |
| 110 | }); |
| 111 | } |
| 112 | document.styleSheets[0].insertRule('@media only screen and (max-width:600px){.wpstg-welcome-box{display:block !important}.wpstg-welcome-text{padding-left:8px !important}}', ''); |
| 113 | |
| 114 | })(); |
| 115 | //# sourceMappingURL=wpstg-admin-rating.js.map |
| 116 |