1
1
Fork 0
friendica_2019-12_sharedHos.../view/js/module/admin/logs/view.js
fabrixxm 7f695197aa Fix review points
- Fix headers hierarchy
- Improve accessibility:
 	- set mouse pointer
	- make rows focusable
	- open on key press
	- add tooltip with "title"
	- add role and aria attributes
- Rename `ParsedLog` to `ParsedLogLine`
- Add docs to `ReversedFileReader`'s implementation of `Iterator`'s methods
- Add docs to `ParsedLogIterator`'s implementation of `Iterator`'s methods
- Remove unnecessary comment
- Add more test for parsing log lines and fix some edge cases
- Fix function name in snake-case to camelCase
- Remove `DIRECTORY_SEPARATOR`
2021-08-20 11:02:18 +02:00

33 lines
No EOL
760 B
JavaScript

(function(){
function log_show_details(elm) {
const id = elm.id;
var hidden = true;
document
.querySelectorAll('[data-id="' + id + '"]')
.forEach(edetails => {
hidden = edetails.classList.toggle('hidden');
});
document
.querySelectorAll('[aria-expanded="true"]')
.forEach(eexpanded => {
eexpanded.setAttribute('aria-expanded', false);
});
if (!hidden) {
elm.setAttribute('aria-expanded', true);
}
}
document
.querySelectorAll('.log-event')
.forEach(elm => {
elm.addEventListener("click", evt => {
log_show_details(evt.currentTarget);
});
elm.addEventListener("keydown", evt => {
if (evt.keyCode == 13 || evt.keyCode == 32) {
log_show_details(evt.currentTarget);
}
});
});
})();