2023-09-15 17:32:00 +01:00
|
|
|
import BaseAction from "./BaseAction";
|
|
|
|
|
2024-02-16 15:04:36 +00:00
|
|
|
class VisibilityAction extends BaseAction {
|
2023-09-15 17:32:00 +01:00
|
|
|
|
|
|
|
run(status) {
|
|
|
|
|
|
|
|
if (status) {
|
|
|
|
if (this.config.action === 'visible') {
|
|
|
|
jQuery(this.config.selector).removeClass('ppcp-field-hidden');
|
|
|
|
}
|
|
|
|
if (this.config.action === 'enable') {
|
|
|
|
jQuery(this.config.selector).removeClass('ppcp-field-disabled')
|
|
|
|
.off('mouseup')
|
|
|
|
.find('> *')
|
|
|
|
.css('pointer-events', '');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (this.config.action === 'visible') {
|
|
|
|
jQuery(this.config.selector).addClass('ppcp-field-hidden');
|
|
|
|
}
|
|
|
|
if (this.config.action === 'enable') {
|
|
|
|
jQuery(this.config.selector).addClass('ppcp-field-disabled')
|
|
|
|
.on('mouseup', function(event) {
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
})
|
|
|
|
.find('> *')
|
|
|
|
.css('pointer-events', 'none');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-02-16 15:04:36 +00:00
|
|
|
export default VisibilityAction;
|