1var CN = CN || {}; 2 3CN.TransferTool = function(el) { 4 this.elements = { 5 base: el, 6 body: $('body'), 7 toggleButton: el.find('.js-transfer-tool-toggle'), 8 ctaButton: el.find('.js-transfer-tool-button') 9 }; 10 11 this.options = el.data('module-options'); 12 13 this.bindEvents(); 14 15 this.trackInitialShow(); 16}; 17 18CN.TransferTool.prototype.bindEvents = function () { 19 this.elements.toggleButton.on('click', this.toggleState.bind(this)); 20 this.elements.ctaButton.on('click', this.trackCtaClick.bind(this)); 21}; 22 23CN.TransferTool.prototype.toggleState = function (e) { 24 e.preventDefault(); 25 26 if (this.elements.base.hasClass('is-active')) { 27 this.triggerEvent('close'); 28 } else { 29 this.triggerEvent('open'); 30 } 31 32 this.elements.base.toggleClass('is-active'); 33}; 34 35CN.TransferTool.prototype.trackInitialShow = function () { 36 if (document.documentElement.clientWidth >= this.options.breakpoint) { 37 this.triggerEvent('show'); 38 } 39}; 40 41CN.TransferTool.prototype.trackCtaClick = function () { 42 this.triggerEvent('click'); 43}; 44 45CN.TransferTool.prototype.triggerEvent = function (type) { 46 if ('ga' in window && typeof ga.getAll === 'function') { 47 var label = this.options.label; 48 49 $.each(ga.getAll(), function(index, tracker) { 50 tracker.send('event', 'transfer_tool', type, label, { 51 nonInteraction: true 52 }); 53 }); 54 } 55}; 56 57$('[data-module="transfer-tool"]').each(function () { 58 new CN.TransferTool($(this)); 59});
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.