PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 3.9.7
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v3.9.7
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / assets / js / admin.js
embedpress / assets / js Last commit date
vendor 7 years ago admin.js 2 years ago ads.js 2 years ago documents-viewer-script.js 3 years ago front.js 2 years ago index.html 7 years ago initplyr.js 2 years ago pdfobject.min.js 3 years ago plyr.polyfilled.js 3 years ago preview.js 3 years ago settings.js 6 years ago vimeo-player.js 2 years ago ytiframeapi.js 2 years ago
admin.js
242 lines
1 /**
2 * @package EmbedPress
3 * @author EmbedPress <help@embedpress.com>
4 * @copyright Copyright (C) 2018 EmbedPress. All rights reserved.
5 * @license GPLv2 or later
6 * @since 1.7.0
7 */
8 (function ($) {
9 'use strict';
10
11 var __ = wp.i18n.__;
12 var addQueryArgs = wp.url.addQueryArgs;
13 $(document).on('click', '.embedpress-plugin-notice-dismissible.is-dismissible', function () {
14 var data = {
15 action: 'embedpress_notice_dismiss',
16 security: EMBEDPRESS_ADMIN_PARAMS.nonce,
17 };
18
19 $.post(EMBEDPRESS_ADMIN_PARAMS.ajaxurl, data, function () {
20
21 });
22 });
23
24 $(document).on('click', '.embedpress-license-activation-btn', function (e) {
25 e.preventDefault();
26 let $this = $(this);
27
28 const licensesKey = $('#embedpress-pro-license-key').val();
29
30 if (licensesKey) {
31 $this.attr('disabled', 'disabled');
32 $this.html(__('Sending Request.....', 'embedpress'));
33 }
34
35 $.ajax({
36 type: 'POST',
37 url: ajaxurl,
38 data: {
39 // Your data to be sent in the request body
40 action: 'embedpress/license/activate',
41 _nonce: wpdeveloperLicenseManagerConfig.nonce, //
42 license_key: licensesKey,
43 },
44 success: function (response) {
45 // Handle the successful response here
46 if (!response.success) {
47 $this.html(__('Active License', 'embedpress'));
48 $this.removeAttr('disabled');
49 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
50 $('.toast__message--error').addClass('show-toast');
51
52 setTimeout(() => {
53 $('.toast__message--error').removeClass('show-toast');
54 }, 2000);
55
56 }
57 else if (response.data.license === 'valid') {
58 activationMessage();
59 }
60 else if (response.data.license === 'required_otp') {
61 $this.html(__('Verification Required', 'embedpress'));
62 $('#valid-license-key-message').removeClass('hidden');
63 $('#email-placeholder').text(response.data.customer_email);
64 $('#embedpress-pro-license-key').attr('disabled', 'disabled');
65
66 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Sent successfully');
67 $('.toast__message--success').addClass('show-toast');
68
69 setTimeout(() => {
70 $('.toast__message--success').removeClass('show-toast');
71 }, 2000);
72
73 $('#otp-varify-form').removeClass('hidden');
74 }
75 },
76 error: function (xhr, status, error) {
77 // Handle errors here
78 console.error('Error:', status, error);
79 }
80 });
81
82 });
83
84 $(document).on('click', '.embedpress-verification-activation-btn', function (e) {
85 e.preventDefault();
86 let $this = $(this);
87
88 const licensesKey = $('#embedpress-pro-license-key').val();
89 const otpCode = $('#embedpress-pro-verification-key').val();
90
91 $('#invalid-verification-key-message').addClass('hidden');
92
93 if (licensesKey) {
94 $this.attr('disabled', 'disabled');
95 $this.html(__('Verifying.....', 'embedpress'));
96 }
97 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
98
99 $.ajax({
100 type: 'POST',
101 url: ajaxurl,
102 data: {
103 // Your data to be sent in the request body
104 action: 'embedpress/license/submit-otp',
105 _nonce: wpdeveloperLicenseManagerConfig.nonce, //
106 license: licensesKey,
107 otp: otpCode,
108 },
109 success: function (response) {
110 // Handle the successful response here
111 console.log('Success:', response);
112 if (!response.success) {
113 $this.html('Verify');
114 $this.removeAttr('disabled');
115 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
116 $('.toast__message--error').addClass('show-toast');
117 setTimeout(() => {
118 $('.toast__message--error').removeClass('show-toast');
119 }, 2000);
120
121 }
122 else {
123 $this.html(__('Verified', 'embedpress'));
124 activationMessage();
125 }
126 },
127 error: function (xhr, status, error) {
128 // Handle errors here
129 console.error('Error:', status, error);
130 }
131 });
132
133 });
134 $(document).on('click', '#resend-license-verification-key', function (e) {
135 e.preventDefault();
136 let $this = $(this);
137
138
139 const licensesKey = $('#embedpress-pro-license-key').val();
140 $('#resend-license-verification-key').text(__('Resending', 'embedpress'));
141
142 $.ajax({
143 type: 'POST',
144 url: ajaxurl,
145 data: {
146 // Your data to be sent in the request body
147 action: 'embedpress/license/resend-otp',
148 _nonce: wpdeveloperLicenseManagerConfig.nonce, //
149 license: licensesKey,
150 },
151 success: function (response) {
152 // Handle the successful response here
153 console.log('Success:', response);
154 if (!response.success) {
155 $('.embedpress-toast__message.toast__message--error p').text(response?.data?.message);
156 $('.toast__message--error').addClass('show-toast');
157
158 setTimeout(() => {
159 $('.toast__message--error').removeClass('show-toast');
160 }, 2000);
161
162 }
163 else {
164 $('.embedpress-toast__message.toast__message--success p').text('Verification Code Resent Successfully.');
165 $('.toast__message--success').addClass('show-toast');
166
167 setTimeout(() => {
168 $('.toast__message--success').removeClass('show-toast');
169 }, 2000);
170 }
171
172 $('#resend-license-verification-key').text(__('Resend', 'embedpress'));
173
174 },
175 error: function (xhr, status, error) {
176 // Handle errors here
177 console.error('Error:', status, error);
178 }
179 });
180
181 });
182
183 $(document).on('click', '.embedpress-license-deactivation-btn', function (e) {
184 e.preventDefault();
185 let $this = $(this);
186
187 const licensesKey = $('#embedpress-pro-license-key').val();
188 const otpCode = $('#embedpress-pro-verification-key').val();
189
190 console.log(licensesKey);
191
192 if (licensesKey) {
193 $this.attr('disabled', 'disabled');
194 $this.html(__('Deactivating.....', 'embedpress'));
195 }
196 // var ajaxUrl = 'embedpress/license/activate'; // Replace with the actual URL
197
198 $.ajax({
199 type: 'POST',
200 url: ajaxurl,
201 data: {
202 // Your data to be sent in the request body
203 action: 'embedpress/license/deactivate',
204 _nonce: wpdeveloperLicenseManagerConfig.nonce, //
205 },
206 success: function (response) {
207 // Handle the successful response here
208 console.log('Success:', response);
209 if (response.success) {
210 deactivationMessage();
211 }
212 },
213 error: function (xhr, status, error) {
214 // Handle errors here
215 console.error('Error:', status, error);
216 }
217 });
218
219 });
220
221 function activationMessage() {
222 var currentUrl = window.location.href;
223 var newUrl = addQueryArgs(currentUrl, {
224 success: true,
225 message: __('License has been activated', 'embedpress')
226 });
227 window.location.href = newUrl;
228 }
229 function deactivationMessage() {
230 var currentUrl = window.location.href;
231 var newUrl = addQueryArgs(currentUrl, {
232 success: true,
233 message: __('License has been deactivated', 'embedpress')
234 });
235
236 window.location.href = newUrl;
237 }
238
239
240
241 })(jQuery);
242