mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Refactoring AXO module
This commit is contained in:
parent
039cc53f40
commit
795c1fdcd6
8 changed files with 365 additions and 311 deletions
|
@ -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;
|
||||
|
|
|
@ -49,7 +49,10 @@ class DomElementCollection {
|
|||
|
||||
this.submitButtonContainer = new DomElement({
|
||||
selector: '#ppcp-axo-submit-button-container',
|
||||
buttonSelector: '#ppcp-axo-submit-button-container button'
|
||||
});
|
||||
|
||||
this.submitButton = new DomElement({
|
||||
selector: '#ppcp-axo-submit-button-container button'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue