2024-03-08 17:41:21 +00:00
|
|
|
import {setVisible} from "../../../../ppcp-button/resources/js/modules/Helper/Hiding";
|
2024-03-08 14:39:50 +00:00
|
|
|
|
|
|
|
class DomElement {
|
|
|
|
|
|
|
|
constructor(config) {
|
2024-03-08 17:41:21 +00:00
|
|
|
this.$ = jQuery;
|
2024-03-08 14:39:50 +00:00
|
|
|
this.config = config;
|
|
|
|
this.selector = this.config.selector;
|
2024-03-08 17:41:21 +00:00
|
|
|
this.id = this.config.id || null;
|
|
|
|
this.className = this.config.className || null;
|
|
|
|
this.anchorSelector = this.config.anchorSelector || null;
|
2024-03-08 14:39:50 +00:00
|
|
|
}
|
|
|
|
|
2024-03-08 17:41:21 +00:00
|
|
|
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();
|
|
|
|
}
|
2024-03-08 14:39:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default DomElement;
|