-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommend people embed the "latest" version #270
Comments
If we want a simple way to embed multiple kinds of widgets we could make a small script that loads other scripts only for widgets used on the page. The code on the page could look like this <a href="https://www.every.org/livebetter-corp/donate">Donate</a>
<script async src="https://partners.every.com/widgets.js"></script> and const links = document.querySelectorAll('a[href^="https://www.every.org/"]');
const donateButtonRegex = /^https:\/\/www\.every\.org\/.*\/donate$/;
links.forEach((element) => {
// Check if the link is a EDO Donate link
if (donateButtonRegex.test(element.href)) {
console.info("Donate button found", element);
loadDonateButtonJs();
}
});
let donateButtonJsLoading;
function loadDonateButtonJs() {
// Prevent loading multuple times
if (donateButtonJsLoading) return;
donateButtonJsLoading = true;
console.info("Loading bonate button JS");
const script = document.createElement("script");
script.src = "https://assets.every.org/dist/donate-button/latest/index.js";
document.body.appendChild(script);
}
We could support a few config options as <a href="https://www.every.org/livebetter-corp/donate" id="widget-1">Donate</a>
<script>
window.edoConfig = {
widget1: { /* full config here */ }
}
</script>
<script async src="https://partners.every.com/widgets.js"></script> What does everyone think? |
Alternatively, and more simply, we could have a donate-widget-specific script that is included in the page after the element and initialises on load without needing to be called. <a href="https://www.every.org/livebetter-corp/donate">Donate</a>
<script async src="https://assets.every.org/dist/donate-button/latest/index.js"></script> |
We should have some URL like https://partners.every.com/widgets.js which will be continuously upgraded to the latest version of the
donate-button
repo. This is what Twitter, Pinterest, and TikTok all do - when people want to embed a tweet at https://publish.twitter.com/, they are given an everygreen link to thewidget.js
twitter libraryWe want to make it super easy for anyone on the internet to embed an Every.org experience on their own website, and for this to be so easy you don't have to be a developer to embed it, and for the user experience to always be as up to date and unified across the internet as possible.
For developers who want a specific version, they can use directions in this repo to point to a specific version
The text was updated successfully, but these errors were encountered: