PluginProbe
Social Media Auto Poster – Schedule & Publish to Buffer / 6.2.5
Social Media Auto Poster – Schedule & Publish to Buffer v6.2.5
6.2.5 6.2.4 6.2.3 6.2.2 6.2.1 6.2.0 6.1.2 6.1.1 6.1.0 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 All 126 releases
wp-to-buffer / lib / social / assets / js / log.js

log.js in Social Media Auto Poster – Schedule & Publish to Buffer 6.2.5, at lib/social/assets/js/log.js

94 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Handles UI elements for the Plugin Log screen.
3 *
4 * @since 3.9.6
5 *
6 * @package
7 * @author WP Zinc
8 */
9
10 jQuery(document).ready(function ($) {
11 /**
12 * Refresh Log
13 *
14 * @since 4.4.0
15 */
16 $('a.' + wpzinc_social.plugin_name + '-refresh-log').on(
17 'click',
18 function (e) {
19 // Prevent default action.
20 e.preventDefault();
21
22 // Define button.
23 const button = $(this);
24
25 // Send AJAX request to clear log.
26 $.post(
27 wpzinc_social.ajax,
28 {
29 action: $(button).data('action'),
30 post: wpzinc_social.post_id,
31 nonce: wpzinc_social.get_log_nonce,
32 },
33 function (response) {
34 // Replace the table data with the response data.
35 $('table.widefat tbody', $($(button).data('target'))).html(
36 response.data
37 );
38 }
39 );
40 }
41 );
42
43 /**
44 * Clear Log
45 *
46 * @since 3.0.0
47 */
48 $('a.' + wpzinc_social.plugin_name + '-clear-log').on(
49 'click',
50 function (e) {
51 // Define button.
52 const button = $(this);
53
54 // Bail if the user doesn't want to clear the log.
55 const result = confirm($(button).data('message'));
56 if (!result) {
57 // Prevent default action.
58 e.preventDefault();
59 return false;
60 }
61
62 // If the button doesn't have an action and a target, it's not an AJAX request.
63 // Let the request through.
64 if (
65 typeof $(button).data('action') === 'undefined' ||
66 typeof $(button).data('target') === 'undefined'
67 ) {
68 return true;
69 }
70
71 // Prevent default action.
72 e.preventDefault();
73
74 // Send AJAX request to clear log.
75 $.post(
76 wpzinc_social.ajax,
77 {
78 action: $(button).data('action'),
79 post: $('input[name=post_ID]').val(),
80 nonce: wpzinc_social.clear_log_nonce,
81 },
82 function () {
83 // Clear Log.
84 $('table.widefat tbody', $($(button).data('target'))).html(
85 '<tr><td colspan="8">' +
86 wpzinc_social.clear_log_completed +
87 '</td></tr>'
88 );
89 }
90 );
91 }
92 );
93 });
94