Last active
October 18, 2018 08:28
-
-
Save kenglxn/7c53b2ddf228f29f36817ac87db94740 to your computer and use it in GitHub Desktop.
bookmarklet for søk i aurora console
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
javascript:(function () { | |
document | |
.querySelector('.user-profile p') | |
.appendChild(document.createElement('input')) | |
.addEventListener('keyup', (ev) => { | |
if (ev.target.value.length === 0) { | |
document.querySelectorAll('.console-table th, .console-table td').forEach(elem => (elem.style.display = '')); | |
} | |
if (ev.target.value.length > 2) { | |
const indexes = Array.from(document.querySelectorAll('.console-table thead th').entries()).filter(([idx, elem]) => elem.innerText.includes(ev.target.value)).map(([idx, elem]) => idx); | |
document.querySelectorAll('.console-table tr').forEach(row => { | |
Array.from(row.querySelectorAll('td,th').entries()).forEach(([idx, elem]) => { | |
elem.style.display = (idx === 0 || indexes.includes(idx)) ? '' : 'none'; | |
}) | |
}); | |
} | |
}); | |
}()); |
Modifisert versjon for nye aurora konsoll:
javascript:(function () {
document
.querySelector('.g-header-user')
.appendChild(document.createElement('input'))
.addEventListener('keyup', (ev) => {
if (ev.target.value.length === 0) {
document.querySelectorAll('table th, table td').forEach(elem => (elem.style.display = ''));
}
if (ev.target.value.length > 2) {
const indexes = Array.from(document.querySelectorAll('table thead th').entries()).filter(([idx, elem]) => elem.innerText.includes(ev.target.value)).map(([idx, elem]) => idx);
document.querySelectorAll('table tr').forEach(row => {
Array.from(row.querySelectorAll('td,th').entries()).forEach(([idx, elem]) => {
elem.style.display = (idx === 0 || indexes.includes(idx)) ? '' : 'none';
})
});
}
});
}());
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Disse er ganske fine! Du får ikke nok cred for dem ;)