icl-admin-notifier.js
61 lines
| 1 | /* <![CDATA[*/ |
| 2 | jQuery(function () { |
| 3 | jQuery('.icl-admin-message-hide').on('click', function (event) { |
| 4 | |
| 5 | if (typeof (event.preventDefault) !== 'undefined') { |
| 6 | event.preventDefault(); |
| 7 | } else { |
| 8 | event.returnValue = false; |
| 9 | } |
| 10 | |
| 11 | var messageBox = jQuery(this).closest('.otgs-is-dismissible'); |
| 12 | if (messageBox) { |
| 13 | var messageID = messageBox.attr('id'); |
| 14 | |
| 15 | jQuery.ajax({ |
| 16 | url: ajaxurl, |
| 17 | type: 'POST', |
| 18 | data: { |
| 19 | action: 'icl-hide-admin-message', |
| 20 | 'icl-admin-message-id': messageID |
| 21 | }, |
| 22 | dataType: 'json', |
| 23 | success: function (ret) { |
| 24 | |
| 25 | if (ret) { |
| 26 | messageBox.fadeOut('slow', function () { |
| 27 | messageBox.removeAttr('class'); |
| 28 | if (ret.type) { |
| 29 | messageBox.addClass(ret.type); |
| 30 | } |
| 31 | messageBox.html(ret.text); |
| 32 | messageBox.fadeIn(); |
| 33 | }); |
| 34 | } else { |
| 35 | messageBox.fadeOut(); |
| 36 | } |
| 37 | } |
| 38 | }); |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | jQuery('a.icl-admin-message-link').on('click', function (event) { |
| 43 | |
| 44 | if (typeof(event.preventDefault) !== 'undefined' ) { |
| 45 | event.preventDefault(); |
| 46 | } else { |
| 47 | event.returnValue = false; |
| 48 | } |
| 49 | |
| 50 | jQuery.post( |
| 51 | ajaxurl, |
| 52 | { |
| 53 | action: 'icl-hide-admin-message', |
| 54 | 'icl-admin-message-id': jQuery(this).parent().parent().attr('id') |
| 55 | }, |
| 56 | function (response) { |
| 57 | } |
| 58 | ); |
| 59 | }); |
| 60 | }); |
| 61 | /*]]>*/ |