/* ========================================================= 🆕 v13 — AUTO-LABELING FOR TABLE CELLS WITH TWO SCRIPTS (PURE ADD) ========================================================= / (function() { function autoLabelCell(td) { if (td.querySelector('.script-label')) return; if (td.dataset.autoLabeled === '1') return; if (td.querySelector('.yes-highlight')) return; var html = td.innerHTML.trim(); var brPattern = /<br\s/?>\s*<br\s*/?>/i; if (!brPattern.test(html)) return; var parts = html.split(brPattern); if (parts.length !== 2) return; var script1Text = parts[0].trim(); var script2Text = parts[1].trim(); if (script1Text.length < 20 || script2Text.length < 20) return; td.innerHTML = 'Script 1' + '' + script1Text + '' + 'Script 2' + '' + script2Text + ''; td.dataset.autoLabeled = '1'; } function autoLabelAllTables(root) { var cells = (root || document).querySelectorAll('.flow-table td'); cells.forEach(autoLabelCell); } autoLabelAllTables(document); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { if (m.addedNodes && m.addedNodes.length) { m.addedNodes.forEach(function(node) { if (node.nodeType !== 1) return; if (node.tagName === 'TD' && node.closest('.flow-table')) { autoLabelCell(node); } if (node.querySelectorAll) { node.querySelectorAll('.flow-table td').forEach(autoLabelCell); } }); } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
/* ========================================================= 🆕 v9 — ONE-CLICK COPY BUTTONS FOR .script-block ELEMENTS ========================================================= */ (function() { var COPY_LABEL = '📋 Copy'; var COPIED_LABEL = '✓ Copied!'; var REVERT_MS = 2000; function copyTextToClipboard(text) { if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; ta.style.top = '-9999px'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch(e) {} document.body.removeChild(ta); return Promise.resolve(); } function getTextWithoutButton(el, btnSelector) { var clone = el.cloneNode(true); var btn = clone.querySelector(btnSelector); if (btn) btn.remove(); return (clone.innerText || clone.textContent || '').trim(); } function addCopyButton(scriptBlock) { if (scriptBlock.dataset.copyButtonReady === '1') return; scriptBlock.dataset.copyButtonReady = '1'; var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'copy-script-btn'; btn.textContent = COPY_LABEL; btn.setAttribute('aria-label', 'Copy script to clipboard'); btn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); if (typeof flagInteraction === 'function') flagInteraction(); if (typeof extendProtection === 'function') extendProtection(); if (window.resetAutoCloseTimer) window.resetAutoCloseTimer(); var text = getTextWithoutButton(scriptBlock, '.copy-script-btn'); copyTextToClipboard(text).then(function() { btn.textContent = COPIED_LABEL; btn.classList.add('copied'); setTimeout(function() { btn.textContent = COPY_LABEL; btn.classList.remove('copied'); }, REVERT_MS); }).catch(function() {}); }); scriptBlock.appendChild(btn); } function addButtonsToAllScripts(root) { var targets = (root || document).querySelectorAll('.script-block'); targets.forEach(addCopyButton); } addButtonsToAllScripts(document); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { if (m.addedNodes && m.addedNodes.length) { m.addedNodes.forEach(function(node) { if (node.nodeType !== 1) return; if (node.classList && node.classList.contains('script-block')) { addCopyButton(node); } if (node.querySelectorAll) { node.querySelectorAll('.script-block').forEach(addCopyButton); } }); } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
/* ========================================================= 🆕 v10 — ONE-CLICK COPY FOR BULLET LIST ITEMS ========================================================= */ (function() { var COPY_LABEL = '📋 Copy'; var COPIED_LABEL = '✓ Copied!'; var REVERT_MS = 2000; function copyTextToClipboard(text) { if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; ta.style.top = '-9999px'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch(e) {} document.body.removeChild(ta); return Promise.resolve(); } function getTextWithoutButton(el, btnSelector) { var clone = el.cloneNode(true); var btn = clone.querySelector(btnSelector); if (btn) btn.remove(); return (clone.innerText || clone.textContent || '').trim(); } function addCopyButtonToLi(li) { if (li.dataset.copyButtonReady === '1') return; li.dataset.copyButtonReady = '1'; li.style.position = 'relative'; li.style.paddingRight = '78px'; var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'copy-li-btn'; btn.textContent = COPY_LABEL; btn.setAttribute('aria-label', 'Copy to clipboard'); btn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); if (typeof flagInteraction === 'function') flagInteraction(); if (typeof extendProtection === 'function') extendProtection(); if (window.resetAutoCloseTimer) window.resetAutoCloseTimer(); var text = getTextWithoutButton(li, '.copy-li-btn'); copyTextToClipboard(text).then(function() { btn.textContent = COPIED_LABEL; btn.classList.add('copied'); setTimeout(function() { btn.textContent = COPY_LABEL; btn.classList.remove('copied'); }, REVERT_MS); }).catch(function() {}); }); li.appendChild(btn); } function addButtonsToAllLists(root) { var targets = (root || document).querySelectorAll('.bullet-list li'); targets.forEach(addCopyButtonToLi); } addButtonsToAllLists(document); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { if (m.addedNodes && m.addedNodes.length) { m.addedNodes.forEach(function(node) { if (node.nodeType !== 1) return; if (node.classList && node.classList.contains('bullet-list')) { node.querySelectorAll('li').forEach(addCopyButtonToLi); } if (node.tagName === 'LI' && node.closest('.bullet-list')) { addCopyButtonToLi(node); } if (node.querySelectorAll) { node.querySelectorAll('.bullet-list li').forEach(addCopyButtonToLi); } }); } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
/* ========================================================= 🆕 v11 — ONE-CLICK COPY FOR TABLE CELLS — 2ND COLUMN ONLY ✅ FIX 1 APPLIED: Skip cells that already have .script-block elements (those get per-script copy buttons from v9 instead) ========================================================= */ (function() { var COPY_LABEL = '📋 Copy'; var COPIED_LABEL = '✓ Copied!'; var REVERT_MS = 2000; function copyTextToClipboard(text) { if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; ta.style.top = '-9999px'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch(e) {} document.body.removeChild(ta); return Promise.resolve(); } function getTextWithoutAllButtons(el) { var clone = el.cloneNode(true); var allBtns = clone.querySelectorAll('.copy-td-btn, .copy-highlight-btn, .copy-li-btn, .copy-script-btn'); allBtns.forEach(function(b) { if (b && b.parentNode) b.parentNode.removeChild(b); }); var highlights = clone.querySelectorAll('.yes-highlight'); highlights.forEach(function(h) { if (h && h.parentNode) h.parentNode.removeChild(h); }); return (clone.innerText || clone.textContent || '').trim(); } function isSecondColumn(td) { return td.cellIndex === 1; } function addCopyButtonToTd(td) { if (td.dataset.copyButtonReady === '1') return; if (!isSecondColumn(td)) return;
// ✅ FIX 1: Skip cells that already have per-script buttons from v9 if (td.querySelector('.script-block')) return;
var textContent = (td.innerText || td.textContent || '').trim(); if (!textContent || textContent.length < 8) return; td.dataset.copyButtonReady = '1'; td.style.position = 'relative'; td.style.paddingRight = '78px'; var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'copy-td-btn'; btn.textContent = COPY_LABEL; btn.setAttribute('aria-label', 'Copy cell content to clipboard'); btn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); if (typeof flagInteraction === 'function') flagInteraction(); if (typeof extendProtection === 'function') extendProtection(); if (window.resetAutoCloseTimer) window.resetAutoCloseTimer(); var text = getTextWithoutAllButtons(td); copyTextToClipboard(text).then(function() { btn.textContent = COPIED_LABEL; btn.classList.add('copied'); setTimeout(function() { btn.textContent = COPY_LABEL; btn.classList.remove('copied'); }, REVERT_MS); }).catch(function() {}); }); td.appendChild(btn); } function addButtonsToAllTableCells(root) { var targets = (root || document).querySelectorAll('.flow-table td:nth-child(2)'); targets.forEach(addCopyButtonToTd); } addButtonsToAllTableCells(document); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { if (m.addedNodes && m.addedNodes.length) { m.addedNodes.forEach(function(node) { if (node.nodeType !== 1) return; if (node.classList && node.classList.contains('flow-table')) { node.querySelectorAll('td:nth-child(2)').forEach(addCopyButtonToTd); } if (node.tagName === 'TD' && node.closest('.flow-table')) { addCopyButtonToTd(node); } if (node.querySelectorAll) { node.querySelectorAll('.flow-table td:nth-child(2)').forEach(addCopyButtonToTd); } }); } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
/* ========================================================= 🆕 v12 — ONE-CLICK COPY FOR YES-HIGHLIGHT LIST ITEMS ========================================================= */ (function() { var COPY_LABEL = '📋 Copy'; var COPIED_LABEL = '✓ Copied!'; var REVERT_MS = 2000; function copyTextToClipboard(text) { if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; ta.style.top = '-9999px'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch(e) {} document.body.removeChild(ta); return Promise.resolve(); } function getTextWithoutButton(el, btnSelector) { var clone = el.cloneNode(true); var btn = clone.querySelector(btnSelector); if (btn) btn.remove(); return (clone.innerText || clone.textContent || '').trim(); } function addCopyButtonToHighlightLi(li) { if (li.dataset.copyButtonReady === '1') return; li.dataset.copyButtonReady = '1'; li.style.position = 'relative'; li.style.paddingRight = '78px'; var btn = document.createElement('button'); btn.type = 'button'; btn.className = 'copy-highlight-btn'; btn.textContent = COPY_LABEL; btn.setAttribute('aria-label', 'Copy to clipboard'); btn.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); if (typeof flagInteraction === 'function') flagInteraction(); if (typeof extendProtection === 'function') extendProtection(); if (window.resetAutoCloseTimer) window.resetAutoCloseTimer(); var text = getTextWithoutButton(li, '.copy-highlight-btn'); copyTextToClipboard(text).then(function() { btn.textContent = COPIED_LABEL; btn.classList.add('copied'); setTimeout(function() { btn.textContent = COPY_LABEL; btn.classList.remove('copied'); }, REVERT_MS); }).catch(function() {}); }); li.appendChild(btn); } function addButtonsToAllHighlightLists(root) { var targets = (root || document).querySelectorAll('.yes-highlight li'); targets.forEach(addCopyButtonToHighlightLi); } addButtonsToAllHighlightLists(document); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { if (m.addedNodes && m.addedNodes.length) { m.addedNodes.forEach(function(node) { if (node.nodeType !== 1) return; if (node.classList && node.classList.contains('yes-highlight')) { node.querySelectorAll('li').forEach(addCopyButtonToHighlightLi); } if (node.tagName === 'LI' && node.closest('.yes-highlight')) { addCopyButtonToHighlightLi(node); } if (node.querySelectorAll) { node.querySelectorAll('.yes-highlight li').forEach(addCopyButtonToHighlightLi); } }); } }); }); observer.observe(document.body, { childList: true, subtree: true }); })();
/* ========================================================= 🆕 v14 — HOTLINE DIRECTORY: CLICK-TO-COPY + TOAST + GRID ALIGNMENT ========================================================= */ (function() { function copyTextToClipboard(text) { if (navigator.clipboard && navigator.clipboard.writeText) { return navigator.clipboard.writeText(text); } var ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; ta.style.top = '-9999px'; document.body.appendChild(ta); ta.select(); try { document.execCommand('copy'); } catch(e) {} document.body.removeChild(ta); return Promise.resolve(); }
function showToast(message) { var existing = document.getElementById('hl-copy-toast'); if (existing) existing.remove(); var toast = document.createElement('div'); toast.id = 'hl-copy-toast'; toast.className = 'hl-copy-toast'; toast.textContent = message; document.body.appendChild(toast); toast.offsetHeight; toast.classList.add('show'); setTimeout(function() { toast.classList.remove('show'); setTimeout(function() { if (toast.parentNode) toast.parentNode.removeChild(toast); }, 300); }, 1800); }
function bindHotlineCopy() { var numbers = document.querySelectorAll('.hl-phone'); numbers.forEach(function(num) { if (num.dataset.copyBound === '1') return; num.dataset.copyBound = '1'; num.style.cursor = 'pointer'; num.addEventListener('click', function(e) { e.preventDefault(); e.stopPropagation(); if (typeof flagInteraction === 'function') flagInteraction(); if (typeof extendProtection === 'function') extendProtection(); if (window.resetAutoCloseTimer) window.resetAutoCloseTimer(); var text = (this.textContent || '').trim(); copyTextToClipboard(text).then(function() { showToast('✓ Copied: ' + text); }).catch(function() {}); }); }); }
bindHotlineCopy(); })();
/* ========================================================= 🆕 MNL CLOCK — Real-time Manila Date & Time ========================================================= */ (function updateMNLClock() { function pad(n) { return n < 10 ? '0' + n : n; } function getMNLTime() { var now = new Date(); var options = { timeZone: 'Asia/Manila' }; var mnl = new Date(now.toLocaleString('en-US', options)); var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; var dayName = days[mnl.getDay()]; var monthName = months[mnl.getMonth()]; var date = mnl.getDate(); var year = mnl.getFullYear(); var h = mnl.getHours(); var m = mnl.getMinutes(); var s = mnl.getSeconds(); var ampm = h >= 12 ? 'PM' : 'AM'; var h12 = h % 12; h12 = h12 ? h12 : 12; var dateStr = dayName + ', ' + monthName + ' ' + date + ', ' + year; var timeStr = pad(h12) + ':' + pad(m) + ':' + pad(s) + ' ' + ampm + ' MNL'; return { date: dateStr, time: timeStr }; } function renderClock() { var clockEl = document.getElementById('mnl-clock'); if (!clockEl) return; var t = getMNLTime(); clockEl.innerHTML = '' + t.time + '' + t.date + ''; } renderClock(); setInterval(renderClock, 1000); })();
});