mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 16:38:22 +03:00
Added stripe load method
no issue - Load Stripe script if not already loaded on page - Many members.js features rely on Stripe script to be loaded on the page to allow checkout/billing updates etc.
This commit is contained in:
parent
fc75d9881d
commit
9cf8e0e435
@ -11,6 +11,20 @@ function addRootDiv() {
|
||||
document.body.appendChild(elem);
|
||||
}
|
||||
|
||||
function loadStripe() {
|
||||
// We don't want to load Stripe again if already loaded
|
||||
if (!window.Stripe) {
|
||||
// Get the first script element on the page
|
||||
const ref = document.getElementsByTagName('script')[0];
|
||||
// Create a new script element
|
||||
const script = document.createElement('script');
|
||||
// Set the script element `src`
|
||||
script.src = 'https://js.stripe.com/v3/';
|
||||
// Inject the script into the DOM
|
||||
ref.parentNode.insertBefore(script, ref);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTokenUrl() {
|
||||
const url = new URL(window.location);
|
||||
if (url.searchParams.get('token')) {
|
||||
|
Loading…
Reference in New Issue
Block a user