1jQuery(document).ready(function ($) { 2 var baseUrl = window.location.origin + "/wp-json/crm-api/v1/"; 3 4 jQuery("#sync_all_delegates").click(function () { 5 var syncingNotice = jQuery( 6 '<span class="syncing-notice">Syncing...</span>' 7 ); 8 jQuery(this).after(syncingNotice); 9 jQuery 10 .ajax({ 11 url: baseUrl + "push-all-event-delegates", 12 type: "GET", 13 }) 14 .done(function (response) { 15 syncingNotice.text("Sync Started in Background !"); 16 }) 17 .fail(function () { 18 syncingNotice.text("Sync Failed!"); 19 }) 20 .always(function () { 21 setTimeout(function () { 22 syncingNotice.remove(); 23 }, 3000); 24 }); 25 }); 26 27 jQuery("#sync_all_transactions").click(function () { 28 var syncingNotice = jQuery( 29 '<span class="syncing-notice">Syncing...</span>' 30 ); 31 jQuery(this).after(syncingNotice); 32 jQuery 33 .ajax({ 34 url: baseUrl + "push-all-membership-subscriptions", 35 type: "GET", 36 }) 37 .done(function (response) { 38 syncingNotice.text("Sync Started in Background !"); 39 }) 40 .fail(function () { 41 syncingNotice.text("Sync Failed!"); 42 }) 43 .always(function () { 44 setTimeout(function () { 45 syncingNotice.remove(); 46 }, 3000); 47 }); 48 }); 49 50 jQuery("#sync_all_publications").click(function () { 51 var syncingNotice = jQuery( 52 '<span class="syncing-notice">Syncing...</span>' 53 ); 54 jQuery(this).after(syncingNotice); 55 jQuery 56 .ajax({ 57 url: baseUrl + "push-all-publications", 58 type: "GET", 59 }) 60 .done(function (response) { 61 syncingNotice.text("Sync Started in Background !"); 62 }) 63 .fail(function () { 64 syncingNotice.text("Sync Failed!"); 65 }) 66 .always(function () { 67 setTimeout(function () { 68 syncingNotice.remove(); 69 }, 3000); 70 }); 71 }); 72 73 $(".SingleOrderSyncDelegate").click(function (e) { 74 e.preventDefault(); 75 var button = $(this); 76 button.prop("disabled", true).text("Syncing in progress..."); 77 78 $(window).on("beforeunload", function () { 79 return "Are you sure you want to leave? Syncing is in progress."; 80 }); 81 var orderid = button.data("orderid"); 82 if (orderid) { 83 $.ajax({ 84 type: "GET", 85 url: baseUrl + "push-single-event-delegates", 86 data: { 87 orderid: orderid, 88 }, 89 complete: function (response) { 90 console.log(response); 91 button.prop("disabled", false).text("Push Delegates"); 92 93 $(window).off("beforeunload"); 94 window.location.reload(); 95 }, 96 }); 97 } 98 }); 99 100 $(".SingleOrderSyncTransaction").click(function (e) { 101 e.preventDefault(); 102 var button = $(this); 103 button.prop("disabled", true).text("Syncing in progress..."); 104 $(window).on("beforeunload", function () { 105 return "Are you sure you want to leave? Syncing is in progress."; 106 }); 107 var orderid = button.data("orderid"); 108 if (orderid) { 109 $.ajax({ 110 type: "GET", 111 url: baseUrl + "push-single-subscription", 112 data: { 113 orderid: orderid, 114 }, 115 complete: function (response) { 116 console.log(response); 117 button.prop("disabled", false).text("Push Transaction"); 118 /* $(window).off('beforeunload'); 119 window.location.reload(); // 420 453 72874 */ 120 }, 121 }); 122 } 123 }); 124 125 $(".SingleOrderSyncPublication").click(function (e) { 126 e.preventDefault(); 127 var button = $(this); 128 button.prop("disabled", true).text("Syncing in progress..."); 129 130 $(window).on("beforeunload", function () { 131 return "Are you sure you want to leave? Syncing is in progress."; 132 }); 133 var orderid = button.data("orderid"); 134 if (orderid) { 135 $.ajax({ 136 type: "GET", 137 url: baseUrl + "push-single-publication", 138 data: { 139 orderid: orderid, 140 }, 141 complete: function (response) { 142 console.log(response); 143 button.prop("disabled", false).text("Push Publication"); 144 145 $(window).off("beforeunload"); 146 window.location.reload(); // 420 453 72874 147 }, 148 }); 149 } 150 }); 151 152 // Pull All Actions 153 jQuery("#pull_all_events").click(function () { 154 var syncingNotice = jQuery( 155 '<span class="syncing-notice">Syncing...</span>' 156 ); 157 jQuery(this).after(syncingNotice); 158 jQuery 159 .ajax({ 160 url: baseUrl + "pull-all-events", 161 type: "GET", 162 }) 163 .done(function (response) {
164 syncingNotice.text("Sync Started in Background !"); 165 }) 166 .fail(function () { 167 syncingNotice.text("Sync Failed!"); 168 }) 169 .always(function () { 170 setTimeout(function () { 171 syncingNotice.remove(); 172 }, 3000); 173 }); 174 }); 175 176 jQuery("#pull_all_transactions").click(function () { 177 var syncingNotice = jQuery( 178 '<span class="syncing-notice">Syncing...</span>' 179 ); 180 jQuery(this).after(syncingNotice); 181 jQuery 182 .ajax({ 183 url: baseUrl + "pull-all-memberships-crm", 184 type: "GET", 185 }) 186 .done(function (response) { 187 syncingNotice.text("Sync Started in Background !"); 188 }) 189 .fail(function () { 190 syncingNotice.text("Sync Failed!"); 191 }) 192 .always(function () { 193 setTimeout(function () { 194 syncingNotice.remove(); 195 }, 3000); 196 }); 197 }); 198 199 jQuery("#pull_all_publications").click(function () { 200 var syncingNotice = jQuery( 201 '<span class="syncing-notice">Syncing...</span>' 202 ); 203 jQuery(this).after(syncingNotice); 204 jQuery 205 .ajax({ 206 url: baseUrl + "pull-all-publications", 207 type: "GET", 208 }) 209 .done(function (response) { 210 syncingNotice.text("Sync Started in Background !"); 211 }) 212 .fail(function () { 213 syncingNotice.text("Sync Failed!"); 214 }) 215 .always(function () { 216 setTimeout(function () { 217 syncingNotice.remove(); 218 }, 3000); 219 }); 220 }); 221 222 // Pull Single Actions 223 $(".SingleEventPull").click(function (e) { 224 e.preventDefault(); 225 var button = $(this); 226 button.prop("disabled", true).text("Syncing in progress..."); 227 228 $(window).on("beforeunload", function () { 229 return "Are you sure you want to leave? Syncing is in progress."; 230 }); 231 var guid = button.data("guid"); 232 if (guid) { 233 $.ajax({ 234 type: "GET", 235 url: baseUrl + "pull-single-event", 236 data: { 237 guid: guid, 238 }, 239 complete: function (response) { 240 button.prop("disabled", false).text("Pull Event"); 241 $(window).off("beforeunload"); 242 window.location.reload(); 243 }, 244 }); 245 } 246 }); 247});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.