Skip to content

Instantly share code, notes, and snippets.

@deltagolf
Created March 20, 2016 09:54
Show Gist options
  • Save deltagolf/6a8e00db1ca7b32d251e to your computer and use it in GitHub Desktop.
Save deltagolf/6a8e00db1ca7b32d251e to your computer and use it in GitHub Desktop.
Form2 min
var redirectDomain="https://script.google.com/macros/s/AKfycbzICEw1n1BrsBsCgPMDL1VQ7bS9ka7O49s1pS4zkTLbM4g_CRNr/exec",responseCodes=["1F4","3F8","5DC","7D0","9C4","BB8","6D6","FA0","DAC"],BODY_TEXT=['<p>¡Gracias por actualizar tus datos! Te acabamos de enviar un email con los datos que nos has facilitado y un enlace para que los valides. Por último, si lo deseas y aún no lo has hecho, <strong>ahora puedes hacer una nueva aportación al proyecto.</strong></p><br><p><strong>IMPORTANTE: Si decides completar tu aportación se te asignará el nuevo obsequio que reemplazará al que tuvieras previamente asignado. Por ejemplo, si tu obsequio era el libro de P. Gray y decides completar con €10, tu nuevo obsequio sería "Los náufragos de Tonga". Para tener los dos tendrías que completar con €25.</strong></p>',"Se ha producido un error en la transacción. Pronto nos pondremos en contacto contigo."],CONTRIBUTION_DATA='<p>Estos son los datos que constan en nuestros registros sobre tu aportación:</p><br><p>Correo electrónico: <strong><span class = "perkEmailShow"></span></strong></p><p>Número de referencia: <strong><span class = "perkLocalizerShow"></span></strong></p><p>El día <span class = "perkDate"></span> a las <span class = "perkTime"></span> realizaste una donación de €<strong><span class = "perkAmountShow"></span></strong> para la producción de un documental sobre educación. Elegiste como obsequio "<strong><span class = "perkTitleShow"></span></strong>". <strong><span class = "perkDesigShow"></span></strong> La fecha estimada de entrega es: <strong><span class = "perkDeliveryShow"></span></strong>.</p>',UPDATED_DATA='<p>Estos son los datos que nos has facilitado:<p><br><p>Nombre: <strong><span class = "perkFirstNameShow"></span></strong></p><p>Apellidos: <strong><span class = "perkLastNameShow"></span></strong></p><p>DNI: <strong><span class = "perkIdShow"></span></strong></p><p>Email: <strong><span class = "perkEmailShow"></span></strong></p><p>Cómo figurarás en los créditos: <strong><span class = "perkCreditsShow"></span></strong></p><p>Dirección postal de envío: <strong><span class = "perkAddressShow"></span></strong></p><p>Ciudad: <strong><span class = "perkCityShow"></span></strong></p><p>Código postal: <strong><span class = "perkZipShow"></span></strong></p><p>Provincia: <strong><span class = "perkProvinceShow"></span></strong></p>',WARNING="<p>¡Todavía no has validado los datos que nos has facilitado! Por favor <strong>haz click en el enlace que te acabamos de enviar por email</strong> para que podamos hacerte entrega de tu obsequio. ¡Gracias!</p>",PERKS='<p>Diego, <strong>¿te gustaría implicarte aun más en este proyecto?</strong> Ahora tienes la posibilidad de hacerlo. Al elegir colaborar con alguna de estas aportaciones que hemos personalizado para ti, nos ayudarás a mejorar aún más el documental "Corriendo por las olas". Gracias de antemano.</p>',query=window.updateCustomerDataQuery+"&email="+window.eneueSupporterEmail+"&localizer="+window.eneueTransactionLocalizer+"&register="+window.eneueTransactionRegistry+"&valid="+window.eneueValidated;query=query.replace(/\+/g," ");var eQuery=window.btoa(unescape(encodeURIComponent(query))),Query={e:eQuery},request=$.ajax({type:"get",url:redirectDomain,jsonpCallback:"updateCustomerAdvanced",contentType:"application/json",dataType:"jsonp",data:Query});$(".perkWait").show(),request.done(function(e){switch($(".perkWait").hide(),e.responsecode){case responseCodes[3]:var o="eneuePerks",a=e.perksJSON;a=JSON.parse(a),$(o).html("<br>"),generatePerks(a,o);var n=BODY_TEXT[0],s=UPDATED_DATA,r=CONTRIBUTION_DATA;window.eneueSupporterEmail=e.email,window.eneueTransactionLocalizer=e.localizer,window.eneueTransactionRegistry=e.registry,window.eneueQuantity=e.quantity,window.eneueDelivery=e.delivery,window.eneueDesig=e.desig,window.eneuePerkID=e.perkID,window.eneueTitle=e.title,window.eneueTimeStamp=e.timestamp,window.eneueValidated=e.valid,window.eneueFName=e.fname,window.eneueLName=e.lname,window.eneueId=e.id,window.eneueCredits=e.creditsPerks,window.eneueAddress=e.address,window.eneueCity=e.cityPerk,window.eneueZip=e.zipPerk,window.eneueProvince=e.provincePerk;var t=new Date(e.timestamp),i=t.getDate(),p=t.getMonth()+1,d=t.getFullYear(),l=(t.getHours()<10?"0":"")+t.getHours(),u=(t.getMinutes()<10?"0":"")+t.getMinutes();window.eneueDateStampFormatted=i+"/"+p+"/"+d,window.eneueTimeStampFormatted=l+":"+u,$(".eneueBodyText").html(n),$(".eneueUpdatedData").html(s),$(".eneueContributionData").html(r),$(".perkEmailShow").html(window.eneueSupporterEmail),$(".perkLocalizerShow").html(window.eneueTransactionLocalizer),$(".perkDate").html(window.eneueDateStampFormatted),$(".perkTime").html(window.eneueTimeStampFormatted),$(".perkAmountShow").html(window.eneueQuantity),$(".perkTitleShow").html(window.eneueTitle),$(".perkDesigShow").html(window.eneueDesig),$(".perkDeliveryShow").html(window.eneueDelivery),$(".perkFirstNameShow").html(window.eneueFName),$(".perkLastNameShow").html(window.eneueLName),$(".perkIdShow").html(window.eneueId),$(".perkCreditsShow").html(window.eneueCredits),$(".perkAddressShow").html(window.eneueAddress),$(".perkCityShow").html(window.eneueCity),$(".perkZipShow").html(window.eneueZip),$(".perkProvinceShow").html(window.eneueProvince),$(".eneueUpdatedData").show(),$(".eneuePerks").show();break;case responseCodes[7]:break;case responseCodes[8]:var w="<p>El servidor está ocupado en estos momentos. Vuelve a intentarlo pasados unos minutos</p>";$(".eneueBodyText").html(w),$(".eneueBodyText").show()}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment