1jQuery(document).ready(function () { 2 loadTripPlanner(); 3 4 jQuery(document).on("click", ".aAddToTrip", function (e) { 5 e.preventDefault(); 6 jQuery(".tbItemCount").html( 7 '<img src="/images/TripBuilderLoader.gif" style="padding:3px;" />' 8 ); 9 10 var hash = jQuery(this).attr("href").split("#")[1]; 11 12 if (jQuery(this).hasClass("remove")) { 13 removeTripItemByRefAndType( 14 "", 15 hash, 16 jQuery(this).attr("rel"), 17 jQuery(this) 18 ); 19 //setTimeout(loadTripPlanner(''), 1000) 20 } else { 21 addTripItem("", jQuery(this).attr("rel"), hash, jQuery(this), "0"); 22 //setTimeout(loadTripPlanner(''), 2000) 23 } 24 }); 25 26 jQuery(document).on("click", "#button_mytrip", function (e) { 27 loadTripPlanner(""); 28 jQuery("#mytrip_details").slideToggle("fast"); 29 e.preventDefault(); 30 }); 31 32 jQuery(".closeX").on("click", function (e) { 33 jQuery("#mytrip_details").slideUp("fast"); 34 e.preventDefault(); 35 }); 36 37 jQuery(document).on("click", "a.delItem", function (e) { 38 var hash = jQuery(this).attr("href").split("#")[1]; 39 removeTripItemByRefAndType( 40 "", 41 hash, 42 jQuery(this).attr("rel"), 43 jQuery(this), 44 loadTripPlanner("") 45 ); 46 e.preventDefault(); 47 }); 48 49 jQuery(document).on("click", "#btnTripPlanner", function (e) { 50 e.preventDefault(); 51 if (jQuery(this).hasClass("remove")) { 52 removeTripItem(jQuery(this).attr("data-id"), jQuery(this)); 53 } else { 54 addTripItemDetails(jQuery(this).attr("data-id"), jQuery(this)); 55 } 56 }); 57 58 jQuery(document).on("click", ".trip--add", function (e) { 59 e.preventDefault(); 60 if (jQuery(this).hasClass("on")) { 61 removeTripItemListing(jQuery(this).attr("data-id"), jQuery(this)); 62 } else { 63 addTripItemListing(jQuery(this).attr("data-id"), jQuery(this)); 64 } 65 }); 66 67 jQuery(document).on("click", ".tp-remove", function (e) { 68 e.preventDefault(); 69 70 removeTripItem(jQuery(this).attr("data-id"), jQuery(this), true); 71 }); 72 73 function UpdateAlpha() { 74 var i = 1; 75 76 jQuery(".board-item").each(function () { 77 jQuery(this) 78 .children() 79 .find(".alpha") 80 .html(colName(i - 1).toUpperCase()); 81 i++; 82 }); 83 } 84 85 function addTripItem(userref, typeid, refid, ele, order, isDetails) { 86 jQuery.ajax({ 87 type: "POST", 88 url: "/Resources/ws.aspx", 89 data: "{'ListingID':'" + userref + "'}", 90 contentType: "application/json; charset=utf-8", 91 dataType: "json", 92 beforeSend: function (xhr) { 93 xhr.setRequestHeader("DNN-Service", "true"); 94 xhr.setRequestHeader("DNN-Service-Method", "AddToTripPlanner"); 95 }, 96 success: function (data) { 97 ele.addClass("remove"); 98 ele.prev().addClass("remove"); 99 ele.html( 100 '<div class="leftArrow"></div><span>Remove From Trip Planner</span>' 101 ); 102 }, 103 }); 104 } 105 106 function removeTripItemByRefAndType(userref, refid, itemtype, ele) { 107 if (confirm("Are you sure you want to remove this item?")) { 108 /* 109 jQuery.ajax({ 110 type: "POST", 111 url: "/Resources/wsTrip.asmx/RemoveTripItemByRefAndType", 112 data: "{ 'userref': '" + userref + "', 'refid': '" + refid + "', 'itemtype': " + itemtype + " }", 113 contentType: "application/json; charset=utf-8", 114 dataType: "json", 115 success: function (msg) { 116 if (msg.d !== '' && msg.d !== null) { 117 118 loadTripPlanner(''); 119 120 //jQuery.map(msg.d, function (item) { 121 122 //if (ele.parent().parent().parent().parent().parent().parent().parent().hasClass('triplist')) { 123 //ele.parent().parent().parent().parent().parent().parent().parent().fadeOut(); 124 if (ele.parents('div[class^="board-item"]').length>0) { 125 ele.parents('div[class^="board-item"]').fadeOut(); 126 ele.parents('div[class^="board-item"]').remove(); 127 initPlannerItems(); 128 updateAlpha(); 129 } else if (ele.hasClass('delItem')) { 130 ele.fadeOut().prev('.preview-item').fadeOut(); 131 } else { 132 ele.removeClass('remove'); 133 ele.prev().removeClass('remove'); 134 ele.html(''); //'<div class="leftArrow"></div><span class="icon-suitcase"></span><span>Add To Trip Planner</span>'); 135 136 } 137 138 139 //}); 140 } 141 }, 142 error: function (xhr, msg, e) { 143 window.console.log(msg + '\n' + xhr.status + ': ' + xhr.statusText); 144 } 145 }); 146 */ 147 } else { 148 loadTripPlanner(""); 149 } 150 } 151 152 function animateToTripPlanner(itemTo, initialPos) { 153 var pos = initialPos.offset(); 154 var pos2 = jQuery(itemTo).offset(); 155 var myTop = 0; 156 157 itemFrom = jQuery("#trip-planner-icon"); 158 jQuery("body").prepend(itemFrom); 159 itemFrom.css({ 160 left: pos.left, 161 top: pos.top, 162 position: "absolute", 163 "z-index": "9999", 164 }); 165 itemFrom.show(); 166 167 if (pos2.top > jQuery(window).scrollTop()) { 168 myTop = pos2.top; 169 } else { 170 myTop = jQuery(window).scrollTop() - 30; 171 } 172 itemFrom.animate({ left: pos2.left, top: myTop + 10 }, 1000); 173 itemFrom.fadeOut("fast"); 174 } 175 176 function loadTripPlanner(userref) { 177 jQuery.ajax({ 178 type: "GET", 179 url: "/api/MPRT_WebApi/Web/LoadTripPlanner", 180 contentType: "application/json; charset=utf-8", 181 dataType: "json", 182 success: function (data) { 183 if (data.count == "0") { 184 jQuery(".icon-counter").hide(); 185 } else { 186 jQuery(".icon-counter").html(data.count); 187 jQuery(".icon-counter").show(); 188 } 189 190 if (jQuery(".tp-remove").length > 0) { 191 if (data.count == "0") { 192 jQuery(".tp--actions").hide(); 193 } else { 194 jQuery(".tp--actions").show(); 195 } 196 } 197 }, 198 }); 199 } 200 201 function addTripItemDetails(listingID, ele, order) { 202 jQuery.ajax({ 203 type: "GET", 204 url: "/api/MPRT_WebApi/Web/AddToTripPlanner?ListingID=" + listingID, 205 contentType: "application/json; charset=utf-8", 206 dataType: "json", 207 success: function (data) { 208 if (data.count == "0") { 209 jQuery(".icon-counter").hide(); 210 } else { 211 jQuery(".icon-counter").html(data.count); 212 jQuery(".icon-counter").show(); 213 } 214 215 if (jQuery(".tp-remove").length > 0) { 216 if (data.count == "0") { 217 jQuery(".tp--actions").hide(); 218 } else { 219 jQuery(".tp--actions").show(); 220 } 221 } 222 223 ele.addClass("remove"); 224 ele.prev().addClass("remove"); 225 ele.html("Remove From Trip Planner"); 226 }, 227 }); 228 } 229 230 function removeTripItem(listingID, ele, removeElement) { 231 swal( 232 { 233 title: "Are you sure?", 234 text: "Are you sure you want to remove this item?", 235 type: "warning", 236 showCancelButton: true, 237 confirmButtonColor: "#DD6B55", 238 confirmButtonText: "Yes, remove it!", 239 cancelButtonText: "No, cancel please!", 240 closeOnConfirm: true, 241 closeOnCancel: true, 242 }, 243 function (isConfirm) { 244 if (isConfirm) { 245 jQuery.ajax({ 246 type: "GET", 247 url: 248 "/api/MPRT_WebApi/Web/RemoveFromTripPlanner?ListingID=" + 249 listingID, 250 contentType: "application/json; charset=utf-8", 251 dataType: "json", 252 success: function (data) { 253 if (data.count == "0") { 254 jQuery(".icon-counter").hide(); 255 } else { 256 jQuery(".icon-counter").html(data.count); 257 jQuery(".icon-counter").show(); 258 } 259 260 if (jQuery(".tp-remove").length > 0) { 261 if (data.count == "0") { 262 jQuery(".tp--actions").hide(); 263 } else { 264 jQuery(".tp--actions").show(); 265 } 266 } 267 268 if (removeElement) { 269 ele.parent().parent().parent().remove(); 270 setTimeout(UpdateAlpha(), 2000); 271 } else { 272 ele.removeClass("remove"); 273 ele.prev().removeClass("remove"); 274 ele.html("Add To Trip Planner"); 275 } 276 }, 277 }); 278 } 279 } 280 ); 281 } 282 283 function addTripItemListing(listingID, ele, order) { 284 jQuery.ajax({ 285 type: "GET", 286 url: "/api/MPRT_WebApi/Web/AddToTripPlanner?ListingID=" + listingID, 287 contentType: "application/json; charset=utf-8", 288 dataType: "json", 289 success: function (data) { 290 if (data.count == "0") { 291 jQuery(".icon-counter").hide(); 292 } else { 293 jQuery(".icon-counter").html(data.count); 294 jQuery(".icon-counter").show(); 295 } 296 if (jQuery(".tp-remove").length > 0) { 297 if (data.count == "0") { 298 jQuery(".tp--actions").hide(); 299 } else { 300 jQuery(".tp--actions").show(); 301 } 302 } 303 304 ele.addClass("on"); 305 ele.attr("data-original-title", "Remove From Trip Planner"); 306 }, 307 }); 308 } 309 310 function removeTripItemListing(listingID, ele) { 311 swal( 312 { 313 title: "Are you sure?", 314 text: "Are you sure you want to remove this item?", 315 type: "warning", 316 showCancelButton: true, 317 confirmButtonColor: "#DD6B55", 318 confirmButtonText: "Yes, remove it!", 319 cancelButtonText: "No, cancel please!", 320 closeOnConfirm: true, 321 closeOnCancel: true, 322 }, 323 function (isConfirm) { 324 if (isConfirm) { 325 jQuery.ajax({ 326 type: "GET", 327 url: 328 "/api/MPRT_WebApi/Web/RemoveFromTripPlanner?ListingID=" + 329 listingID, 330 contentType: "application/json; charset=utf-8", 331 dataType: "json", 332 success: function (data) { 333 if (data.count == "0") { 334 jQuery(".icon-counter").hide(); 335 } else { 336 jQuery(".icon-counter").html(data.count); 337 jQuery(".icon-counter").show(); 338 } 339 340 if (jQuery(".tp-remove").length > 0) { 341 if (data.count == "0") { 342 jQuery(".tp--actions").hide(); 343 } else { 344 jQuery(".tp--actions").show(); 345 } 346 } 347 348 ele.removeClass("on"); 349 ele.attr("data-original-title", "Add to Trip Planner"); 350 }, 351 }); 352 } 353 } 354 ); 355 } 356});
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.