/* Font Size Fixes (Min 16px) */
#PageBreadCrumps,
.normal-form input:not([type='submit']),
.normal-form textarea,
.normal-form select {
font-size: 16px;
}
/* Fix Gallery Focus Outline */
#gallery-randomizer .gallery-randomizer-item > div:focus-visible {
border: 2px solid white;
outline: 2px solid white !important;
}
// Skiplinks modification
(function () {
function addFooterSkipLink(delay = 500) {
setTimeout(function () {
const header = document.querySelector('header');
if (!header) return;
if (
header.querySelector('a.skip-link[href="#footer"], a[href*="#footer"]')
)
return;
let footer = document.querySelector('footer, .verybottom');
if (!footer) {
footer = document.createElement('footer');
document.body.appendChild(footer);
}
if (!footer.id) footer.id = 'footer';
const newLink = document.createElement('a');
newLink.className = 'skip-link screen-reader-text footer-skip-link';
newLink.href = '#footer';
newLink.textContent = 'דלג לתחתית הדף';
const lastSkip = header.querySelector('a.skip-link:last-of-type');
if (lastSkip) {
lastSkip.insertAdjacentElement('afterend', newLink);
} else {
header.insertBefore(newLink, header.firstChild);
}
}, delay);
}
document.addEventListener('DOMContentLoaded', function () {
addFooterSkipLink();
});
})();
// AriaLabel fixes
(function () {
function equalityAddAriaLabels(delay = 500) {
setTimeout(function () {
const menu = document.querySelector('#menu');
if (menu) {
menu.setAttribute(
'aria-label',
'תפריט ניווט. לניווט דרך המקלדת יש להקיש על כפתור הTAB עד לסיום הפריטים',
);
}
const topVideo = document.querySelector('#TopVideo > iframe');
if (topVideo) {
topVideo.setAttribute('aria-label', 'וידאו המחשה של אנגוס בשרים');
}
const pageVideo = document.querySelector(
'.page-12094 #videoContainer > iframe',
);
if (pageVideo) {
pageVideo.setAttribute('aria-label', 'סרטון המחשה אנגוס בשרים');
}
}, delay);
}
document.addEventListener('DOMContentLoaded', function () {
equalityAddAriaLabels();
const observer = new MutationObserver(() => equalityAddAriaLabels());
observer.observe(document.body, { childList: true, subtree: true });
});
})();
// Fix Form Fields Missing Labels
(function () {
function equalityMakeFormAccessible(delay = 500) {
setTimeout(function () {
// Select all forms whose ID starts with "dynamic-form-"
const forms = document.querySelectorAll('form[id^="dynamic-form-"]');
if (!forms.length) return;
function createHiddenLabel(forId, text) {
const label = document.createElement('label');
label.textContent = text;
label.htmlFor = forId;
label.className = 'sr-only';
return label;
}
forms.forEach((form) => {
// Field 1 - Full Name
const nameInput = form.querySelector('input[name="field_1"]');
if (nameInput) {
nameInput.id = nameInput.id || 'contact_name';
nameInput.setAttribute('aria-label', 'שם מלא');
nameInput.required = true;
nameInput.setAttribute('aria-required', 'true');
if (!form.querySelector(`label[for="${nameInput.id}"]`)) {
nameInput.parentNode.insertBefore(
createHiddenLabel(nameInput.id, 'שם מלא'),
nameInput,
);
}
}
// Field 2 - Phone
const phoneInput = form.querySelector('input[name="field_2"]');
if (phoneInput) {
phoneInput.id = phoneInput.id || 'contact_phone';
phoneInput.setAttribute('aria-label', 'טלפון');
phoneInput.required = true;
phoneInput.setAttribute('aria-required', 'true');
if (!form.querySelector(`label[for="${phoneInput.id}"]`)) {
phoneInput.parentNode.insertBefore(
createHiddenLabel(phoneInput.id, 'טלפון'),
phoneInput,
);
}
}
// Field 3 - Email
const emailInput = form.querySelector('input[name="field_3"]');
if (emailInput) {
emailInput.id = emailInput.id || 'contact_email';
emailInput.setAttribute('aria-label', 'אי מייל');
emailInput.required = true;
emailInput.setAttribute('aria-required', 'true');
if (!form.querySelector(`label[for="${emailInput.id}"]`)) {
emailInput.parentNode.insertBefore(
createHiddenLabel(emailInput.id, 'אי מייל'),
emailInput,
);
}
}
// Field 4 - Message (if exists)
const textarea = form.querySelector('textarea[name="field_4"]');
if (textarea) {
textarea.id = textarea.id || 'contact_message';
textarea.setAttribute('aria-label', 'מהות הפנייה');
textarea.required = true;
textarea.setAttribute('aria-required', 'true');
if (!form.querySelector(`label[for="${textarea.id}"]`)) {
textarea.parentNode.insertBefore(
createHiddenLabel(textarea.id, 'מהות הפנייה'),
textarea,
);
}
}
// Notification alert
const notif = form.querySelector('.notification.error');
if (notif) {
notif.setAttribute('role', 'alert');
notif.setAttribute('aria-live', 'assertive');
}
// Legend (if exists)
const legend = form.querySelector('legend');
if (legend) legend.classList.add('sr-only');
});
}, delay);
}
document.addEventListener('DOMContentLoaded', function () {
equalityMakeFormAccessible();
const observer = new MutationObserver(equalityMakeFormAccessible);
observer.observe(document.body, { childList: true, subtree: true });
});
})();
// Fix gallery grid lightbox and tabindex
(function () {
function equalityMakeGalleryAccessible(delay = 500) {
setTimeout(function () {
const gallery = document.querySelector('#gallery-randomizer');
if (!gallery) return;
const items = gallery.querySelectorAll(
'.gallery-randomizer-item > div[data-image]',
);
if (!items.length) return;
let lastFocusedElement = null;
items.forEach((item, index) => {
item.setAttribute('tabindex', '0');
item.setAttribute('role', 'button');
item.setAttribute('aria-label', `תמונת גלריה ${index + 1}`);
item.addEventListener('click', () => {
lastFocusedElement = item;
});
item.addEventListener('keydown', function (e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
lastFocusedElement = item;
item.click();
}
});
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && lastFocusedElement) {
setTimeout(() => lastFocusedElement.focus(), 300);
}
});
gallery.setAttribute('role', 'region');
gallery.setAttribute(
'aria-label',
'גלריית תמונות אינטראקטיבית. ניתן לנווט באמצעות כפתור TAB ולפתוח תמונה באמצעות ENTER. סגירה באמצעות ESC מחזירה את הפוקוס לתמונה האחרונה.',
);
}, delay);
}
document.addEventListener('DOMContentLoaded', function () {
equalityMakeGalleryAccessible();
});
})();
// Adds proper alts to links
(function () {
function equalityMarkExternalLinks() {
document.querySelectorAll('a[href]').forEach((link) => {
const href = link.getAttribute('href') || '';
const target = link.getAttribute('target') || '';
const title = link.getAttribute('title') || '';
const newParts = [];
if (/^(tel:|mailto:|sms:|whatsapp:|skype:|facetime:)/i.test(href)) {
if (!title.includes('נפתח בתוכנה נפרדת')) {
newParts.push('נפתח בתוכנה נפרדת');
}
}
if (target === '_blank') {
if (!title.includes('נפתח בכרטיסיה חדשה')) {
newParts.push('נפתח בכרטיסיה חדשה');
}
}
if (newParts.length > 0) {
const updatedTitle = [title, ...newParts].filter(Boolean).join(' | ');
link.setAttribute('title', updatedTitle);
}
});
}
// Fire it immediately for testing
equalityMarkExternalLinks();
// Watch for new links dynamically
const observer = new MutationObserver(() => {
equalityMarkExternalLinks();
});
observer.observe(document.body, { childList: true, subtree: true });
})();
// Fix title atts to social and phone
(function () {
function equalitySocialAndPhoneTitles() {
document.querySelectorAll('a[href]').forEach((link) => {
const href = link.getAttribute('href') || '';
const img = link.querySelector('img');
let titleText = '';
let altText = '';
if (/^tel:/i.test(href)) {
titleText = 'לחצו כדי לחייג לטלפון';
altText = 'קישור לחיוג טלפוני';
} else if (/facebook\.com/i.test(href)) {
titleText = 'מעבר לדף הפייסבוק של אנגוס';
altText = 'קישור לדף הפייסבוק שלנו';
} else if (/instagram\.com/i.test(href)) {
titleText = 'מעבר לעמוד האינסטגרם של אנגוס';
altText = 'קישור לעמוד האינסטגרם שלנו';
}
if (titleText) {
const currentTitle = link.getAttribute('title') || '';
if (!currentTitle.includes(titleText)) {
link.setAttribute(
'title',
[currentTitle, titleText].filter(Boolean).join(' | '),
);
}
if (img) img.setAttribute('alt', altText);
}
});
}
document.addEventListener('DOMContentLoaded', function () {
equalitySocialAndPhoneTitles();
const observer = new MutationObserver(equalitySocialAndPhoneTitles);
observer.observe(document.body, { childList: true, subtree: true });
});
})();
// Fix header links title atts
(function () {
function equalityHeaderTitles() {
const logo = document.querySelector('#header-left > a');
const headerLinks = document.querySelectorAll('#header-center-kdm > a');
if (logo) logo.setAttribute('title', 'לוגו האתר - מוביל לדף הבית');
if (headerLinks.length >= 3) {
headerLinks[0].setAttribute('title', 'המסעדות');
headerLinks[1].setAttribute('title', 'חנויות המפעל');
headerLinks[2].setAttribute('title', 'קייטרינג לאירועים');
}
}
document.addEventListener('DOMContentLoaded', function () {
setTimeout(equalityHeaderTitles, 1500);
const observer = new MutationObserver(() =>
setTimeout(equalityHeaderTitles, 500),
);
observer.observe(document.body, { childList: true, subtree: true });
});
})();