1ACC.stocknotifyme = { 2 3 _autoload: [ 4 "stockNotifyMeButton" 5 ], 6 7 stockNotifyMeButton: function(){ 8 $(".js-stocknotify-cta").on("click", function(ev){ 9 ev.preventDefault(); 10 11 var title = $('#notifyMetitle').html(), 12 content = $(this).siblings(".js-stocknotify-content").html(); 13 14 ACC.colorbox.open(title, { 15 html: content, 16 width: "477px", 17 onComplete: function() { 18 ACC.stocknotifyme.bindSubmitNotifyMe(); 19 ACC.stocknotifyme.bindCancelButton(); 20 } 21 }); 22 }); 23 }, 24 25 bindSubmitNotifyMe: function(){ 26 $(".js-stocknotify-form").on("submit", function(ev){ 27 ev.preventDefault(); 28 var self = $(this), 29 url = self.attr("action"), 30 productCode = self.find("input[name=productCode]").val(), 31 emailField = self.find("input[name=notifyMeEmail]"), 32 emailAddress = emailField.val(); 33 emailAddress = emailAddress.trim().toLowerCase(); 34 35 if( emailAddress == '' || !isEmailValid(emailAddress) ) { 36 self.addClass("has-error"); 37 self.find(".help-block").removeClass("hidden"); 38 self.find(".btn").blur(); 39 ACC.colorbox.resize(); 40 return false; 41 } 42 43 $.ajax({ 44 type: "POST", 45 url: url, 46 data: { 47 productCode: productCode, 48 emailAddress: emailAddress 49 }, 50 success: function(result) { 51 ACC.stocknotifyme.displayConfirmation(); 52 ACC.stocknotifyme.notifyMeEvent(); 53 }, 54 error: function(result) { 55 console.log('error in notifyMe ' + result); 56 } 57 }); 58 }); 59 }, 60 61 bindCancelButton: function(){ 62 $(".js-close-overlay-cta").on("click", function(ev){ 63 ev.preventDefault(); 64 ACC.colorbox.close(); 65 }); 66 }, 67 68 displayConfirmation: function(){ 69 var title = $('#notifyMetitle').html(), 70 content = $(".js-stocknotify-confirmation").html(); 71 72 ACC.colorbox.open(title, { 73 html: content, 74 width: "477px", 75 onComplete: function() { 76 ACC.stocknotifyme.bindCancelButton(); 77 } 78 }); 79 }, 80 81 notifyMeEvent: function(){ 82 var productID = $(".js-stocknotify-form").find("input[name=productCode]").val() 83 var productName = $(".js-stocknotify-form").find("input[name=productName]").val() 84 85 window.dataLayer = window.dataLayer || []; 86 dataLayer.push( 87 { 88 "event": "notifyMe", 89 "productName": productName, 90 "productID": productID, 91 }); 92 } 93};
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.