Skip to content

Instantly share code, notes, and snippets.

@MizR
Created January 21, 2024 11:29
Show Gist options
  • Save MizR/69193e27cc611f797f176bee9157d4f7 to your computer and use it in GitHub Desktop.
Save MizR/69193e27cc611f797f176bee9157d4f7 to your computer and use it in GitHub Desktop.
Untitled
<h3 class="dorik-heading dorik-heading-zivduvqr" id="price-1">
</h3>
<span id="price-detail-personal"></span>
<h3 class="dorik-heading dorik-heading-o0iwg9p8" id="price-2">
</h3>
<span id="price-detail-business"></span>
// Function to set USD pricing
function setUsdPricing() {
document.getElementById('price-1').innerHTML = '<span><sub>$</sub>15<sub>/month</sub></span>';
document.getElementById('price-detail-personal').innerHTML = '<strong>$19/MONTHLY</strong>';
document.getElementById('price-2').innerHTML = '<span><sub>$</sub>39<sub>/month</sub></span>';
document.getElementById('price-detail-business').innerHTML = '<strong>$49/MONTHLY</strong>';
}
// Function to update pricing for India
function updatePricingForIndia() {
document.getElementById('price-1').innerHTML = '<span><sub>₹</sub>599<sub>/month</sub></span>';
document.getElementById('price-detail-personal').innerHTML = '<strong>₹799/MONTHLY</strong>';
document.getElementById('price-2').innerHTML = '<span><sub>₹</sub>1599<sub>/month</sub></span>';
document.getElementById('price-detail-business').innerHTML = '<strong>₹1999/MONTHLY</strong>';
}
// Function to detect user's timezone and update pricing
function detectTimeZoneAndUpdatePricing() {
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (timeZone === 'Asia/Calcutta') {
updatePricingForIndia();
} else {
setUsdPricing();
}
}
// Ensure the script runs after the DOM is fully loaded
document.addEventListener('DOMContentLoaded', (event) => {
detectTimeZoneAndUpdatePricing();
});
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment