Skip to content

Instantly share code, notes, and snippets.

@osdiab
Created July 28, 2021 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osdiab/a49fa4baef42cca48c78a412f1e9fedf to your computer and use it in GitHub Desktop.
Save osdiab/a49fa4baef42cca48c78a412f1e9fedf to your computer and use it in GitHub Desktop.
Income Movement Donate Button Embed
<html>
<body>
<a href="https://www.every.org/incomemovement/donate">Donate!</a>
<script>
(function () {
document.addEventListener("DOMContentLoaded", function () {
document
.querySelector("#edoDonateButtonScript")
.addEventListener("load", () => {
var nonprofitSlug = "incomemovement";
var heading =
"<bold>Your support is vital to our people powered movement.</bold>";
var message =
"When you donate to Income Movement you help continue the important work of growing our grassroots community and advocating for direct cash policies.";
everyMonthWidget.setOptions({
onSubmit: { charity: nonprofitSlug },
mode: "split",
monthly: {
levels: [
{ amount: 25 },
{ amount: 50 },
{ amount: 100 },
{ amount: 200 },
],
img:
"https://res.cloudinary.com/everydotorg/image/upload/v1627509515/incomemvmt-sf_wx8rbk.jpg",
allowCustom: true,
},
oneTime: {
img:
"https://res.cloudinary.com/everydotorg/image/upload/v1623246984/Gateway_101619_0192_gm4vqy.jpg",
},
i18n: {
en: {
company: {
logo:
"https://res.cloudinary.com/everydotorg/image/upload/c_lfill,w_96,h_96,dpr_1/c_crop,ar_96:96/q_auto,f_auto,fl_progressive/profile_pics/sz14oq1a6cembj2mahfb",
name: "Income Movement",
location: "Portland, OR",
},
oneTime: { description: message },
monthly: {
header: "Support Income Movement Today!",
info:
"Monthly gifts help us focus on our mission and long-term impact.",
levels: [
{
amount: "25",
name: "Gateway Lion’s Contributor",
description1: heading,
description2: message,
},
{
amount: "50",
description1: heading,
description2: message,
},
{
amount: "100",
description1: heading,
description2: message,
},
{
amount: "200",
description1: heading,
description2: message,
},
],
custom: {
label: "Custom",
placeholder: "Enter amount",
description1: heading,
description2: message,
},
},
},
},
});
activateEdoDonateButtons(nonprofitSlug);
});
});
var tries = 0;
function activateEdoDonateButtons(slug) {
var selector = "a[href='https://www.every.org/" + slug + "/donate']";
var btns = document.querySelectorAll(selector);
if (btns.length === 0 && tries < 20) {
tries++;
setTimeout(() => activateEdoDonateButtons(slug), 250);
}
for (var i = 0; i < btns.length; ++i) {
btns[i].addEventListener("click", (e) => {
e.preventDefault();
everyMonthWidget.show();
});
}
}
})();
</script>
<script
async
defer
id="edoDonateButtonScript"
src="https://assets.every.org/dist/donate-button/0.2/index.js"
></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment