fix wpcfto select and repeater related visibility and validation

This commit is contained in:
dwindown
2025-08-29 19:27:50 +07:00
parent ccb2b1aea1
commit 255da46509
14 changed files with 495 additions and 233 deletions

View File

@@ -1,13 +1,13 @@
function numberFormat(nStr) {
nStr = parseFloat(nStr).toFixed(2);
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
nStr = parseFloat(nStr).toFixed(2);
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
function processPostsReport(data) {
@@ -38,32 +38,32 @@ jQuery(function($){
});
(function() {
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassive = true;
}
});
window.addEventListener("testPassive", null, opts);
window.removeEventListener("testPassive", null, opts);
} catch (e) {}
if (!supportsPassive) return;
var origAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
// Only patch touchstart and touchmove if options is not explicitly passive
if (
(type === 'touchstart' || type === 'touchmove') &&
(options === undefined || options === false || (typeof options === 'object' && !options.passive))
) {
options = options || {};
if (typeof options === 'object') {
options.passive = true;
}
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassive = true;
}
return origAddEventListener.call(this, type, listener, options);
};
})();
});
window.addEventListener("testPassive", null, opts);
window.removeEventListener("testPassive", null, opts);
} catch (e) {}
if (!supportsPassive) return;
var origAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
// Only patch touchstart and touchmove if options is not explicitly passive
if (
(type === 'touchstart' || type === 'touchmove') &&
(options === undefined || options === false || (typeof options === 'object' && !options.passive))
) {
options = options || {};
if (typeof options === 'object') {
options.passive = true;
}
}
return origAddEventListener.call(this, type, listener, options);
};
})();