/*! * Shim for MutationObserver interface * Author: Graeme Yeates (github.com/megawac) * Repository: https://github.com/megawac/MutationObserver.js * License: WTFPL V2, 2004 (wtfpl.net). * Though credit and staring the repo will make me feel pretty, you can modify and redistribute as you please. * Attempts to follow spec (http:// www.w3.org/TR/dom/#mutation-observers) as closely as possible for native javascript * See https://github.com/WebKit/webkit/blob/master/Source/WebCore/dom/MutationObserver.cpp for current webkit source c++ implementation */ window.MutationObserver=window.MutationObserver||window.WebKitMutationObserver||function(e){"use strict";function t(e){this._watched=[],this._listener=e}function i(e){!function i(){var r=e.takeRecords();r.length&&e._listener(r,e),e._timeout=setTimeout(i,t._period)}()}function r(t){var i={type:null,target:null,addedNodes:[],removedNodes:[],previousSibling:null,nextSibling:null,attributeName:null,attributeNamespace:null,oldValue:null};for(var r in t)p(i,r)&&t[r]!==e&&(i[r]=t[r]);return i}function n(e,t){var i=s(e,t);return function(r){var n,l=r.length;t.attr&&i.attr&&o(r,e,i.attr,t.afilter),(t.kids||t.descendents)&&(n=a(r,e,i,t)),(n||r.length!==l)&&(i=s(e,t))}}function o(e,t,i,n){for(var o,a,s={},l=t.attributes,u=l.length;u--;)o=l[u],a=o.name,(!n||p(n,a))&&(o.value!==i[a]&&e.push(r({type:"attributes",target:t,attributeName:a,oldValue:i[a],attributeNamespace:o.namespaceURI})),s[a]=!0);for(a in i)s[a]||e.push(r({target:t,type:"attributes",attributeName:a,oldValue:i[a]}))}function a(t,i,n,a){function s(e,i,n,s,l){for(var u,d,f,p=e.length-1,g=-~((p-l)/2);f=e.pop();)u=n[f.i],d=s[f.j],a.kids&&g&&Math.abs(f.i-f.j)>=p&&(t.push(r({type:"childList",target:i,addedNodes:[u],removedNodes:[u],nextSibling:u.nextSibling,previousSibling:u.previousSibling})),g--),a.attr&&d.attr&&o(t,u,d.attr,a.afilter),a.charData&&3===u.nodeType&&u.nodeValue!==d.charData&&t.push(r({type:"characterData",target:u})),a.descendents&&c(u,d)}function c(i,n){for(var p,g,h,m,C,v,y,k=i.childNodes,E=n.kids,P=k.length,_=E?E.length:0,b=0,F=0,x=0;P>F||_>x;)v=k[F],C=E[x],y=C&&C.node,v===y?(a.attr&&C.attr&&o(t,v,C.attr,a.afilter),a.charData&&C.charData!==e&&v.nodeValue!==C.charData&&t.push(r({type:"characterData",target:v})),g&&s(g,i,k,E,b),a.descendents&&(v.childNodes.length||C.kids&&C.kids.length)&&c(v,C),F++,x++):(d=!0,p||(p={},g=[]),v&&(p[h=u(v)]||(p[h]=!0,-1===(m=l(E,v,x))?a.kids&&(t.push(r({type:"childList",target:i,addedNodes:[v],nextSibling:v.nextSibling,previousSibling:v.previousSibling})),b++):g.push({i:F,j:m})),F++),y&&y!==k[F]&&(p[h=u(y)]||(p[h]=!0,-1===(m=f(k,y,F))?a.kids&&(t.push(r({type:"childList",target:n.node,removedNodes:[y],nextSibling:E[x+1],previousSibling:E[x-1]})),b--):g.push({i:m,j:x})),x++));g&&s(g,i,k,E,b)}var d;return c(i,n),d}function s(e,t){var i=!0;return function r(e){var n={node:e};return!t.charData||3!==e.nodeType&&8!==e.nodeType?(t.attr&&i&&1===e.nodeType&&(n.attr=d(e.attributes,function(e,i){return(!t.afilter||t.afilter[i.name])&&(e[i.name]=i.value),e},{})),i&&(t.kids||t.charData||t.attr&&t.descendents)&&(n.kids=c(e.childNodes,r)),i=t.descendents):n.charData=e.nodeValue,n}(e)}function l(e,t,i){return f(e,t,i,g("node"))}function u(e){try{return e.id||(e[m]=e[m]||h++)}catch(t){try{return e.nodeValue}catch(i){return h++}}}function c(e,t){for(var i=[],r=0;ri;i++)e[i]=decodeURIComponent(e[i]);return e},e}();e.DocCookieUtility=t}(t=e.doc_cookies||(e.doc_cookies={}))}(e||(e={}));var e,t=this&&this.__extends||function(e,t){function i(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)};!function(e){var i;!function(e){var i=function(e){function i(t){e.call(this),this.cookieDomain=t}return t(i,e),i.prototype.setCookie=function(e,t){return this.setItem(e,t,1/0,"/",this.cookieDomain),this.getItem(e)},i.prototype.removeCookie=function(e){var t=this.getItem(e);return t?(this.removeItem(e,"/",this.cookieDomain),t):""},i}(e.DocCookieUtility);e.CaptoraDocCookieUtility=i}(i=e.doc_cookies||(e.doc_cookies={}))}(e||(e={}));var e;!function(e){var t=function(){function e(){}return e.COOKIE_NAMES={attribUrlCookieName:"colodin_attrib_url",attributableFlagCookieName:"colodin_attributable",oldCookieName:"_EXT_TRACKER_COOKIE_",origReferrerCookieName:"colodin_orig_referrer",thankYouPageReferrer:"colodin_thank_you_page_referrer",thankYouPageUrl:"colodin_thank_you_page_url",uuidCookieName:"colodin_id"},e.HIDDEN_FIELD_NAMES={attribUrl:"cpcampaign",attributable:"cpfirstentry",origReferrer:"cpreferrer"},e.PIXEL_SRC="pixel.captora.com/img/pix.gif",e.PIXEL_CALLS=["capture_card_id","capture_card_cta_id","cta_title","config_id","segment_id"],e}();e.PixelConstants=t}(e||(e={}));var e;!function(e){var t;!function(e){var t=function(){function t(e){this.pagegroups=[],this.thankYouPagePatterns=[],"undefined"!=typeof e&&("undefined"!=typeof e.domain&&this.setDomain(e.domain),"undefined"!=typeof e.fieldFilterConfig&&this.setFieldFilterConfig(e.fieldFilterConfig),"undefined"!=typeof e.formFieldMappings&&this.setFormFieldMappings(e.formFieldMappings),"undefined"!=typeof e.pagegroups&&this.setPagegroups(e.pagegroups),"undefined"!=typeof e.thankYouPagePatterns&&this.setThankYouPagePatterns(e.thankYouPagePatterns),"undefined"!=typeof e.uuid&&this.setUuid(e.uuid))}return t.prototype.setDomain=function(e){return this.domain=e,this},t.prototype.setFieldFilterConfig=function(e){return this.fieldFilterConfig=e,this},t.prototype.setFormFieldMappings=function(e){return this.formFieldMappings=e,this},t.prototype.setPagegroups=function(e){return this.pagegroups=e,this},t.prototype.setThankYouPagePatterns=function(e){return this.thankYouPagePatterns=e,this},t.prototype.setUuid=function(e){return this.uuid=e,this},t.prototype.getDomain=function(){return this.domain},t.prototype.getFieldFilterConfig=function(){return this.fieldFilterConfig},t.prototype.getFormFieldMappings=function(){return this.formFieldMappings},t.prototype.getPagegroups=function(){return this.pagegroups},t.prototype.getThankYouPagePatterns=function(){return this.thankYouPagePatterns},t.prototype.getUuid=function(){return this.uuid},t.prototype.build=function(){return new e.PixelConfig(this)},t}();e.PixelConfigBuilder=t}(t=e.pixel_config||(e.pixel_config={}))}(e||(e={}));var e;!function(e){var t;!function(e){var t=function(){function e(e){this.domain=e.getDomain(),this.fieldFilterConfig=e.getFieldFilterConfig(),this.formFieldMappings=e.getFormFieldMappings(),this.pagegroups=e.getPagegroups(),this.thankYouPagePatterns=e.getThankYouPagePatterns(),this.uuid=e.getUuid()}return e.prototype.getDomain=function(){return this.domain},e.prototype.getFieldFilterConfig=function(){return this.fieldFilterConfig},e.prototype.getFormFieldMappings=function(){return this.formFieldMappings},e.prototype.getPagegroups=function(){return this.pagegroups},e.prototype.getThankYouPagePatterns=function(){return this.thankYouPagePatterns},e.prototype.getUuid=function(){return this.uuid},e}();e.PixelConfig=t}(t=e.pixel_config||(e.pixel_config={}))}(e||(e={}));var e;!function(e){var t;!function(e){var t=function(){function t(){}return t.newElement=function(t,i){return new e.ElementApi(t,i)},t}();e.ElementApiFactory=t}(t=e.element_api||(e.element_api={}))}(e||(e={}));var e;!function(e){var t;!function(e){var t=function(){function t(e,t){this.element=e,this.trackerClient=t}return t.prototype.getAttributes=function(){for(var e={},t=0;t-1&&t.length<=1)return!0;for(var n=0;n-1&&t.length<=1)return!0}return!1},t.prototype.addEventListenerPolyfill=function(e){if(e)for(var t=e.split(","),i=0;i-1)return!0;return!1},e.handleOldCookie=function(e,i){var r=i.split("__SEP__");e.setCookie(t.COOKIE_NAMES.uuidCookieName,r[0].split("=")[1]);var n=r[1].substr(r[1].indexOf("=")+1,r[1].length-1).split(",");n[0]&&e.setCookie(t.COOKIE_NAMES.origReferrerCookieName,n[0]),"Captora"===n[1]&&e.setCookie(t.COOKIE_NAMES.attributableFlagCookieName,String(!0)),n[2]&&e.setCookie(t.COOKIE_NAMES.attribUrlCookieName,n[2]),e.removeCookie(t.COOKIE_NAMES.oldCookieName)},e.getTrackingElements=function(){return e.HTMLCollectionToArray(document.querySelectorAll("input")).concat(e.HTMLCollectionToArray(document.querySelectorAll("select"))).concat(e.HTMLCollectionToArray(document.querySelectorAll("textarea"))).concat(e.HTMLCollectionToArray(document.querySelectorAll(".cp_element a"))).concat(e.HTMLCollectionToArray(document.querySelectorAll(".cp_element img")))},e.findHiddenFieldNameKey=function(e){var i="__c"===e.substr(-3)?e.substring(0,e.length-3):e;if("cpreferer"===i)return"origReferrer";for(var r in t.HIDDEN_FIELD_NAMES)if(t.HIDDEN_FIELD_NAMES.hasOwnProperty(r)&&i===t.HIDDEN_FIELD_NAMES[r])return r;return null},e.HTMLCollectionToArray=function(e){for(var t=[],i=e.length,r=0;i>r;r++)t.push(e[r]);return t},e.getMergedObject=function(e,t){var i={};for(var r in e)e.hasOwnProperty(r)&&(i[r]=e[r]);for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);return i},e.extractRootDomain=function(e){var t=e.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i)[1],i=-2;return t.indexOf(".co.uk")>-1&&(i=-3),t.split(".").slice(i).join(".")},e.getJSONFile=function(e,t){var i;window.XDomainRequest&&"function"==typeof window.XDomainRequest?(i=new window.XDomainRequest,i.onload=function(){var e=JSON.parse(i.responseText);t&&t(e)},i.open("GET",e,!0),i.send()):(i=new XMLHttpRequest,i.onreadystatechange=function(){if(4===i.readyState&&200===i.status){var e=JSON.parse(i.responseText);t&&t(e)}},i.open("GET",e),i.send())},e}();e.TrackerUtility=i}(e||(e={}));var e;!function(e){var t;!function(t){var i=e.element_api.ElementApiFactory,r=function(){function t(t){var i=this;this.eventDelegateHandler=function(t){t=t||window.event;var r=t.target,n=t.currentTarget,o={};if(t&&t.type)switch(r.tagName){case"INPUT":case"SELECT":case"TEXTAREA":if("ALL"===i.pixelConfig.getFieldFilterConfig().filterMode||"password"===r.type)return;if(n.type&&"password"===n.type.toLowerCase())return;if("focus"===t.type||"blur"===t.type||"change"===t.type)if(r.form)for(var a=e.TrackerUtility.HTMLCollectionToArray(r.form.getElementsByTagName("INPUT")).concat(e.TrackerUtility.HTMLCollectionToArray(r.form.getElementsByTagName("SELECT"))).concat(e.TrackerUtility.HTMLCollectionToArray(r.form.getElementsByTagName("TEXTAREA"))),s=0;sn;n++){var o=i[n].name.replace("data-",""),a=i[n].value;if(e.PixelConstants.PIXEL_CALLS.indexOf(o)>-1){var s={};s["GOAL_"+o]=a,this.firePixel(s)}}},t.prototype.firePixel=function(t,i){void 0===i&&(i=!1);var r=t?e.TrackerUtility.getMergedObject(this.defaultPixelParams,t):this.defaultPixelParams;r.rand=Math.random();var n="";for(var o in r)r.hasOwnProperty(o)&&(n+=o+"="+encodeURIComponent(r[o])+"&");n+="timestamp="+(new Date).getTime();var a=document.location.protocol+"//"+e.PixelConstants.PIXEL_SRC+"?"+n,s=new Image;if(a.length>8500&&(a=a.substr(0,8500)),s.src=a,i===!0)for(var l=new Date,u=l.getTime()+500;l.getTime()<=u;)l=new Date},t.prototype.mutationObserverCallback=function(t){for(var r=0;r1){var o=t.elements[i.name][0];return void(o!==i&&(o.parentNode.removeChild(o),i.value=this.progressiveProfile[r]))}}for(var a in e.PixelConstants.HIDDEN_FIELD_NAMES)e.PixelConstants.HIDDEN_FIELD_NAMES.hasOwnProperty(a)&&this.progressiveProfile.hasOwnProperty(a)&&(e.TrackerFormUtility.updateOrInjectHiddenField(t,t.elements[e.PixelConstants.HIDDEN_FIELD_NAMES[a]],e.PixelConstants.HIDDEN_FIELD_NAMES[a],this.progressiveProfile[a]),e.TrackerFormUtility.updateOrInjectHiddenField(t,t.elements[e.PixelConstants.HIDDEN_FIELD_NAMES[a]+"__c"],e.PixelConstants.HIDDEN_FIELD_NAMES[a]+"__c",this.progressiveProfile[a]),"origReferrer"===a&&(e.TrackerFormUtility.updateOrInjectHiddenField(t,t.elements.cpreferer,"cpreferer",this.progressiveProfile.origReferrer),e.TrackerFormUtility.updateOrInjectHiddenField(t,t.elements.cpreferer__c,"cpreferer__c",this.progressiveProfile.origReferrer)))}},t.prototype.addSubmitEventListener=function(e){i.newElement(e,this).addEventListenerPolyfill("submit")},t.prototype.handleRuntimeFormInjection=function(t){var r=e.TrackerUtility.getTrackingElements();this.addHiddenFieldsToForm(t),this.addSubmitEventListener(t);for(var n=0;n-1&&""!==e[t].trim()){this.defaultPixelParams.url=this.progressiveProfile.stateUrl,this.defaultPixelParams.referrer=this.progressiveProfile.stateReferrer,this.firePixel({GOAL_TRACKURL:this.progressiveProfile.attribUrl});break}},t}();t.TrackerClient=r}(t=e.tracker_client||(e.tracker_client={}))}(e||(e={}));/*! * @copyright Captora, Inc. 2015. * Any modifications to this code will not be supported by Captora and its APIs. */ var i;!function(t){var i=e.tracker_client.TrackerClient,r=e.TrackerUtility,n=e.element_api.ElementApiFactory,o=e.pixel_config.PixelConfigBuilder,a=null,s=[],l=[],u=null;if("undefined"==typeof window.fireColodinPixel){window.docReady(function(){var e=document.getElementsByTagName("BODY")[0];u=new MutationObserver(function(e){l.push(e)}),u.observe(e,{childList:!0,subtree:!0})}),window.fireColodinPixel=function(e){s.push(e)};var c="function"==typeof window.cpTrackingClientConfig?window.cpTrackingClientConfig:null;window.cpTrackingClientConfig=function(e){for(a=new i(new o(e).build());s.length;)a.firePixel.call(a,s.shift());window.fireColodinPixel=function(e){a.firePixel.call(a,e)};var t=function(){for(var e=document.getElementsByTagName("BODY")[0],t=r.getTrackingElements(),i=0;i