| @@ -5,20 +5,162 @@ | ||
| 5 | 5 | */ |
| 6 | 6 | jQuery( function ( $ ) { |
| 7 | 7 | |
| 8 | 8 | $( document.body ) |
| 9 | - | |
| 10 | 9 | .on( 'init_tooltips', function() { |
| 11 | - var tiptip_args = { | |
| 12 | - 'attribute': 'data-tip', | |
| 13 | - 'fadeIn': 50, | |
| 14 | - 'fadeOut': 50, | |
| 15 | - 'delay': 200 | |
| 16 | - }; | |
| 17 | - | |
| 18 | - $( '.help_tip' ).tipTip( tiptip_args ); | |
| 10 | + activateTipTip(); | |
| 19 | 11 | }); |
| 20 | 12 | |
| 21 | 13 | // Tooltips |
| 22 | 14 | $( document.body ).trigger( 'init_tooltips' ); |
| 23 | 15 | |
| 24 | -}); | |
| 16 | + $( '#ph_dismiss_notice_retired_template_assistant' ).click(function(e) | |
| 17 | + { | |
| 18 | + e.preventDefault(); | |
| 19 | + | |
| 20 | + var data = { | |
| 21 | + 'action': 'propertyhive_dismiss_notice_retired_template_assistant' | |
| 22 | + }; | |
| 23 | + | |
| 24 | + $.post( ajaxurl, data, function(response) { | |
| 25 | + $( '#ph_notice_retired_template_assistant' ).fadeOut(); | |
| 26 | + }); | |
| 27 | + }); | |
| 28 | + | |
| 29 | + $( '#ph_dismiss_notice_leave_review' ).click(function(e) | |
| 30 | + { | |
| 31 | + e.preventDefault(); | |
| 32 | + | |
| 33 | + var data = { | |
| 34 | + 'action': 'propertyhive_dismiss_notice_leave_review' | |
| 35 | + }; | |
| 36 | + | |
| 37 | + $.post( ajaxurl, data, function(response) { | |
| 38 | + $( '#ph_notice_leave_review' ).fadeOut(); | |
| 39 | + }); | |
| 40 | + }); | |
| 41 | + | |
| 42 | + $( '#ph_dismiss_notice_epl' ).click(function(e) | |
| 43 | + { | |
| 44 | + e.preventDefault(); | |
| 45 | + | |
| 46 | + var data = { | |
| 47 | + 'action': 'propertyhive_dismiss_notice_epl' | |
| 48 | + }; | |
| 49 | + | |
| 50 | + $.post( ajaxurl, data, function(response) { | |
| 51 | + $( '#ph_notice_epl' ).fadeOut(); | |
| 52 | + }); | |
| 53 | + }); | |
| 54 | + | |
| 55 | + $( '#ph_dismiss_notice_demo_data' ).click(function(e) | |
| 56 | + { | |
| 57 | + e.preventDefault(); | |
| 58 | + | |
| 59 | + var data = { | |
| 60 | + 'action': 'propertyhive_dismiss_notice_demo_data' | |
| 61 | + }; | |
| 62 | + | |
| 63 | + $.post( ajaxurl, data, function(response) { | |
| 64 | + $( '#ph_notice_demo_data' ).fadeOut(); | |
| 65 | + }); | |
| 66 | + }); | |
| 67 | + | |
| 68 | + $( '#ph_dismiss_notice_missing_search_results' ).click(function(e) | |
| 69 | + { | |
| 70 | + e.preventDefault(); | |
| 71 | + | |
| 72 | + var data = { | |
| 73 | + 'action': 'propertyhive_dismiss_notice_missing_search_results' | |
| 74 | + }; | |
| 75 | + | |
| 76 | + $.post( ajaxurl, data, function(response) { | |
| 77 | + $( '#ph_notice_missing_search_results' ).fadeOut(); | |
| 78 | + }); | |
| 79 | + }); | |
| 80 | + | |
| 81 | + $( '#ph_dismiss_notice_missing_google_maps_api_key' ).click(function(e) | |
| 82 | + { | |
| 83 | + e.preventDefault(); | |
| 84 | + | |
| 85 | + var data = { | |
| 86 | + 'action': 'propertyhive_dismiss_notice_missing_google_maps_api_key' | |
| 87 | + }; | |
| 88 | + | |
| 89 | + $.post( ajaxurl, data, function(response) { | |
| 90 | + $( '#ph_notice_missing_google_maps_api_key' ).fadeOut(); | |
| 91 | + }); | |
| 92 | + }); | |
| 93 | + | |
| 94 | + $( '#ph_dismiss_notice_invalid_expired_license_key' ).click(function(e) | |
| 95 | + { | |
| 96 | + e.preventDefault(); | |
| 97 | + | |
| 98 | + var data = { | |
| 99 | + 'action': 'propertyhive_dismiss_notice_invalid_expired_license_key' | |
| 100 | + }; | |
| 101 | + | |
| 102 | + $.post( ajaxurl, data, function(response) { | |
| 103 | + $( '#ph_notice_invalid_expired_license_key' ).fadeOut(); | |
| 104 | + }); | |
| 105 | + }); | |
| 106 | + | |
| 107 | + $( '#ph_dismiss_notice_email_cron_not_running' ).click(function(e) | |
| 108 | + { | |
| 109 | + e.preventDefault(); | |
| 110 | + | |
| 111 | + var data = { | |
| 112 | + 'action': 'propertyhive_dismiss_notice_email_cron_not_running' | |
| 113 | + }; | |
| 114 | + | |
| 115 | + $.post( ajaxurl, data, function(response) { | |
| 116 | + $( '#ph_notice_email_cron_not_running' ).fadeOut(); | |
| 117 | + }); | |
| 118 | + }); | |
| 119 | + | |
| 120 | + if ( propertyhive_admin.ajax_actions && propertyhive_admin.ajax_actions.length > 0 ) | |
| 121 | + { | |
| 122 | + for ( var i in propertyhive_admin.ajax_actions ) | |
| 123 | + { | |
| 124 | + var ajax_action = propertyhive_admin.ajax_actions[i].split('^'); | |
| 125 | + | |
| 126 | + jQuery('#' + ajax_action[0].replace('get_', 'propertyhive_')).html('Loading...'); | |
| 127 | + | |
| 128 | + if ( ajax_action[2] ) // callback | |
| 129 | + { | |
| 130 | + eval(ajax_action[2]); | |
| 131 | + } | |
| 132 | + else | |
| 133 | + { | |
| 134 | + var data = { | |
| 135 | + action: 'propertyhive_' + ajax_action[0], | |
| 136 | + post_id: propertyhive_admin.post_id, | |
| 137 | + security: ajax_action[1] | |
| 138 | + } | |
| 139 | + | |
| 140 | + jQuery.ajax({ | |
| 141 | + type: "POST", | |
| 142 | + url: ajaxurl, | |
| 143 | + data: data, | |
| 144 | + target_div: '#' + ajax_action[0].replace('get_', 'propertyhive_'), | |
| 145 | + success: function(response) | |
| 146 | + { | |
| 147 | + jQuery(this.target_div).html(response); | |
| 148 | + activateTipTip(); | |
| 149 | + }, | |
| 150 | + dataType: 'html' | |
| 151 | + }); | |
| 152 | + } | |
| 153 | + } | |
| 154 | + } | |
| 155 | +}); | |
| 156 | + | |
| 157 | +function activateTipTip() { | |
| 158 | + var tiptip_args = { | |
| 159 | + 'attribute': 'data-tip', | |
| 160 | + 'fadeIn': 50, | |
| 161 | + 'fadeOut': 50, | |
| 162 | + 'delay': 200 | |
| 163 | + }; | |
| 164 | + | |
| 165 | + jQuery( '.help_tip' ).tipTip( tiptip_args ); | |
| 166 | +} | |