Changeset 3199623
- Timestamp:
- 11/29/2024 06:13:31 PM (16 months ago)
- Location:
- orbisius-simple-notice/trunk
- Files:
-
- 2 edited
-
orbisius-simple-notice.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
orbisius-simple-notice/trunk/orbisius-simple-notice.php
r2462972 r3199623 58 58 $dev = empty($_SERVER['DEV_ENV']) ? 0 : 1; 59 59 $suffix = $dev ? '' : '.min'; 60 61 wp_enqueue_script('jquery'); 60 62 61 63 /*wp_register_style('simple_notice', plugins_url("/assets/main{$suffix}.css", __FILE__)); … … 114 116 $js_code .= <<<FORM_EOF 115 117 <script> 116 jQuery(document).ready(function ($) { 117 var msg_id = jQuery('#orbisius_simple_notice').data('msg_id'); 118 119 if (!jQuery('body').hasClass('wp-admin')) { // public area only 120 var orb_simp_ntc_dismiss_hash = jQuery.cookie('orb_simp_ntc_dismiss') || ''; 121 122 /* if the cookie exists and matches the msg_id that means the user has dismissed the message already. So don't show it for another day. */ 123 if (orb_simp_ntc_dismiss_hash == msg_id) { 124 jQuery('#orbisius_simple_notice_container').hide(); 125 } 126 } 127 128 // The user has clicked on the X sign 129 jQuery('#orbisius_simple_notice_container .dismiss_message').on('click', function() { 130 jQuery('#orbisius_simple_notice_container').slideUp('slow'); 131 132 // for WP admin show the message. 133 if (jQuery('body').hasClass('wp-admin')) { 134 setTimeout(function () { 135 jQuery('#orbisius_simple_notice_container').slideDown('slow'); 136 }, 2000); 137 } else { 138 // this will be empty for new messages or expired cookies 139 var orb_simp_ntc_dismiss_hash = jQuery.cookie('orb_simp_ntc_dismiss') || ''; 140 141 if (orb_simp_ntc_dismiss_hash == '') { 142 jQuery.cookie('orb_simp_ntc_dismiss', msg_id, { expires: 2 } ); 118 (function ($) { 119 $(document).ready(function ($) { 120 let msg_id = jQuery('#orbisius_simple_notice').data('msg_id'); 121 122 if (!jQuery('body').hasClass('wp-admin')) { // public area only 123 let orb_simp_ntc_dismiss_hash = jQuery.cookie('orb_simp_ntc_dismiss') || ''; 124 125 /* if the cookie exists and matches the msg_id that means the user has dismissed the message already. So don't show it for another day. */ 126 if (orb_simp_ntc_dismiss_hash == msg_id) { 127 jQuery('#orbisius_simple_notice_container').hide(); 143 128 } 144 129 } 130 131 // The user has clicked on the X sign 132 jQuery('#orbisius_simple_notice_container .dismiss_message').on('click', function() { 133 jQuery('#orbisius_simple_notice_container').slideUp('slow'); 134 135 // for WP admin show the message. 136 if (jQuery('body').hasClass('wp-admin')) { 137 setTimeout(function () { 138 jQuery('#orbisius_simple_notice_container').slideDown('slow'); 139 }, 2000); 140 } else { 141 // this will be empty for new messages or expired cookies 142 var orb_simp_ntc_dismiss_hash = jQuery.cookie('orb_simp_ntc_dismiss') || ''; 143 144 if (orb_simp_ntc_dismiss_hash == '') { 145 jQuery.cookie('orb_simp_ntc_dismiss', msg_id, { expires: 2 } ); 146 } 147 } 148 }); 145 149 }); 146 }) ;150 })(jQuery); 147 151 </script> 148 152 FORM_EOF; … … 207 211 $js_code .= <<<FORM_EOF 208 212 <script> 209 jQuery(document).ready(function ($) { 210 jQuery('#orbisius_simple_notice_container').prependTo('body'); // .css('postion', '') 211 }); 213 (function($) { 214 $(document).ready(function ($) { 215 $('#orbisius_simple_notice_container').prependTo('body'); // .css('postion', '') 216 }); 217 })(jQuery); 212 218 </script> 213 219 FORM_EOF; -
orbisius-simple-notice/trunk/readme.txt
r2462972 r3199623 64 64 == Changelog == 65 65 66 = 1.1.3 = 67 * Fixed how jquery and js was loaded using a different method. 68 * Making sure that jquery is loaded. 69 66 70 = 1.1.2 = 67 71 * Added z-index so the links in the message are clickable.
Note: See TracChangeset
for help on using the changeset viewer.