-
Notifications
You must be signed in to change notification settings - Fork 22
/
paypal-button.min.js
7 lines (7 loc) · 9.43 KB
/
paypal-button.min.js
1
2
3
4
5
6
7
/*!
* PayPalJSButtons
* JavaScript integration for PayPal's payment buttons
* @version 1.0.1 - 2013-06-05
* @author Jeff Harrell <https://github.com/jeffharrell/>
*/
if("undefined"==typeof PAYPAL||!PAYPAL)var PAYPAL={};PAYPAL.apps=PAYPAL.apps||{},function(){"use strict";function a(){var a,b,c,d;document.getElementById("paypal-button")||(a="",b=document.createElement("style"),c=".paypal-button",d=c+" button",a+=c+" { white-space: nowrap; }",a+=d+' { 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; }',a+=d+':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; }',a+=d+':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%); }',a+=d+".small { padding: 3px 15px; font-size: 12px; }",a+=d+".large { padding: 4px 19px; font-size: 14px; }",b.type="text/css",b.id="paypal-button",b.styleSheet?b.styleSheet.cssText=a:b.appendChild(document.createTextNode(a)),document.getElementsByTagName("head")[0].appendChild(b))}function b(a,b){var c,d,e,h,i,j,l,m,n=document.createElement("form"),o=document.createElement("button"),p=document.createElement("input"),q=a.items;n.method="post",n.action=g.replace("{env}",a.items.env.value),n.className="paypal-button",n.target="_top",p.type="hidden",j=q.size&&q.size.value||"large",l=q.lc&&q.lc.value||"en_US",m=k[l]||k.en_US;for(i in q)c=q[i],c.isEditable?(h=document.createElement("input"),h.type="text",h.className="paypal-input",h.name=c.key,h.value=c.value,e=document.createElement("label"),e.className="paypal-label",e.appendChild(document.createTextNode(f.config.labels[c.key]||m[c.key])),e.appendChild(h),d=document.createElement("p"),d.className="paypal-group",d.appendChild(e)):(h=d=p.cloneNode(!0),h.name=c.key,h.value=c.value),n.appendChild(d);try{o.type="submit"}catch(r){o.setAttribute("type","submit")}if(o.className="paypal-button "+j,o.appendChild(document.createTextNode(m[b])),n.appendChild(o),PAYPAL.apps.MiniCart&&"_cart"===a.items.cmd.value){var s=PAYPAL.apps.MiniCart;s.UI.itemList||s.render(),s.bindForm(n)}return n}function c(a,b){var c,d,e=g.replace("{env}",a.items.env.value),f=document.createElement("img"),i=e+"?",j=13,k=a.items;b=b&&b.value||250;for(d in k)c=k[d],i+=c.key+"="+encodeURIComponent(c.value)+"&";return i=encodeURIComponent(i),f.src=h.replace("{env}",a.items.env.value).replace("{url}",i).replace("{pattern}",j).replace("{size}",b),f}function d(a){var b,c,d,e,f,g={};if(b=a.attributes)for(f=0,e=b.length;e>f;f++)c=b[f],(d=/^data-([a-z0-9_]+)(-editable)?/i.exec(c.name))&&(g[d[1]]={value:c.value,isEditable:!!d[2]});return g}function e(){this.items={},this.add=function(a,b,c){this.items[a]={key:a,value:b,isEditable:c}},this.remove=function(a){delete this.items[a]}}var f={},g="https://{env}.paypal.com/cgi-bin/webscr",h="https://{env}.paypal.com/webapps/ppint/qrcode?data={url}&pattern={pattern}&height={size}",i="JavaScriptButton_{type}",j={name:"item_name",number:"item_number",locale:"lc",currency:"currency_code",recurrence:"p3",period:"t3",callback:"notify_url"},k={da_DK:{buynow:"Køb nu",cart:"Læg i indkøbsvogn",donate:"Doner",subscribe:"Abonner",item_name:"Vare",number:"Nummer",amount:"Pris",quantity:"Antal"},de_DE:{buynow:"Jetzt kaufen",cart:"In den Warenkorb",donate:"Spenden",subscribe:"Abonnieren",item_name:"Artikel",number:"Nummer",amount:"Betrag",quantity:"Menge"},en_AU:{buynow:"Buy Now",cart:"Add to Cart",donate:"Donate",subscribe:"Subscribe",item_name:"Item",number:"Number",amount:"Amount",quantity:"Quantity"},en_GB:{buynow:"Buy Now",cart:"Add to Cart",donate:"Donate",subscribe:"Subscribe",item_name:"Item",number:"Number",amount:"Amount",quantity:"Quantity"},en_US:{buynow:"Buy Now",cart:"Add to Cart",donate:"Donate",subscribe:"Subscribe",item_name:"Item",number:"Number",amount:"Amount",quantity:"Quantity"},es_ES:{buynow:"Comprar ahora",cart:"Añadir al carro",donate:"Donar",subscribe:"Suscribirse",item_name:"Artículo",number:"Número",amount:"Importe",quantity:"Cantidad"},es_XC:{buynow:"Comprar ahora",cart:"Añadir al carrito",donate:"Donar",subscribe:"Suscribirse",item_name:"Artículo",number:"Número",amount:"Importe",quantity:"Cantidad"},fr_CA:{buynow:"Acheter",cart:"Ajouter au panier",donate:"Faire un don",subscribe:"Souscrire",item_name:"Objet",number:"Numéro",amount:"Montant",quantity:"Quantité"},fr_FR:{buynow:"Acheter",cart:"Ajouter au panier",donate:"Faire un don",subscribe:"Souscrire",item_name:"Objet",number:"Numéro",amount:"Montant",quantity:"Quantité"},fr_XC:{buynow:"Acheter",cart:"Ajouter au panier",donate:"Faire un don",subscribe:"Souscrire",item_name:"Objet",number:"Numéro",amount:"Montant",quantity:"Quantité"},he_IL:{buynow:"וישכע הנק",cart:"תוינקה לסל ףסוה",donate:"םורת",subscribe:"יונמכ ףרטצה",item_name:"טירפ",number:"רפסמ",amount:"םוכס",quantity:"מותכ"},id_ID:{buynow:"Beli Sekarang",cart:"Tambah ke Keranjang",donate:"Donasikan",subscribe:"Berlangganan",item_name:"Barang",number:"Nomor",amount:"Harga",quantity:"Kuantitas"},it_IT:{buynow:"Paga adesso",cart:"Aggiungi al carrello",donate:"Donazione",subscribe:"Iscriviti",item_name:"Oggetto",number:"Numero",amount:"Importo",quantity:"Quantità"},ja_JP:{buynow:"今すぐ購入",cart:"カートに追加",donate:"寄付",subscribe:"購読",item_name:"商品",number:"番号",amount:"価格",quantity:"数量"},nl_NL:{buynow:"Nu kopen",cart:"Aan winkelwagentje toevoegen",donate:"Doneren",subscribe:"Abonneren",item_name:"Item",number:"Nummer",amount:"Bedrag",quantity:"Hoeveelheid"},no_NO:{buynow:"Kjøp nå",cart:"Legg til i kurv",donate:"Doner",subscribe:"Abonner",item_name:"Vare",number:"Nummer",amount:"Beløp",quantity:"Antall"},pl_PL:{buynow:"Kup teraz",cart:"Dodaj do koszyka",donate:"Przekaż darowiznę",subscribe:"Subskrybuj",item_name:"Przedmiot",number:"Numer",amount:"Kwota",quantity:"Ilość"},pt_BR:{buynow:"Comprar agora",cart:"Adicionar ao carrinho",donate:"Doar",subscribe:"Assinar",item_name:"Produto",number:"Número",amount:"Valor",quantity:"Quantidade"},ru_RU:{buynow:"Купить сейчас",cart:"Добавить в корзину",donate:"Пожертвовать",subscribe:"Подписаться",item_name:"Товар",number:"Номер",amount:"Сумма",quantity:"Количество"},sv_SE:{buynow:"Köp nu",cart:"Lägg till i kundvagn",donate:"Donera",subscribe:"Abonnera",item_name:"Objekt",number:"Nummer",amount:"Belopp",quantity:"Antal"},th_TH:{buynow:"ซื้อทันที",cart:"เพิ่มลงตะกร้า",donate:"บริจาค",subscribe:"บอกรับสมาชิก",item_name:"ชื่อสินค้า",number:"รหัสสินค้า",amount:"ราคา",quantity:"จำนวน"},tr_TR:{buynow:"Hemen Alın",cart:"Sepete Ekleyin",donate:"Bağış Yapın",subscribe:"Abone Olun",item_name:"Ürün",number:"Numara",amount:"Tutar",quantity:"Miktar"},zh_CN:{buynow:"立即购买",cart:"添加到购物车",donate:"捐赠",subscribe:"租用",item_name:"物品",number:"编号",amount:"金额",quantity:"数量"},zh_HK:{buynow:"立即買",cart:"加入購物車",donate:"捐款",subscribe:"訂用",item_name:"項目",number:"號碼",amount:"金額",quantity:"數量"},zh_TW:{buynow:"立即購",cart:"加到購物車",donate:"捐款",subscribe:"訂閱",item_name:"商品",number:"商品編號",amount:"單價",quantity:"數量"},zh_XC:{buynow:"立即购买",cart:"添加到购物车",donate:"捐赠",subscribe:"租用",item_name:"物品",number:"编号",amount:"金额",quantity:"数量"}};if(PAYPAL.apps.ButtonFactory||(f.config={labels:{}},f.buttons={buynow:0,cart:0,donate:0,qr:0,subscribe:0},f.create=function(d,f,g,h){var k,l,m,n=new e;if(!d)return!1;for(l in f)n.add(j[l]||l,f[l].value,f[l].isEditable);return g=g||"buynow",m="www",n.items.env&&n.items.env.value&&(m+="."+n.items.env.value),"cart"===g?(n.add("cmd","_cart"),n.add("add",!0)):"donate"===g?n.add("cmd","_donations"):"subscribe"===g?(n.add("cmd","_xclick-subscriptions"),n.items.amount&&!n.items.a3&&n.add("a3",n.items.amount.value)):n.add("cmd","_xclick"),n.add("business",d),n.add("bn",i.replace(/\{type\}/,g)),n.add("env",m),"qr"===g?(k=c(n,n.items.size),n.remove("size")):k=b(n,g),a(),this.buttons[g]+=1,h&&h.appendChild(k),k},PAYPAL.apps.ButtonFactory=f),"undefined"!=typeof document){var l,m,n,o,p,q,r=PAYPAL.apps.ButtonFactory,s=document.getElementsByTagName("script");for(p=0,q=s.length;q>p;p++)l=s[p],l&&l.src&&(m=l&&d(l),n=m&&m.button&&m.button.value,o=l.src.split("?merchant=")[1],o&&(r.create(o,m,n,l.parentNode),l.parentNode.removeChild(l)))}}(),"object"==typeof module&&"object"==typeof module.exports&&(module.exports=PAYPAL);