Skip to content

Instantly share code, notes, and snippets.

@salsalabs
Last active June 9, 2020 21:52
Show Gist options
  • Save salsalabs/5dbb3cfd03a20a2e708dd1a6c619e133 to your computer and use it in GitHub Desktop.
Save salsalabs/5dbb3cfd03a20a2e708dd1a6c619e133 to your computer and use it in GitHub Desktop.
Change displayed names for selected countries.
<!-- BEGIN Change displayed names for selected countries. -->
<script type="text/javascript">
(function() {
// This object maps country abbreviations to text.
// - The keys are ISO-3166 Alpha 2 abbreviations for countries.
// - The values are the countries names to display.
// You can find the abbreviations by viewing the HTML source
// of any page that has a country field.
countries = {
"LY": "Libya",
"MK": "North Macedonia, Republic of"
}
document.addEventListener("DOMContentLoaded", () => {
for (const abbr in countries) {
var q = `option[value="${abbr}"]`;
var e = document.querySelector(q);
if (e != null) {
e.text = countries[abbr];
}
}
})
})();
</script>
<!-- End Change displayed names for selected countries. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment