Fu Jen Catholic University Dormitory Fees
https://dsc.fju.edu.tw/resource.jsp?labelID=19
Fu Jen Catholic University Dormitory Fees
document.addEventListener('DOMContentLoaded', () => {
// 若處於編輯器環境則停止執行,避免影響後台編輯
if (document.body.classList.contains('elementor-editor-active')) return;
// 定義標籤對應的獨立頁面網址
const innerPageUrls = {
'最新公告': '/最新公告/',
'招生公告': '/招生公告/',
'一般公告': '/一般公告/',
'獎助學金': '/獎助學金/',
'學術活動': '/學術活動/',
'新生專區': '/新生專區/',
'榮譽榜': '/榮譽榜/',
'徵才': '/徵才/',
'實習': '/實習/'
};
// 檢查點擊的文字是否包含在對應表中
function getTargetUrl(text) {
if (!text) return null;
for (const [key, url] of Object.entries(innerPageUrls)) {
if (text.includes(key)) {
return url;
}
}
return null;
}
// 全域點擊事件攔截器
const globalTagInterceptor = (e) => {
const link = e.target.closest('.elementor-widget-post-info a, [class*="post-info"] a, .elementor-icon-list-item a');
if (!link) return;
const destination = getTargetUrl(link.textContent);
if (destination) {
// 檢查是否為開新分頁操作 (滑鼠中鍵或 Ctrl/Cmd 點擊)
const isNewTabClick = e.button === 1 || e.ctrlKey || e.metaKey;
if (!isNewTabClick) {
// 若為一般左鍵點擊,則攔截預設行為並執行跳轉
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
window.location.href = destination;
}
}
};
// 綁定全域點擊事件,使用捕獲階段 (true)
document.addEventListener('click', globalTagInterceptor, true);
// 同步更新 href 屬性以符合對應網址
function syncHrefAttributes() {
const links = document.querySelectorAll('.elementor-widget-post-info a, [class*="post-info"] a, .elementor-icon-list-item a');
links.forEach(link => {
const destination = getTargetUrl(link.textContent);
if (destination && !link.getAttribute('href').endsWith(destination)) {
link.setAttribute('href', destination);
}
});
}
syncHrefAttributes();
// 設定定時器,每 300 毫秒執行一次 href 同步,避免 Elementor 動態覆寫
setInterval(syncHrefAttributes, 300);
});
document.addEventListener('DOMContentLoaded', () => {
// 內頁相容性標準解鎖邏輯
document.body.classList.add('tabs-ready');
document.body.classList.remove('is-loading-tab');
});
