Refactoring AXO module

This commit is contained in:
Pedro Silva 2024-03-08 17:41:21 +00:00
parent 039cc53f40
commit 795c1fdcd6
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
8 changed files with 365 additions and 311 deletions

View file

@ -1,13 +1,35 @@
import {setVisible} from "../../../../ppcp-button/resources/js/modules/Helper/Hiding";
class DomElement {
constructor(config) {
this.$ = jQuery;
this.config = config;
this.selector = this.config.selector;
this.id = this.config.selector || null;
this.className = this.config.selector || null;
this.id = this.config.id || null;
this.className = this.config.className || null;
this.anchorSelector = this.config.anchorSelector || null;
}
trigger(action) {
this.$(this.selector).trigger(action);
}
on(action, callable) {
this.$(document).on(action, this.selector, callable);
}
hide(important = false) {
setVisible(this.selector, false, important);
}
show() {
setVisible(this.selector, true);
}
click() {
document.querySelector(this.selector).click();
}
}
export default DomElement;