1$('div#atcHolder').delegate('select', 'change', function() { 2 var random_num = Math.floor(Math.random() * 101); 3 var field = $(this).attr("name"); 4 var text = $(this).val(); 5 6 if (document.getElementById(field + 'Val')) { 7 document.getElementById(field + 'Val').value = text; 8 } 9 10 var style_id = document.getElementById('idVal').value; 11 var siz = document.getElementById('sizVal').value; 12 var attr1 = document.getElementById('attr1Val').value; 13 var attr2 = document.getElementById('attr2Val').value; 14 var qty = document.getElementById('qty' + style_id).value; 15 var mode = document.getElementById('modeVal').value; 16 var package = document.getElementById('packageVal').value; 17 18 $.ajax({ 19 url: '/functions/purchasing.cfc?method=init&random=' + random_num, 20 type: 'post', 21 dataType: 'html', 22 cache: false, 23 data: { 24 id: style_id, 25 siz: siz, 26 attr1: attr1, 27 attr2: attr2, 28 qty: qty, 29 mode: mode, 30 package: package 31 }, 32 success: function(data) { 33 $('div#atcHolder').html(data); 34 }, 35 error: function(request, textStatus, errorThrown) { 36 alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 37 } 38 }); 39}); 40 41var previousSelectedSize = ''; 42$('div#atcHolder').delegate('a.sizeBox', 'click', function() { 43 var random_num = Math.floor(Math.random() * 101); 44 var text = $(this).attr("name"); 45 var myID = $(this).attr("id"); 46 var sizeID = myID.replace("sizeBox", ""); 47 if ($(this).hasClass("inactive")) { 48 return false; 49 } 50 document.getElementById('sizVal').value = sizeID; 51 52 if (previousSelectedSize != '') { 53 $('#' + previousSelectedSize).removeClass("selected"); 54 } 55 $('#' + myID).addClass("selected"); 56 57 previousSelectedSize = myID; 58 59 var style_id = document.getElementById('idVal').value; 60 var siz = document.getElementById('sizVal').value; 61 var attr1 = document.getElementById('attr1Val').value; 62 var attr2 = document.getElementById('attr2Val').value; 63 var qty = document.getElementById('qty' + style_id).value; 64 var mode = document.getElementById('modeVal').value; 65 var package = document.getElementById('packageVal').value; 66 67 $.ajax({
68 url: '/functions/purchasing.cfc?method=init&random=' + random_num, 69 type: 'post', 70 dataType: 'html', 71 cache: false, 72 data: { 73 id: style_id, 74 siz: siz, 75 attr1: attr1, 76 attr2: attr2, 77 qty: qty, 78 mode: mode, 79 package: package 80 }, 81 success: function(data) { 82 $('div#atcHolder').html(data); 83 }, 84 error: function(request, textStatus, errorThrown) { 85 alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 86 } 87 }); 88}); 89 90var previousSelectedColor = ''; 91$('div#atcHolder').delegate('a.colorBox', 'click', function() { 92 var random_num = Math.floor(Math.random() * 101); 93 var text = $(this).attr("name"); 94 var myID = $(this).attr("id"); 95 var colorID = myID.replace("colorBox", ""); 96 97 document.getElementById('attr1Val').value = colorID; 98 99 if (previousSelectedColor != '') { 100 $('#' + previousSelectedColor).removeClass("selected"); 101 } 102 $('#' + myID).addClass("selected"); 103 104 previousSelectedColor = myID; 105 106 var style_id = document.getElementById('idVal').value; 107 var siz = document.getElementById('sizVal').value; 108 var attr1 = document.getElementById('attr1Val').value; 109 var attr2 = document.getElementById('attr2Val').value; 110 var qty = document.getElementById('qty' + style_id).value; 111 var mode = document.getElementById('modeVal').value; 112 var package = document.getElementById('packageVal').value; 113 114 //***** Change MagicZoom Image *****// 115 if ($("#colorBox" + attr1 + " img").length) { 116 var strImg = $("#colorBox" + attr1 + " img").attr("src"); 117 var zoom = document.getElementById('zoomer'); 118 zoom.href = strImg.replace("-M.", "-L."); 119 //zoom.rel = 'drag-mode: true; zoom-height: 170px'; // enable zoom drag mode 120 zoom.firstChild.src = strImg; 121 // refresh ALL zooms on the page 122 MagicZoomPlus.refresh(); 123 } 124 125 $.ajax({
126 url: '/functions/purchasing.cfc?method=init&random=' + random_num, 127 type: 'post', 128 dataType: 'html', 129 cache: false, 130 data: { 131 id: style_id, 132 siz: siz, 133 attr1: attr1, 134 attr2: attr2, 135 qty: qty, 136 mode: mode, 137 package: package 138 }, 139 success: function(data) { 140 $('div#atcHolder').html(data); 141 }, 142 error: function(request, textStatus, errorThrown) { 143 alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 144 } 145 }); 146}); 147 148 149/******************* PRODUCT RATINGS ************/ 150$("div#starRating .review-star").on("click", function() { 151 var rating = this.id; 152 $("div#starRating .review-star").each(function() { 153 if (this.id <= rating) { 154 $(this).attr("src", "/images/star_full.png"); 155 } else { 156 $(this).attr("src", "/images/star_empty.png"); 157 } 158 }); 159 $("input#overall_rating").attr("value", rating); 160}); 161 162 163/******************* ADD PRODUCT RATINGS ************/ 164$("div.product-write-review a.product-write-submit").on("click", function(e) { 165 e.preventDefault(); 166 var pass = true, 167 wrongCapt = false; 168 var myID = this.id; 169 170 var element = []; 171 element[0] = "comment"; 172 element[1] = "review_title"; 173 element[2] = "nickname"; 174 element[3] = "captcha"; 175 element[4] = "overall_rating"; 176 //check empty fields 177 for (var i = 0; i < 5; i++) { 178 if (element[i] == "overall_rating") { 179 if ($("#" + element[i]).val() == "") { 180 $("#overallRatingMess").show(300); 181 pass = false; 182 } else { 183 $("#overallRatingMess").hide(300); 184 } 185 } else { 186 if ($("#" + element[i]).val() == "") { 187 $("#" + element[i]).css("border-color", "#f00"); 188 pass = false; 189 } else { 190 $("#" + element[i]).css("border-color", "#ccc"); 191 } 192 } 193 } 194 // check captcha 195 if ($("#captcha").val() == $("#captcha_sum").val()) { 196 $("#captcha").css("border-color", "#ccc"); 197 wrongCapt = false; 198 } else if ($("#captcha").val() != $("#captcha_sum").val()) { 199 $("#captcha").css("border-color", "#f00"); 200 wrongCapt = true; 201 } 202 // call ajax 203 if (pass && !wrongCapt) { 204 var myForm = $("form#reviewForm" + myID).serialize(); 205 myForm = "/index.cfm?action=PROCESSREVIEW&" + myForm; 206 $.ajax({
207 url: myForm, 208 type: 'POST', 209 dataType: 'html', 210 cache: false, 211 success: function(data) { 212 if (data.search("Success")) { 213 $(".product-write-review").html('<div class="col-md-12"><div class="alert alert-success">Thank you for submitting your review!</div></div>'); 214 } else { 215 $("#reviewMessage").html(data); 216 } 217 }, 218 error: function(request, textStatus, errorThrown) { 219 alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 220 } 221 }); 222 } 223}); 224 225 226/******************* ADD TO CART ***************/ 227$('div#atcHolder').delegate('a.addToCart,a.addToCartSmall,a.notifyAddToCart', 'click', function(e) { 228 e.preventDefault(); 229 var myID = this.id.replace("addToCart", ""); 230 var myID = myID.replace("notifyMe", ""); 231 var selectedQty = $("input#qty" + myID).val(); 232 233 // LOAD LOGIC 234 if (this.id.length > 0) { 235 if (isNaN(selectedQty) || selectedQty.length === 0) { 236 myForm = "/index.cfm?action=ERROR&height=130&width=355&msg=Please%20Enter%20a%20Numeric%20Quantity"; 237 $.ajax({
238 url: myForm, 239 type: 'get', 240 dataType: 'html', 241 cache: false, 242 success: function(data) { 243 Shadowbox.open({ 244 content: data, 245 player: "html", 246 title: "Add to Cart", 247 height: 330, 248 width: 355 249 }); 250 251 }, 252 error: function(request, textStatus, errorThrown) { 253 //alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 254 } 255 }); 256 } else { 257 var myForm = $("form#productOptions" + myID).serialize(); 258 myForm = "/index.cfm?action=ADDTOCART&height=470&width=470&" + myForm; 259 $.ajax({ 260 url: myForm, 261 type: 'get', 262 dataType: 'html', 263 cache: false, 264 success: function(data) { 265 //Use Drop Down 266 document.getElementById("cartDropDown").click(); 267 $("html, body").animate({ scrollTop: 0 }, "slow"); 268 269 //Cart Pop Up 270 /*var splitText = '<span class="koala">'; 271 var splitMark = data.indexOf(splitText); 272 var dsp = data.slice(0,splitMark); 273 var header = data.slice(splitMark); 274 275 if( document.getElementById("sb-player") ) { 276 document.getElementById("header-count").innerHTML = header; 277 document.getElementById("sb-player").innerHTML = dsp; 278 279 } else { 280 document.getElementById("header-count").innerHTML = header; 281 282 Shadowbox.open({ 283 content: dsp, 284 player: "html", 285 height: 430, 286 width: 500 287 }); 288 }*/ 289 290 }, 291 error: function(request, textStatus, errorThrown) { 292 //alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 293 } 294 }); 295 } 296 } 297 298 return false; 299}); 300 301/******************* ADD TO WISH LIST ***************/ 302$('div#atcHolder').delegate('a.addToWishList, a.addToWishListSmall', 'click', function(e) { 303 e.preventDefault(); 304 var myID = this.id.replace("addToWishList", ""); 305 var myID = myID.replace("notifyMe", ""); 306 var selectedColor = $("#attr1" + myID).val(); 307 var selectedQty = $("input#qty" + myID).val(); 308 309 // LOAD LOGIC 310 if (this.id.length > 1) { 311 if (isNaN(selectedQty) || selectedQty.length === 0) { 312 myForm = "/index.cfm?action=ERROR&height=130&width=355&msg=Please%20Enter%20a%20Numeric%20Quantity"; 313 $.ajax({
314 url: myForm, 315 type: 'get', 316 dataType: 'html', 317 cache: false, 318 success: function(data) { 319 parent.Shadowbox.open({ 320 content: data, 321 player: "html", 322 title: "Add to Wish List", 323 height: 130, 324 width: 450 325 }); 326 327 }, 328 error: function(request, textStatus, errorThrown) { 329 //alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 330 } 331 }); 332 333 } else { 334 335 var myForm = $("form#productOptions" + myID).serialize(); 336 myForm = "/index.cfm?action=ADDTOWISHLIST&height=160&width=355&" + myForm; 337 $.ajax({ 338 url: myForm, 339 type: 'get', 340 dataType: 'html', 341 cache: false, 342 success: function(data) { 343 parent.Shadowbox.open({ 344 content: data, 345 player: "html", 346 title: "Added to Wish List", 347 height: 150, 348 width: 400 349 }); 350 351 }, 352 error: function(request, textStatus, errorThrown) { 353 //alert(request + ' - ' + request.statusText + ' - ' + errorThrown); 354 } 355 }); 356 } 357 } 358 359 return false; 360}); 361 362$(document).ready(function() { 363 /******************* ADD TO REGISTRY VIA INPUT ***************/ 364 $("input.registryQuantity").on("keypress", function(e) { 365 366 if (e.which == 13) { 367 e.preventDefault(); 368 var myID = this.id.replace("qty", ""); 369 var myID = myID.replace("notifyMe", ""); 370 var selectedColor = $("#attr1" + myID).val(); 371 var selectedQty = $("input#qty" + myID).val(); 372 373 if (selectedColor === "-") { 374 tb_show('Error', '/index.cfm?action=ERROR&height=130&width=355&msg=Please%20Choose%20a%20Color', ''); 375 } else if (isNaN(selectedQty) || selectedQty.length === 0) { 376 tb_show('Error', '/index.cfm?action=ERROR&height=130&width=355&msg=Please%20Enter%20a%20Numeric%20Quantity', ''); 377 } else { 378 var myForm = $("form#productOptions" + myID).serialize(); 379 myForm = "/index.cfm?action=ADDTOCART&height=366&width=470&" + myForm; 380 tb_show('Shopping Cart', myForm, ''); 381 } 382 return false; 383 } 384 }); 385 386 /******************* NOTIFY ME WHEN AVAILABLE ***************/ 387 $("input#notifyMeWhenAvailable").on("click", function(e) { 388 389 e.preventDefault(); 390 var myEmailVal = $("input#emailAddress").val(); 391 var myNameVal = $("input#customer_name").val(); 392 myName = checkLength(myNameVal, 'customer_name'); 393 myEmail = checkEmail(myEmailVal, 'emailAddress'); 394 395 if (myEmail == true && myName == true) { 396 var myForm = $("form#notifyMeForm").serialize(); 397 myForm = "/index.cfm?action=NOTIFYME&height=560&width=470&" + myForm; 398 window.location = myForm; 399 } 400 return false; 401 }); 402});
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.