PluginProbe ʕ •ᴥ•ʔ
Disable Admin Notices – Hide Dashboard Notifications / 1.4.7
Disable Admin Notices – Hide Dashboard Notifications v1.4.7
1.4.7 1.4.6 1.4.5 trunk 1.0.0 1.0.2 1.0.3 1.0.5 1.0.6 1.1.1 1.1.3 1.1.4 1.2.0 1.2.2 1.2.3 1.2.4 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4
disable-admin-notices / admin / assets / js / settings.js
disable-admin-notices / admin / assets / js Last commit date
notifications-panel.js 2 years ago settings.js 7 months ago
settings.js
104 lines
1 /**
2 * General
3 * @author Webcraftic <wordpress.webraftic@gmail.com>
4 * @copyright (c) 2020, Webcraftic
5 * @version 1.0
6 */
7
8 (function ($) {
9
10 $(document).on('click', '.wdan-page-restore-notice-link', function () {
11 var self = $(this),
12 noticeID = $(this).data('notice-id'),
13 nonce = $(this).data('nonce'),
14 counterEl = $('.wbcr-han-adminbar-counter');
15
16 if (!noticeID) {
17 alert('Undefinded error. Please report the bug to our support forum.');
18 }
19
20 self.hide();
21 self.parent().find('.wdan-page-restore-notice-link-loader').show();
22
23
24 $.ajax(ajaxurl, {
25 type: 'post',
26 dataType: 'json',
27 data: {
28 action: 'wbcr-dan-restore-notice',
29 security: nonce,
30 notice_id: noticeID
31 },
32 success: function (response) {
33 if (!response || !response.success) {
34
35 if (response.data.error_message) {
36 self.closest('li').show();
37 } else {
38 }
39
40 return;
41 }
42
43 counterEl.text(counterEl.text() - 1);
44 self.closest('tr').hide();
45 self.closest('tr').remove();
46 },
47 error: function (xhr, ajaxOptions, thrownError) {
48 }
49 });
50
51 return false;
52 });
53
54 $('.wdan-checkbox.adminbar-items').change(function() {
55 let menuID = $(this).data('menu-id'),
56 isChecked = $(this).find('.factory-result').is(":checked");
57
58 if( !isChecked ) {
59 $('#wp-admin-bar-' + menuID).hide();
60 } else {
61 $('#wp-admin-bar-' + menuID).show();
62 }
63
64 $.ajax(ajaxurl, {
65 type: 'post',
66 dataType: 'json',
67 data: {
68 action: 'wdan-disable-adminbar-menus',
69 menu_id: menuID,
70 enable_menu: isChecked,
71 _wpnonce: $(this).data('nonce')
72 },
73 success: function(result, textStatus, jqXHR) {
74 var noticeId, successNoticeID;
75
76 if( !result || !result.success ) {
77
78 if( result.data && result.data.error_message ) {
79 noticeId = $.wbcr_factory_clearfy_000.app.showNotice(result.data.error_message, 'danger');
80 setTimeout(function() {
81 $.wbcr_factory_clearfy_000.app.hideNotice(noticeId);
82 }, 5000);
83
84 }
85
86 return;
87 }
88
89 successNoticeID = $.wbcr_factory_clearfy_000.app.showNotice(result.data.success_message, 'success');
90 setTimeout(function() {
91 $.wbcr_factory_clearfy_000.app.hideNotice(successNoticeID);
92 }, 2000);
93
94 },
95 error: function(xhr, ajaxOptions, thrownError) {
96
97 var noticeId = $.wbcr_factory_clearfy_000.app.showNotice('Error: [' + thrownError + '] Status: [' + xhr.status + '] Error massage: [' + xhr.responseText + ']', 'danger');
98 }
99 });
100
101 });
102
103 })(jQuery);
104