Pay Pal Script

/*!
* paypaljsbuttons
* JavaScript integration for PayPal’s payment buttons
* @version 1.0.3 – 2014-05-20
* @author Jeff Harrell
*/
if(“undefined”==typeof PAYPAL||!PAYPAL)var PAYPAL={};PAYPAL.apps=PAYPAL.apps||{},function(a){“use strict”;function b(){var b,c,d,e;a.getElementById(“paypal-button”)||(b=””,c=a.createElement(“style”),d=”.paypal-button”,e=d+” button”,b+=d+” { white-space: nowrap; }”,b+=d+” .field-error { border: 1px solid #FF0000; }”,b+=d+” .hide { display: none; }”,b+=d+” .error-box { background: #FFFFFF; border: 1px solid #DADADA; border-radius: 5px; padding: 8px; display: inline-block; }”,b+=e+’ { white-space: nowrap; overflow: hidden; border-radius: 13px; font-family: “Arial”, bold, italic; font-weight: bold; font-style: italic; border: 1px solid #ffa823; color: #0E3168; background: #ffa823; position: relative; text-shadow: 0 1px 0 rgba(255,255,255,.5); cursor: pointer; z-index: 0; }’,b+=e+':before { content: ” “; position: absolute; width: 100%; height: 100%; border-radius: 11px; top: 0; left: 0; background: #ffa823; background: -webkit-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%); background: -moz-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%); background: -ms-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%); background: linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%); z-index: -2; }’,b+=e+':after { content: ” “; position: absolute; width: 98%; height: 60%; border-radius: 40px 40px 38px 38px; top: 0; left: 0; background: -webkit-linear-gradient(top, #fefefe 0%, #fed994 100%); background: -moz-linear-gradient(top, #fefefe 0%, #fed994 100%); background: -ms-linear-gradient(top, #fefefe 0%, #fed994 100%); background: linear-gradient(top, #fefefe 0%, #fed994 100%); z-index: -1; -webkit-transform: translateX(1%);-moz-transform: translateX(1%); -ms-transform: translateX(1%); transform: translateX(1%); }’,b+=e+”.small { padding: 3px 15px; font-size: 12px; }”,b+=e+”.large { padding: 4px 19px; font-size: 14px; }”,c.type=”text/css”,c.id=”paypal-button”,c.styleSheet?c.styleSheet.cssText=b:c.appendChild(a.createTextNode(b)),a.getElementsByTagName(“head”)[0].appendChild(c))}function c(b,c){var e,f,g,h,k,l,m,o,p,q,r,s,t,u,v,w=a.createElement(“form”),x=a.createElement(“button”),y=a.createElement(“input”),z=a.createElement(“p”),A=a.createElement(“label”),B=a.createElement(“input”),C=a.createElement(“select”),D=a.createElement(“option”),E=b.items,F=[],G={};w.method=”post”,w.action=j.replace(“{env}”,b.items.env.value),w.className=”paypal-button”,w.target=”_top”;var H=a.createElement(“div”);H.className=”hide”,H.id=”errorBox”,w.appendChild(H),B.type=”text”,B.className=”paypal-input”,z.className=”paypal-group”,A.className=”paypal-label”,C.className=”paypal-select”,y.type=”hidden”,l=E.size&&E.size.value||”large”,m=E.lc&&E.lc.value||”en_US”,o=n[m]||n.en_US,p=o[c],b.items.text&&(p=b.items.text.value,b.remove(“text”));for(k in E)e=E[k],e.hasOptions?F.push(e):e.isEditable?(h=B.cloneNode(!0),h.name=e.key,h.value=e.value,g=A.cloneNode(!0),v=i.config.labels[e.key]||o[e.key]||e.key,g.htmlFor=e.key,g.appendChild(a.createTextNode(v)),g.appendChild(h),f=z.cloneNode(!0),f.appendChild(g),w.appendChild(f)):(h=f=y.cloneNode(!0),h.name=e.key,h.value=e.value,w.appendChild(f));F=d(F);for(k in F)if(e=F[k],F[k].hasOptions){if(G=e.value,G.options.length>1){h=y.cloneNode(!0),h.name=”on”+e.displayOrder,h.value=G.label,q=C.cloneNode(!0),q.name=”os”+e.displayOrder;for(s in G.options)if(t=G.options[s],”string”==typeof t)r=D.cloneNode(!0),r.value=t,r.appendChild(a.createTextNode(t)),q.appendChild(r);else for(u in t)r=D.cloneNode(!0),r.value=u,r.appendChild(a.createTextNode(t[u])),q.appendChild(r);g=A.cloneNode(!0),v=G.label||e.key,g.htmlFor=e.key,g.appendChild(a.createTextNode(v)),g.appendChild(q),g.appendChild(h)}else g=A.cloneNode(!0),v=G.label||e.key,g.htmlFor=e.key,g.appendChild(a.createTextNode(v)),h=y.cloneNode(!0),h.name=”on”+e.displayOrder,h.value=G.label,g.appendChild(h),h=B.cloneNode(!0),h.name=”os”+e.displayOrder,h.value=G.options[0]||””,h.setAttribute(“data-label”,G.label),g.appendChild(h);f=z.cloneNode(!0),f.appendChild(g),w.appendChild(f)}try{x.type=”submit”}catch(I){x.setAttribute(“type”,”submit”)}return x.className=”paypal-button “+l,x.appendChild(a.createTextNode(p)),w.appendChild(x),w}function d(a){return a.sort(function(a,b){return a.displayOrder-b.displayOrder}),a}function e(b,c){var d,e,f=j.replace(“{env}”,b.items.env.value),g=a.createElement(“img”),h=f+”?”,i=13,l=b.items;c=c&&c.value||250;for(e in l)d=l[e],h+=d.key+”=”+encodeURIComponent(d.value)+”&”;return h=encodeURIComponent(h),g.src=k.replace(“{env}”,b.items.env.value).replace(“{url}”,h).replace(“{pattern}”,i).replace(“{size}”,c),g}function f(a){var b,c,d,e,f,h={},i=[];if(b=a.attributes)for(f=0,e=b.length;e>f;f++)c=b[f],(d=c.name.match(/^data-option([0-9])([a-z]+)([0-9])?/i))?i.push({name:”option.”+d[1]+”.”+d[2]+(d[3]?”.”+d[3]:””),value:c.value}):(d=c.name.match(/^data-([a-z0-9_]+)(-editable)?/i))&&(h[d[1]]={value:c.value,isEditable:!!d[2]});return g(i,h),h}function g(a,b){var c,d,e,f,g,h={};for(j=0;js;s++)o=v[s],o&&o.src&&(p=o&&f(o),q=p&&p.button&&p.button.value,r=o.src.split(“?merchant=”)[1],r&&(u.create(r,p,q,o.parentNode),o.parentNode.removeChild(o)))}}(document),”object”==typeof module&&”object”==typeof module.exports&&(module.exports=PAYPAL);