2018-07-06 07:18:51 +02:00
|
|
|
class MouseHandler {
|
2018-10-09 03:49:15 +02:00
|
|
|
onClick(selector, callback, noPreventDefault) {
|
2018-07-06 07:18:51 +02:00
|
|
|
let elements = document.querySelectorAll(selector);
|
|
|
|
elements.forEach((element) => {
|
|
|
|
element.onclick = (event) => {
|
2018-10-09 06:08:43 +02:00
|
|
|
if (! noPreventDefault) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
|
2018-07-06 07:18:51 +02:00
|
|
|
callback(event);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|