PluginProbe
Admin and Site Enhancements (ASE) / 3.0.4
Admin and Site Enhancements (ASE) v3.0.4
9.1.1 9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 All 273 releases
admin-site-enhancements / assets / js / hide-admin-notices.js
hide-admin-notices.js
89 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function( $ ) {
2 'use strict';
3
4 $(document).ready( function() {
5
6 // Move admin notices at an interval after document is ready and WP core moves the position of notices under the page heading.
7 // https://plugins.trac.wordpress.org/browser/hide-admin-notices/tags/1.2.2/assets/js/hide-admin-notices.js
8 // https://plugins.trac.wordpress.org/browser/admin-notices-manager/tags/1.3.1/assets/js/admin/notices.js
9
10 var noticesPanel = $('.asenha-admin-notices-drawer');
11 var startTime = new Date().getTime();
12
13 var interval = setInterval(function () {
14
15 // Stop monitoring after 5 seconds
16 if (new Date().getTime() - startTime > 1000) {
17 clearInterval(interval);
18
19 // Count hidden notices and append into admin bar counter
20 var noticesCount = $('.asenha-admin-notices-drawer > div').length;
21
22 if ( noticesCount > 0 ) {
23 $('.asenha-admin-notices-menu').show(); // show admin bar menu
24 // $('.asenha-admin-notices-counter').show(); // show counter
25 $('.asenha-admin-notices-counter').html(noticesCount); // insert count
26 $('.asenha-admin-notices-counter').css("opacity", "1"); // show counter
27 } else {
28 $('.asenha-admin-notices-menu').hide(); // hide admin bar menu
29 }
30
31 return;
32 }
33
34 // Plugins that outputs notices. For testing.
35 // Ajax Press - https://wordpress.org/plugins/ajax-press/
36 // Atlas Search - https://wordpress.org/plugins/atlas-search/
37 // ExactMetrics Analytics - https://wordpress.org/plugins/google-analytics-dashboard-for-wp/
38 // JetPack - https://wordpress.org/plugins/jetpack/
39 // ManageWP Worker - https://wordpress.org/plugins/worker/
40 // WP Smushit - https://wordpress.org/plugins/wp-smushit/
41 // FluentSMTP - https://wordpress.org/plugins/fluent-smtp/
42 // WP Backend File Search - https://wordpress.org/plugins/wp-backend-file-search-editor-tweaks/
43 // TotalPress Custom post types - https://wordpress.org/plugins/custom-post-types/
44
45 // Reposition notices with the following selectors. Excluding 'notice-system'.
46 $('#wpbody-content > .wrap > .notice:not(.system-notice),'
47 + '#wpbody-content > .wrap > .notice-error,'
48 + '#wpbody-content > .wrap > .error,'
49 + '#wpbody-content > .wrap > .notice-info,'
50 + '#wpbody-content > .wrap > .notice-information,'
51 + '#wpbody-content > .wrap > #message,'
52 + '#wpbody-content > .wrap > .notice-warning'
53 + '#wpbody-content > .wrap > .notice-success,'
54 + '#wpbody-content > .wrap > .notice-updated,'
55 + '#wpbody-content > .wrap > .updated,'
56 + '#wpbody-content > .wrap > .update-nag,'
57 + '#wpbody-content > .jp-connection-banner' // Jetpack
58 ).detach()
59 .appendTo(noticesPanel)
60 .show();
61
62 }, 250);
63
64 // Set up the side drawer that holds the hidden admin notices: https://stephanwagner.me/jBox
65
66 var noticesModal = new jBox('Modal', {
67 attach: '.asenha-admin-notices-menu',
68 trigger: 'click', // or 'mouseenter'
69 // content: 'Test'
70 content: $('.asenha-admin-notices-drawer'),
71 width: 1118, // pixels
72 closeButton: 'box',
73 addClass: 'admin-notices-modal',
74 overlayClass: 'admin-notices-modal-overlay',
75 target: '#wpwrap', // where to anchor the modal
76 position: {
77 x: 'right',
78 y: 'top'
79 },
80 // fade: 1000,
81 animation: {
82 open: 'slide:bottom',
83 close: 'slide:bottom'
84 }
85 });
86
87 });
88
89 })( jQuery );