1var ErrorBar = { 2 messages: [], 3 'launch' : function(message, cl) { 4 const exists = cl ? this.messages.some(m => m.m === message && m.c === cl) : this.messages.some(m => m.m === message); 5 if (!exists){ 6 this.messages.push({m:message,c:cl}); 7 } 8 this.update(); 9 }, 10 clearMessage: function(index) { 11 this.messages.splice(index,1); 12 }, 13 clear: function(cl) { 14 var classes = '.js-flasher-close'; 15 if (cl) classes = classes +'.'+cl; 16 jQuery(classes).click(); 17 }, 18 update: function() { 19 if (!this.messages.length) { 20 jQuery('.js-error-bar').hide(); 21 jQuery('.iframe-error-bar').hide(); 22 return; 23 } 24 var output = '<ul>'+this.messages.map(function(m,i) { 25 return '<li role="alert" data-index="' + i + '">' + m.m + '<button href="#" class="btn-clear js-flasher-close flasher-close '+ m.c +'"><span class="sr-only tslug-dismiss"></span></button></li>'; 26 }).join('') + '</ul>'; 27 var flasher = jQuery('.js-error-bar'); 28 if (!flasher.length) { 29 jQuery('body').prepend('<div class="flash-zone js-error-bar"></div>'); 30 flasher = jQuery('.flash-zone.js-error-bar'); 31 } 32 var errorZone = flasher.find('.error'); 33 if (!errorZone.length) { 34 flasher.html('<div class="flasher"><div class="error"></div></div>'); 35 } 36 flasher.find('.error').html(output); 37 38 //Check if this checkout is an iFrame 39 if(window.location != window.parent.location){ 40 //add error message below Checkout button 41 jQuery('.iframe-error-bar').html(output); 42 } 43 44 45 46 var tslugDismiss = jQuery('.tslug-dismiss'); 47 tslugDismiss.text(TSLUG_DISMISS); 48 flasher.hide(); 49 flasher.delay(400).slideDown(); 50 jQuery('.js-error-bar .js-flasher-close').each(function(){ 51 jQuery(this).click(function(e){ 52 jQuery(this).parents('li').fadeOut(200, function(){ 53 ErrorBar.clearMessage(jQuery(this).attr('data-index')); 54 if (!flasher.find('li:visible').length) { 55 flasher.hide(); 56 } 57 }); 58 e.preventDefault(); 59 }); 60 }); 61 } 62};
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.