Skip to content

Instantly share code, notes, and snippets.

@EmaSuriano
Created May 21, 2020 10:35
Show Gist options
  • Save EmaSuriano/e4dbd08a76660e8b9d4788b9321c3dd3 to your computer and use it in GitHub Desktop.
Save EmaSuriano/e4dbd08a76660e8b9d4788b9321c3dd3 to your computer and use it in GitHub Desktop.
Simple script to improve the usage of `https://dict.leo.org/` for the mobile version inside pc.
// cleanup
setTimeout(function() {
document.querySelectorAll("[tabindex]")
.forEach(x => x.removeAttribute('tabindex'));
document.querySelectorAll('button').forEach(x => x.remove());
}, 500)
// watcher
var lastSearch = ""
var currentSearch = "";
setInterval(function() {
var elements = document.querySelectorAll("[data-dz-search-term]");
currentSearch = "";
elements.forEach(x => {
currentSearch = currentSearch + x.textContent;
});
if (lastSearch !== currentSearch) {
lastSearch = currentSearch;
elements.forEach(x => x.setAttribute('tabindex', '0'));
}
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment