דלג לתוכן
מציג תוצאה אחת
imunify-bot-check
add_action('wp_footer', function () {
?>
document.addEventListener('DOMContentLoaded', function () {
function wp4allSafeDonationFixes() {
var forms = document.querySelectorAll('#wcdp form.wcdp-choose-donation, .wc-donation-platform form.wcdp-choose-donation');
forms.forEach(function(form) {
var amountList = form.querySelector('ul.wcdp_options, ul.wcdp_amount');
if (!amountList) {
return;
}
var labels = amountList.querySelectorAll('label');
labels.forEach(function(label) {
var text = label.textContent.trim();
if (
text.indexOf('סכום אחר') !== -1 ||
text.indexOf('Other') !== -1 ||
label.classList.contains('wcdp_label_custom_amount') ||
label.id.indexOf('label_custom_amount') !== -1
) {
var li = label.closest('li');
if (li) {
li.classList.add('wp4all-other-li');
}
label.classList.add('wp4all-other-label');
}
});
var otherRadio = form.querySelector('input.wcdp_value_other, input[id*="value_other"]');
if (otherRadio) {
var otherLabel = form.querySelector('label[for="' + otherRadio.id + '"]');
if (otherLabel) {
if (otherRadio.checked) {
otherLabel.classList.add('is-open');
} else {
otherLabel.classList.remove('is-open');
}
}
}
});
wp4allTranslateDonationTexts();
}
function wp4allTranslateDonationTexts() {
var replacements = {
'Back': 'חזור',
'Next': 'הבא',
'Amount': 'סכום',
'Details': 'פרטים',
'Payment': 'תשלום',
'Other': 'סכום אחר',
'Choose amount': 'בחר סכום',
'Choose Amount': 'בחר סכום',
' of ': ' מתוך ',
' ago': ' לפני',
' donated ': ' תרם ',
'Only one donation form per page allowed': 'ניתן להציג טופס תרומה אחד בלבד בכל עמוד',
'Invalid request. Please reload the page and try again. If the problem persists, please contact our support team.': 'הבקשה לא נקלטה. רעננו את העמוד ונסו שוב.'
};
var walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
null,
false
);
var node;
while (node = walker.nextNode()) {
var parent = node.parentElement;
if (parent && parent.tagName && ['INPUT', 'TEXTAREA', 'SCRIPT', 'STYLE'].indexOf(parent.tagName) !== -1) {
continue;
}
var text = node.nodeValue;
Object.keys(replacements).forEach(function(original) {
text = text.split(original).join(replacements[original]);
});
node.nodeValue = text;
}
}
wp4allSafeDonationFixes();
setTimeout(wp4allSafeDonationFixes, 300);
setTimeout(wp4allSafeDonationFixes, 1000);
setTimeout(wp4allSafeDonationFixes, 2500);
document.addEventListener('change', function() {
setTimeout(wp4allSafeDonationFixes, 80);
setTimeout(wp4allSafeDonationFixes, 300);
});
document.addEventListener('click', function() {
setTimeout(wp4allSafeDonationFixes, 80);
setTimeout(wp4allSafeDonationFixes, 300);
});
});