codemirror
1 year ago
datatables
1 year ago
admin-menu-organizer.js
1 year ago
admin-page.js
1 year ago
content-order-sort.js
1 year ago
custom-admin-menu.js
1 year ago
external-permalinks.js
1 year ago
gutenberg-content-duplication.js
1 year ago
hide-admin-notices.js
1 year ago
jBox.all.min.js
1 year ago
jquery.jsticky.mod.js
1 year ago
jquery.jsticky.mod.min.js
1 year ago
jquery.mjs.nestedSortable.js
1 year ago
jquery.ui.touch-punch.min.js
1 year ago
js.cookie.min.js
1 year ago
list-tables-content-order.js
1 year ago
media-replace.js
1 year ago
multiple-user-roles.js
1 year ago
select2.full.min.js
1 year ago
toggle-hidden-menu.js
1 year ago
hide-admin-notices.js
256 lines
| 1 | (function( $ ) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | $(document).ready( function() { |
| 5 | var noticesCount; |
| 6 | |
| 7 | // Move admin notices at an interval after document is ready and WP core moves the position of notices under the page heading. |
| 8 | // https://plugins.trac.wordpress.org/browser/hide-admin-notices/tags/1.2.2/assets/js/hide-admin-notices.js |
| 9 | // https://plugins.trac.wordpress.org/browser/admin-notices-manager/tags/1.3.1/assets/js/admin/notices.js |
| 10 | |
| 11 | var noticesPanel = $('.asenha-admin-notices-drawer'); |
| 12 | var startTime = new Date().getTime(); |
| 13 | |
| 14 | var interval = setInterval(function () { |
| 15 | |
| 16 | // Stop monitoring after 5 seconds |
| 17 | if (new Date().getTime() - startTime > 1000) { |
| 18 | clearInterval(interval); |
| 19 | |
| 20 | // Count hidden notices and append into admin bar counter |
| 21 | noticesCount = $('.asenha-admin-notices-drawer > div').length; |
| 22 | |
| 23 | if ( noticesCount > 0 ) { |
| 24 | $('.asenha-admin-notices-menu').show(); // show admin bar menu |
| 25 | // $('.asenha-admin-notices-counter').show(); // show counter |
| 26 | $('.asenha-admin-notices-counter').html(noticesCount); // insert count |
| 27 | $('.asenha-admin-notices-counter').css("opacity", "1"); // show counter |
| 28 | } else { |
| 29 | $('.asenha-admin-notices-menu').hide(); // hide admin bar menu |
| 30 | } |
| 31 | |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | // Plugins that outputs notices. For testing. |
| 36 | // Ajax Press - https://wordpress.org/plugins/ajax-press/ |
| 37 | // Atlas Search - https://wordpress.org/plugins/atlas-search/ |
| 38 | // ExactMetrics Analytics - https://wordpress.org/plugins/google-analytics-dashboard-for-wp/ |
| 39 | // JetPack - https://wordpress.org/plugins/jetpack/ |
| 40 | // ManageWP Worker - https://wordpress.org/plugins/worker/ |
| 41 | // WP Smushit - https://wordpress.org/plugins/wp-smushit/ |
| 42 | // FluentSMTP - https://wordpress.org/plugins/fluent-smtp/ |
| 43 | // WP Backend File Search - https://wordpress.org/plugins/wp-backend-file-search-editor-tweaks/ |
| 44 | // TotalPress Custom post types - https://wordpress.org/plugins/custom-post-types/ |
| 45 | |
| 46 | // Reposition notices with the following selectors. Excluding 'notice-system'. |
| 47 | $('#wpbody-content > .wrap > .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 48 | + '#wpbody-content > .wrap > .notice-error,' |
| 49 | + '#wpbody-content > .wrap > .error:not(.hidden),' |
| 50 | + '#wpbody-content > .wrap > .notice-info,' |
| 51 | + '#wpbody-content > .wrap > .notice-information,' |
| 52 | + '#wpbody-content > .wrap > #message,' |
| 53 | + '#wpbody-content > .wrap > .notice-warning:not(.hidden),' |
| 54 | + '#wpbody-content > .wrap > .notice-success,' |
| 55 | + '#wpbody-content > .wrap > .notice-updated,' |
| 56 | + '#wpbody-content > .wrap > .updated:not(.inline),' |
| 57 | + '#wpbody-content > .wrap > .update-nag,' |
| 58 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice:not(.system-notice,.hidden),' |
| 59 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice-error,' |
| 60 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .error:not(.hidden),' |
| 61 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice-info,' |
| 62 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice-information,' |
| 63 | + '#wpbody-content > .wrap > div > #message,' |
| 64 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice-warning:not(.hidden),' |
| 65 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .notice-success,' |
| 66 | + '#wpbody-content > .wrap > div :not(#loco-notices,#loco-content)> .notice-updated,' |
| 67 | + '#wpbody-content > .wrap > div:not(#loco-notices,#loco-content) > .updated:not(.inline),' |
| 68 | + '#wpbody-content > .wrap > div > .update-nag,' |
| 69 | + '#wpbody-content > div > .wrap > .notice:not(.system-notice,.hidden),' |
| 70 | + '#wpbody-content > div > .wrap > .notice-error,' |
| 71 | + '#wpbody-content > div > .wrap > .error:not(.hidden),' |
| 72 | + '#wpbody-content > div > .wrap > .notice-info,' |
| 73 | + '#wpbody-content > div > .wrap > .notice-information,' |
| 74 | + '#wpbody-content > div > .wrap > #message,' |
| 75 | + '#wpbody-content > div > .wrap > .notice-warning:not(.hidden),' |
| 76 | + '#wpbody-content > div > .wrap > .notice-success,' |
| 77 | + '#wpbody-content > div > .wrap > .notice-updated,' |
| 78 | + '#wpbody-content > div > .wrap > .updated:not(.inline),' |
| 79 | + '#wpbody-content > div > .wrap > .update-nag,' |
| 80 | // e.g. on user deletion screen |
| 81 | + '#wpbody-content > form > .wrap > .notice:not(.system-notice,.hidden),' |
| 82 | + '#wpbody-content > form > .wrap > .notice-error,' |
| 83 | + '#wpbody-content > form > .wrap > .error:not(.hidden),' |
| 84 | + '#wpbody-content > form > .wrap > .notice-info,' |
| 85 | + '#wpbody-content > form > .wrap > .notice-information,' |
| 86 | + '#wpbody-content > form > .wrap > #message,' |
| 87 | + '#wpbody-content > form > .wrap > .notice-warning:not(.hidden),' |
| 88 | + '#wpbody-content > form > .wrap > .notice-success,' |
| 89 | + '#wpbody-content > form > .wrap > .notice-updated,' |
| 90 | + '#wpbody-content > form > .wrap > .updated:not(.inline),' |
| 91 | + '#wpbody-content > form > .wrap > .update-nag,' |
| 92 | // WooCommerce |
| 93 | + '#wpbody-content > .wrap.woocommerce > form > .notice:not(.system-notice,.hidden),' |
| 94 | + '#wpbody-content > .wrap.woocommerce > form > .notice-error,' |
| 95 | + '#wpbody-content > .wrap.woocommerce > form > .error:not(.hidden),' |
| 96 | + '#wpbody-content > .wrap.woocommerce > form > .notice-info,' |
| 97 | + '#wpbody-content > .wrap.woocommerce > form > .notice-information,' |
| 98 | + '#wpbody-content > .wrap.woocommerce > form > #message,' |
| 99 | + '#wpbody-content > .wrap.woocommerce > form > .notice-warning:not(.hidden),' |
| 100 | + '#wpbody-content > .wrap.woocommerce > form > .notice-success,' |
| 101 | + '#wpbody-content > .wrap.woocommerce > form > .notice-updated,' |
| 102 | + '#wpbody-content > .wrap.woocommerce > form > .updated:not(.inline),' |
| 103 | + '#wpbody-content > .wrap.woocommerce > form > .update-nag,' |
| 104 | // TranslatePress |
| 105 | + '#wpbody-content > #trp-main-settings > form > .notice:not(.system-notice,.hidden),' |
| 106 | + '#wpbody-content > #trp-main-settings > form > .notice-error,' |
| 107 | + '#wpbody-content > #trp-main-settings > form > .error:not(.hidden),' |
| 108 | + '#wpbody-content > #trp-main-settings > form > .notice-info,' |
| 109 | + '#wpbody-content > #trp-main-settings > form > .notice-information,' |
| 110 | + '#wpbody-content > #trp-main-settings > form > #message,' |
| 111 | + '#wpbody-content > #trp-main-settings > form > .notice-warning:not(.hidden),' |
| 112 | + '#wpbody-content > #trp-main-settings > form > .notice-success,' |
| 113 | + '#wpbody-content > #trp-main-settings > form > .notice-updated,' |
| 114 | + '#wpbody-content > #trp-main-settings > form > .updated:not(.inline),' |
| 115 | + '#wpbody-content > #trp-main-settings > form > .update-nag,' |
| 116 | // WordFence |
| 117 | + '#wpbody-content > .wrap > .wf-container-fluid .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 118 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-error,' |
| 119 | + '#wpbody-content > .wrap > .wf-container-fluid .error:not(.hidden),' |
| 120 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-info,' |
| 121 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-information,' |
| 122 | + '#wpbody-content > .wrap > .wf-container-fluid #message,' |
| 123 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-warning:not(.hidden),' |
| 124 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-success,' |
| 125 | + '#wpbody-content > .wrap > .wf-container-fluid .notice-updated,' |
| 126 | + '#wpbody-content > .wrap > .wf-container-fluid .updated:not(.inline),' |
| 127 | + '#wpbody-content > .wrap > .wf-container-fluid .update-nag,' |
| 128 | // WP All Import |
| 129 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 130 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-error,' |
| 131 | + '#wpbody-content > .wrap .wpallimport-wrapper .error:not(.hidden),' |
| 132 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-info,' |
| 133 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-information,' |
| 134 | + '#wpbody-content > .wrap .wpallimport-wrapper #message,' |
| 135 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-warning:not(.hidden),' |
| 136 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-success,' |
| 137 | + '#wpbody-content > .wrap .wpallimport-wrapper .notice-updated,' |
| 138 | + '#wpbody-content > .wrap .wpallimport-wrapper .updated:not(.inline),' |
| 139 | + '#wpbody-content > .wrap .wpallimport-wrapper .update-nag,' |
| 140 | // WP All Export |
| 141 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 142 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-error,' |
| 143 | + '#wpbody-content > .wrap .wpallexport-wrapper .error:not(.hidden),' |
| 144 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-info,' |
| 145 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-information,' |
| 146 | + '#wpbody-content > .wrap .wpallexport-wrapper #message,' |
| 147 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-warning:not(.hidden),' |
| 148 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-success,' |
| 149 | + '#wpbody-content > .wrap .wpallexport-wrapper .notice-updated,' |
| 150 | + '#wpbody-content > .wrap .wpallexport-wrapper .updated:not(.inline),' |
| 151 | + '#wpbody-content > .wrap .wpallexport-wrapper .update-nag,' |
| 152 | // WS Form |
| 153 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 154 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-error,' |
| 155 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .error:not(.hidden),' |
| 156 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-info,' |
| 157 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-information,' |
| 158 | + '#wpbody-content > #wsf-layout-editor > #poststuff > #message,' |
| 159 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-warning:not(.hidden),' |
| 160 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-success,' |
| 161 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .notice-updated,' |
| 162 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .updated:not(.inline),' |
| 163 | + '#wpbody-content > #wsf-layout-editor > #poststuff > .update-nag,' |
| 164 | // Pods |
| 165 | + '#wpbody-content .pods-submittable-fields > .notice:not(.system-notice,.hidden,.wcml-notice),' |
| 166 | + '#wpbody-content .pods-submittable-fields > .notice-error,' |
| 167 | + '#wpbody-content .pods-submittable-fields > .error:not(.hidden),' |
| 168 | + '#wpbody-content .pods-submittable-fields > .notice-info,' |
| 169 | + '#wpbody-content .pods-submittable-fields > .notice-information,' |
| 170 | + '#wpbody-content .pods-submittable-fields > #message,' |
| 171 | + '#wpbody-content .pods-submittable-fields > .notice-warning:not(.hidden),' |
| 172 | + '#wpbody-content .pods-submittable-fields > .notice-success,' |
| 173 | + '#wpbody-content .pods-submittable-fields > .notice-updated,' |
| 174 | + '#wpbody-content .pods-submittable-fields > .updated:not(.inline),' |
| 175 | + '#wpbody-content .pods-submittable-fields > .update-nag,' |
| 176 | // Funnel Builder for WordPress by FunnelKit |
| 177 | + '#wpbody-content > .bwfan_header > .notice:not(.system-notice,.hidden),' |
| 178 | + '#wpbody-content > .bwfan_header > .notice-error,' |
| 179 | + '#wpbody-content > .bwfan_header > .error:not(.hidden),' |
| 180 | + '#wpbody-content > .bwfan_header > .notice-info,' |
| 181 | + '#wpbody-content > .bwfan_header > .notice-information,' |
| 182 | + '#wpbody-content > .bwfan_header > #message,' |
| 183 | + '#wpbody-content > .bwfan_header > .notice-warning:not(.hidden),' |
| 184 | + '#wpbody-content > .bwfan_header > .notice-success,' |
| 185 | + '#wpbody-content > .bwfan_header > .notice-updated,' |
| 186 | + '#wpbody-content > .bwfan_header > .updated:not(.inline),' |
| 187 | + '#wpbody-content > .bwfan_header > .update-nag,' |
| 188 | + '#wpbody-content > .notice:not(.otgs-notice,.wcml-notice),' // LearnDash, WPML WooCommerce Multilingual |
| 189 | + '#wpbody-content > .update-nag,' // LearnDash |
| 190 | + '#wpbody-content > .jp-connection-banner,' // Jetpack |
| 191 | + '#wpbody-content > .jitm-banner,' // Jetpack |
| 192 | + '#wpbody-content > .jetpack-jitm-message,' // Jetpack |
| 193 | + '#wpbody-content > .ngg_admin_notice,' // Nextgen Gallery |
| 194 | + '#wpbody-content > .imagify-welcome,' // Imagify |
| 195 | + '#wpbody-content #wordfenceAutoUpdateChoice,' // Wordfence |
| 196 | + '#wpbody-content #easy-updates-manager-dashnotice,' // Easy Updates Manager |
| 197 | // GenerateBlocks |
| 198 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice:not(.system-notice,.hidden),' |
| 199 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-error,' |
| 200 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .error:not(.hidden),' |
| 201 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-info,' |
| 202 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-information,' |
| 203 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap #message,' |
| 204 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-warning:not(.hidden),' |
| 205 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-success,' |
| 206 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .notice-updated,' |
| 207 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .updated:not(.inline),' |
| 208 | + '#wpbody-content > .wrap.gblocks-dashboard-wrap .update-nag,' |
| 209 | // WPML |
| 210 | + '#wpbody-content > .otgs-notice,' |
| 211 | // WooCommerce Stock Sync |
| 212 | + '#wpbody-content > .wrap > .ssgs-influencer-banner,' |
| 213 | + '#wpbody-content > .wrap > .ssgs-upgrade-banner,' |
| 214 | + '#wpbody-content > .wrap > .ssgs-rating-banner' |
| 215 | ).not(':hidden').detach() |
| 216 | .appendTo(noticesPanel) |
| 217 | .show(); |
| 218 | |
| 219 | }, 250); |
| 220 | |
| 221 | // Set up the side drawer that holds the hidden admin notices: https://stephanwagner.me/jBox |
| 222 | |
| 223 | var noticesModal = new jBox('Modal', { |
| 224 | attach: '.asenha-admin-notices-menu', |
| 225 | trigger: 'click', // or 'mouseenter' |
| 226 | // content: 'Test' |
| 227 | content: $('.asenha-admin-notices-drawer'), |
| 228 | width: 1118, // pixels |
| 229 | closeButton: 'box', |
| 230 | addClass: 'admin-notices-modal', |
| 231 | overlayClass: 'admin-notices-modal-overlay', |
| 232 | target: '#wpwrap', // where to anchor the modal |
| 233 | position: { |
| 234 | x: 'right', |
| 235 | y: 'top' |
| 236 | }, |
| 237 | // fade: 1000, |
| 238 | animation: { |
| 239 | open: 'slide:bottom', |
| 240 | close: 'slide:bottom' |
| 241 | } |
| 242 | }); |
| 243 | |
| 244 | $(document).on('click', '.asenha-admin-notices-drawer', function() { |
| 245 | setTimeout( |
| 246 | function() |
| 247 | { |
| 248 | // Let's wait 200ms before we proceed. Give enough time for a notice div to be cleared from the DOM before recounting the notices |
| 249 | noticesCount = $('.asenha-admin-notices-drawer > div').length; |
| 250 | $('.asenha-admin-notices-counter').html(noticesCount); // insert count |
| 251 | }, 2000); |
| 252 | }); |
| 253 | |
| 254 | }); |
| 255 | |
| 256 | })( jQuery ); |