Created
January 16, 2020 20:17
-
-
Save parzibyte/b262a491a92d8c5572e9702dfbad25b9 to your computer and use it in GitHub Desktop.
This file contains 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
const $quicklink = document.querySelector("#quicklink"), | |
$resultado = document.querySelector("#resultado"); | |
$quicklink.addEventListener("change", () => { | |
$resultado.textContent = obtenerLink(); | |
}); | |
const obtenerLink = () => { | |
const valor = decodeURIComponent($quicklink.value); | |
if (!valor) return ""; | |
const busqueda = "?s="; | |
const indice = valor.indexOf(busqueda); | |
if (indice === -1) return ""; | |
return valor.substring(indice+busqueda.length, valor.length); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment