var restc=restc||{};$(function(){'use strict';$(document).on('flatdoc:ready',function(){var stripeHandler=StripeCheckout.configure({key:'pk_live_lKuAMSLFxniueaO1AcVD81HB',image:'https://restcountries.eu/img/rc-icon.png',locale:'auto',billingAddress:true,panelLabel:'Contribute',token:function(token){$.ajax({url:'https://restcountries.eu/rest/contribute',type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({"token":token.id,"amount":restc.amount}),success:function(data,textStatus,jqXHR){console.log("Contribution success")},error:function(jqXHR,textStatus,errorThrown){console.log(textStatus);alert("Your contribution failed. Please contact support@restcountries.eu")}})}});$('a[href="#five"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:500});restc.amount=500;e.preventDefault()});$('a[href="#ten"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:1000});restc.amount=1000;e.preventDefault()});$('a[href="#twenty"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:2000});restc.amount=2000;e.preventDefault()});$('a[href="#fifty"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:5000});restc.amount=5000;e.preventDefault()});$('a[href="#seventy"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:7000});restc.amount=7000;e.preventDefault()});$('a[href="#hundred"]').click(function(e){stripeHandler.open({name:'REST Countries',description:'Secured by Stripe',currency:'eur',amount:10000});restc.amount=10000;e.preventDefault()});window.addEventListener('popstate',function(){stripeHandler.close()})})});