Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
// Function to extract the country or language code from the URL path
function extractCountryOrLanguageFromPath() {
// Get the URL path
let path = window.location.pathname;
// Define a regular expression pattern for a two-letter country or language code
let regex = //([a-z]{2})//i;
// Execute the regex on the path to find a match
let match = path.match(regex);
// Check if a match was found
if (match && match[1]) {
let code = match[1]; // Extracted country or language code
// Store the code in localStorage
localStorage.setItem('reachPlatformCode', code);
console.log(`Code set to: ${code}`);
} else {
console.log('No country or language code found in URL path.');
}
}
// Function to validate if the extracted country code is in a predefined list
function validateCountryCodeAndShowLink() {
// List of 20 countries (ISO 3166-1 alpha-2 codes)
const countryList = ['us', 'ca', 'gb', 'fr', 'de', 'es', 'it', 'au', 'jp', 'cn',
'in', 'br', 'ru', 'za', 'kr', 'mx', 'ar', 'nl', 'se', 'ch'];
// Retrieve the stored country code from localStorage
let storedCode = localStorage.getItem('reachPlatformCode');
// Get all elements with the class name 'reachItLinkClass'
let elements = document.getElementsByClassName('reachItLinkClass');
if (storedCode) {
// Check if the stored code is in the predefined country list
if (countryList.includes(storedCode.toLowerCase())) {
console.log(`The stored country code "${storedCode}" is valid.`);
// Show the "Reach It" link if the country code is valid
for (let element of elements) {
element.style.display = 'block';
}
} else {
console.log(`The stored country code "${storedCode}" is not in the valid list.`);
// Hide the "Reach It" link if the country code is not valid
for (let element of elements) {
element.style.display = 'none';
}
}
} else {
console.log('No country code found in localStorage.');
// Hide the "Reach It" link if no country code is found
for (let element of elements) {
element.style.display = 'none';
}
}
}
// Execute the functions
extractCountryOrLanguageFromPath();
validateCountryCodeAndShowLink();
})();
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team