"),r.close()),!r)throw Error("base not supported");var a=r.createElement("base");a.href=n,r.getElementsByTagName("head")[0].appendChild(a);var i=r.createElement("a");return i.href=t,i.href}finally{e&&e.parentNode.removeChild(e)}}());var l=i(t||""),f=function(){if(!("defineProperties"in Object))return!1;try{var e={};return Object.defineProperties(e,{prop:{get:function(){return!0}}}),e.prop}catch(t){return!1}}(),h=f?this:document.createElement("a"),m=new o(l.search?l.search.substring(1):null);return m._url_object=h,Object.defineProperties(h,{href:{get:function(){return l.href},set:function(e){l.href=e,r(),u()},enumerable:!0,configurable:!0},origin:{get:function(){return"origin"in l?l.origin:this.protocol+"//"+this.host},enumerable:!0,configurable:!0},protocol:{get:function(){return l.protocol},set:function(e){l.protocol=e},enumerable:!0,configurable:!0},username:{get:function(){return l.username},set:function(e){l.username=e},enumerable:!0,configurable:!0},password:{get:function(){return l.password},set:function(e){l.password=e},enumerable:!0,configurable:!0},host:{get:function(){var e={"http:":/:80$/,"https:":/:443$/,"ftp:":/:21$/}[l.protocol];return e?l.host.replace(e,""):l.host},set:function(e){l.host=e},enumerable:!0,configurable:!0},hostname:{get:function(){return l.hostname},set:function(e){l.hostname=e},enumerable:!0,configurable:!0},port:{get:function(){return l.port},set:function(e){l.port=e},enumerable:!0,configurable:!0},pathname:{get:function(){return"/"!==l.pathname.charAt(0)?"/"+l.pathname:l.pathname},set:function(e){l.pathname=e},enumerable:!0,configurable:!0},search:{get:function(){return l.search},set:function(e){l.search!==e&&(l.search=e,r(),u())},enumerable:!0,configurable:!0},searchParams:{get:function(){return m},enumerable:!0,configurable:!0},hash:{get:function(){return l.hash},set:function(e){l.hash=e,r()},enumerable:!0,configurable:!0},toString:{value:function(){return l.toString()},enumerable:!1,configurable:!0},valueOf:{value:function(){return l.valueOf()},enumerable:!1,configurable:!0}}),h}var c,s=e.URL;try{if(s){if("searchParams"in(c=new e.URL("https://example.com"))){var f=new l("http://example.com");if(f.search="a=1&b=2","http://example.com/?a=1&b=2"===f.href&&(f.search="","http://example.com/"===f.href))return}"href"in c||(c=undefined),c=undefined}}catch(m){}if(Object.defineProperties(o.prototype,{append:{value:function(e,t){this._list.push({name:e,value:t}),this._update_steps()},writable:!0,enumerable:!0,configurable:!0},"delete":{value:function(e){for(var t=0;t1?arguments[1]:undefined;this._list.forEach(function(n){e.call(t,n.value,n.name)})},writable:!0,enumerable:!0,configurable:!0},toString:{value:function(){return r(this._list)},writable:!0,enumerable:!1,configurable:!0}}),"Symbol"in e&&"iterator"in e.Symbol&&(Object.defineProperty(o.prototype,e.Symbol.iterator,{value:o.prototype.entries,writable:!0,enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,e.Symbol.iterator,{value:function(){return this},writable:!0,enumerable:!0,configurable:!0})),s)for(var h in s)Object.prototype.hasOwnProperty.call(s,h)&&"function"==typeof s[h]&&(l[h]=s[h]);e.URL=l,e.URLSearchParams=o}(),function(){if("1"!==new e.URLSearchParams([["a",1]]).get("a")||"1"!==new e.URLSearchParams({a:1}).get("a")){var r=e.URLSearchParams;e.URLSearchParams=function(e){if(e&&"object"==typeof e&&t(e)){var a=new r;return n(e).forEach(function(e){if(!t(e))throw TypeError();var r=n(e);if(2!==r.length)throw TypeError();a.append(r[0],r[1])}),a}return e&&"object"==typeof e?(a=new r,Object.keys(e).forEach(function(t){a.set(t,e[t])}),a):new r(e)}}}()}(self);}})('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {}); } function changeUrl(nameIframe) { var item = document.querySelector(nameIframe); var url = '' if (item && !item.getAttribute('data-updated')) { url = item.src; url = transformURL(url); item.src = url; item.setAttribute('data-updated', true) } function transformURL(url) { var data_utm = new Object(); var procd = (localStorage.data_prod == undefined) ? "null" : localStorage.data_prod; if (localStorage.data_utm) { data_utm = JSON.parse(localStorage.data_utm); } else { data_utm.source = ""; data_utm.medium = ""; data_utm.campaign = ""; } var lang; var urlMain = document.location.href; var arrLang = urlMain.split("/"); var indexLang = arrLang.indexOf('en'); lang = (indexLang == -1) ? 'es' : 'en'; url = url + '&lang=' + lang + '&procedencia=' + procd + '&utm_source=' + data_utm.source + '&utm_medium=' + data_utm.medium + '&utm_campaign=' + data_utm.campaign; return url; } } function init() { var options = { subtree: true, addedNodes: true, childList: true }; var observer = new MutationObserver(function (mutations) { if (mutations.reduce(function (acc, mutation){ return !![...mutation.addedNodes].filter(function (node) {return node.classList[0] === 'codegena_iframe'} ).length || acc }, false)) { //console.log('FOUND', mutations[0].addedNodes[0].getElementsByTagName("iframe")[0].name) for (var m = 0; m < mutations.length; m++) { var iframe = mutations[m].addedNodes[0].getElementsByTagName("iframe")[0]; if (typeof iframe !== 'undefined') { var nameIframe = iframe.name; changeUrl('iframe[name="' + nameIframe + '"]'); } } } }); var namesForms = ["Formulario SFMC Newsletter", "Formulario SFMC Contacto", "Formulario SFMC Promocion", "Formulario SFMC Granada", "Formulario SFMC Offsite", "Formulario SFMC Multi Promocion"]; for (var n = 0; n < namesForms.length; n++) { var namePreIframe = '.codegena_iframe[data-name="' + namesForms[n] + '"]'; if (document.querySelector(namePreIframe)) { var target = document.querySelector(namePreIframe).parentNode; observer.observe(target, options); } var nameIframe = 'iframe[name="' + namesForms[n] + '"]'; if (document.querySelector(nameIframe)) { changeUrl(nameIframe); } } } jQuery(window).on("load", function(e) { var procd = document.referrer ? document.referrer : null; var url = new URL(document.location.href); var data_utm = localStorage["data_utm"]; var data_prod = localStorage.data_prod; if (data_utm == undefined) { data_utm = '{"source":null,"campaign":null,"medium":null}'; } var data_utm_Parsed = JSON.parse(data_utm); if ( procd && procd.indexOf("aedashomes.com") == -1 && procd.indexOf("prepro.aedashomes.com") == -1 ) { var utm_source = url.searchParams.get("utm_source"); var utm_campaign = url.searchParams.get("utm_campaign"); var utm_medium = url.searchParams.get("utm_medium"); if (utm_source && utm_campaign && utm_medium) { if ( data_utm_Parsed.source != utm_source || data_utm_Parsed.campaign != utm_campaign || data_utm_Parsed.medium != utm_medium ) { data_utm_Parsed.source = utm_source; data_utm_Parsed.campaign = utm_campaign; data_utm_Parsed.medium = utm_medium; localStorage.setItem("data_utm", JSON.stringify(data_utm_Parsed)); localStorage.setItem("data_prod", procd); } } else { data_utm_Parsed.source = null; data_utm_Parsed.campaign = null; data_utm_Parsed.medium = null; localStorage.setItem("data_utm", JSON.stringify(data_utm_Parsed)); localStorage.setItem("data_prod", procd); } } else if ( procd && (procd.indexOf("aedashomes.com") > 0 || procd.indexOf("prepro.aedashomes.com") > 0) ) { } else { var utm_source = url.searchParams.get("utm_source"); var utm_campaign = url.searchParams.get("utm_campaign"); var utm_medium = url.searchParams.get("utm_medium"); if (utm_source && utm_campaign && utm_medium) { data_utm_Parsed.source = utm_source; data_utm_Parsed.campaign = utm_campaign; data_utm_Parsed.medium = utm_medium; localStorage.setItem("data_utm", JSON.stringify(data_utm_Parsed)); } else { data_utm_Parsed.source = null; data_utm_Parsed.campaign = null; data_utm_Parsed.medium = null; localStorage.setItem("data_utm", JSON.stringify(data_utm_Parsed)); } if (data_prod && procd) { procd = data_prod; } localStorage.setItem("data_prod", procd); } init(); }); Menú