Skip to content

Instantly share code, notes, and snippets.

@nick133
Last active July 6, 2022 08:33
Show Gist options
  • Save nick133/1c48348a2ffeed6b5f18e4100929b262 to your computer and use it in GitHub Desktop.
Save nick133/1c48348a2ffeed6b5f18e4100929b262 to your computer and use it in GitHub Desktop.
Fix Aliexpress Country/Currency settings
///
/// !!! Outdated - Not working with current aliexpress version !!!
///
// ==UserScript==
// @name Aliexpress fix locale
// @description Fix Aliexpress country and currency settings
// @icon https://www.aliexpress.com/favicon.ico
// @version 1
// @grant none
// @match https://*.aliexpress.com/*
// ==/UserScript==
var idCurrencyText = "USD"
var idCurrencyIndex = "0"
var idCountryIndex = "220" // Ukraine
window.onload = (event) => {
// Set USD currency and country
if (document.getElementsByClassName("css_flag css_ua").length == 0
|| document.getElementsByClassName("currency")[0].innerText != idCurrencyText) {
// Open Menu
document.getElementById("switcher-info").click()
//Wait for Menu to load as it is in external script
setTimeout(() => {
// Menu select country
document.querySelectorAll("[data-name]")[idCountryIndex].click()
// Menu select currency
document.querySelectorAll("[data-currency]")[idCurrencyIndex].click()
// Menu Save settings
document.getElementsByClassName("ui-button ui-button-primary go-contiune-btn")[0].click()
}, 1000)
}
}
@DynaZor
Copy link

DynaZor commented May 5, 2020

Hi! I want to use your script but I can't find a list of the country indexes. Can you help me? Thanks :)

@nick133
Copy link
Author

nick133 commented May 6, 2020

Hi! I want to use your script but I can't find a list of the country indexes. Can you help me? Thanks :)

They brake this script with the latest website updates, it doesn't work anymore, sorry. Need to dig deep inside the code again, the changed country indexes to country codes (letters)

@DynaZor
Copy link

DynaZor commented May 6, 2020

Oh.. OK thanks!
Could you please add a comment in the code so others will know this easily?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment