Last active
March 14, 2018 05:39
-
-
Save hobelinm/15a5605444c402a674230c96cfe5e77e to your computer and use it in GitHub Desktop.
0.1 Version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script | |
src="https://code.jquery.com/jquery-3.3.1.min.js" | |
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
crossorigin="anonymous"> | |
</script> | |
<script> | |
if(localStorage.getItem('IsDebug') === 'true') { | |
console.log('Debug mode, no redirection'); | |
return; | |
} | |
let langs = ['en-US', 'es-MX']; | |
let aRefs = $('a[href^="https://blog.hugobelin.com/search/label/"]'); | |
let lang = 'en-US'; | |
for(let i = 0; i < aRefs.length; i++) { | |
let aTag = aRefs[i]; | |
if(langs.include(aTag.innerHTML)) { | |
lang = aTag.innerHTML; | |
} | |
} | |
console.log(window.location.href); | |
if(window.self === window.top) { | |
console.log('Redirecting to:'); | |
let destination = 'https://hugobelin.com/#post:' + lang + ':' + window.location.pathname; | |
console.log(destination); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment