diff --git a/assets/images/titleicon.png b/assets/images/titleicon.png index 36a3add..fb7b7ae 100644 Binary files a/assets/images/titleicon.png and b/assets/images/titleicon.png differ diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 6fd8285..09a26b3 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -278,7 +278,13 @@ $('.mobile-menu').toggleClass('active'); $('body').toggleClass('noscroll'); - $('.mobile-menu .navbar-toggle').removeClass('collapsed'); + + // ★ 修正:依據 active 狀態決定 collapsed 的加/移除 + if ($('.mobile-menu').hasClass('active')) { + $('.mobile-menu .navbar-toggle').removeClass('collapsed'); // 打開 → 叉叉 + } else { + $('.mobile-menu .navbar-toggle').addClass('collapsed'); // 關閉 → 三條橫線 + } // 關閉所有下拉選單 $('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500); @@ -292,6 +298,34 @@ } }); + // ✅ Tab 鍵跳過 .mobile-menu 時,觸發收合邏輯 + $(document).on('focusout', '.mobile-menu', function(e) { + setTimeout(function() { + var $newFocus = $(document.activeElement); + + // 焦點在 body 時代表滑鼠正在點擊中,不處理 + if ($newFocus.is('body')) return; + + if ($('.mobile-menu').hasClass('active') && $newFocus.closest('.mobile-menu').length === 0) { + + var $btn = $('.navbar-toggle').first(); + + if ($btn.attr('data-bs-toggle')) { + var target = $btn.attr('data-bs-target'); + var bsCollapse = window.bootstrap && bootstrap.Collapse.getInstance($(target)[0]); + if (bsCollapse) bsCollapse.hide(); + $('.mobile-menu').removeClass('active'); + $('body').removeClass('noscroll'); + $('.mobile-menu .navbar-toggle').addClass('collapsed'); + $('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500); + $('.mobile-menu1 > .menu-drop, .mobile-menu2 > .menu-drop').removeClass('opened'); + } else { + $btn.trigger('click'); + } + } + }, 50); + }); + $('.mobile-menu1 > .menu-drop').click(function(){ var $that = $(this); var opencheck1 = $that.hasClass('opened'); @@ -452,20 +486,28 @@ }); //播放驗證碼語音 $(function () { - $('.ask-question') - .find('.controls button.fas.fa-volume-up') - .each(function () { - const $btn = $(this); + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + var label = isEn ? 'Play Captcha Voice' : '播放驗證碼語音'; - // 已經補過就不重複處理 - if ($btn.attr('aria-label')) return; + $('.ask-question') + .find('.controls button.fas.fa-volume-up') + .each(function () { + var $btn = $(this); - $btn.attr({ - 'aria-label': '播放驗證碼語音', - 'aria-controls': 'captcha_audio', - 'role': 'button' - }); - }); + $btn.attr({ + 'aria-label': label, + 'title': label, + 'aria-controls': 'captcha_audio', + 'role': 'button' + }); + + // ✅ 同步更新 sr-only 文字(若有) + var $sr = $btn.find('.sr-only'); + if ($sr.length > 0) { + $sr.text(label); + } + }); }); //刪除td的id @@ -760,13 +802,14 @@ $(document).ready(function() { removeEmptyTitles(); }); - $(".w-annc__img-wrap a").each(function () { - var $this = $(this); - // 確保 內沒有文字節點 (避免重複添加) - if ($this.text().trim() === "") { - $this.append('公告圖片'); - } - }); + + // $(".w-annc__img-wrap a").each(function () { + // var $this = $(this); + // // 確保 內沒有文字節點 (避免重複添加) + // if ($this.text().trim() === "") { + // $this.append('公告圖片'); + // } + // }); $(".widget-link__widget-title").each(function () { if ($(this).text().trim() === "") { $(this).append('公告標題'); @@ -835,7 +878,7 @@ var isLinkImage = $parentA.length > 0 && $parentA.text().replace(/\u00a0/g, '').trim() === ""; // --- 1. 處理「裝飾性圖片」標註 --- - if (currentAlt === "裝飾圖片" || currentTitle === "裝飾圖片") { + if (currentAlt === "announcement image" || currentAlt === "裝飾圖片" || currentTitle === "裝飾圖片" || currentAlt === "這是一張圖片" || currentTitle === "這是一張圖片"||currentAlt === "This is a image" ||currentTitle === "This is a image"){ $img.attr('alt', ''); $img.removeAttr('title'); return; @@ -880,197 +923,377 @@ setTimeout(fixImageAccessibility, 500); }); - // 有連結目的之所有a標籤的無障礙處理 - $(function() { - /** - * 全站無障礙 AA 級補強 (多語系偵測版) - */ - function fixAccessibilityAll() { - // --- 0. 網址參數判斷 --- - var urlParams = new URLSearchParams(window.location.search); - var isEditMode = urlParams.get('editmode') === 'on'; - var pageLang = $('html').attr('lang') || 'zh-Hant'; - var isEn = pageLang.toLowerCase().startsWith('en'); +// 有連結目的之所有a標籤的無障礙處理 +$(function() { + // Bootstrap 會把原始 title 搬到 data-bs-original-title,先還原回來 + $('a[data-bs-original-title]').each(function() { + var $a = $(this); + var originalTitle = $a.attr('data-bs-original-title'); + if (originalTitle && originalTitle.trim() !== '') { + $a.attr('title', originalTitle); + } + }); - var i18n = { - langBtn: isEn ? 'Open language menu in this window' : '在本視窗開啟語言選單', - newWin: isEn ? '(Open in new window)' : '(在新視窗開啟)', - selfWin: isEn ? '(Open in this window)' : '(在本視窗開啟)', - link: isEn ? 'Link' : '連結' - }; + /** + * 全站無障礙 AA 級補強 (整合 HM1240400C 與 HM1240401C 規範) + */ + function fixAccessibilityAll() { + // --- 0. 環境與語言偵測 --- + //1200ms 後執行(確保所有其他 function 執行完畢後才處理) + //Part 1:修正語言選單按鈕 + //Part 2:掃描所有 + //├─ 排除 navbar-brand、javascript: 連結 + //├─ 空連結 → 隱藏 + //├─ 文字是路徑/空 → 補隱藏 span + //├─ 圖片+文字共存 → 圖片 alt 清空 + //├─ 無 title → 自動產出 title + //├─ 有 title 但與連結文字或圖片 alt 重複 → 只保留開窗提示 + //├─ 有 title 出現空括號 () → 清除並補上正確開窗提示 + //└─ 移除 aria-label + var urlParams = new URLSearchParams(window.location.search); + var isEditMode = urlParams.get('editmode') === 'on'; - // --- Part 1: 語言選單修正 --- - var $langBtn = $('#languagebutton'); - if ($langBtn.length > 0) { - $langBtn.attr('title', i18n.langBtn); - $langBtn.removeAttr('aria-label'); - } + var pageLang = $('html').attr('lang') || 'zh-Hant'; + var isEn = pageLang.toLowerCase().startsWith('en'); - // --- Part 2: 全站連結處理 --- - $('a').each(function() { - var $a = $(this); - var href = ($a.attr('href') || '').toLowerCase(); - if (!href || href.startsWith('javascript:')) return; + var i18n = { + langBtn: isEn ? 'Open language menu in this window' : '在本視窗開啟語言選單', + newWin: isEn ? 'Open in new window' : '在新視窗開啟', + selfWin: isEn ? 'Open in this window' : '在本視窗開啟', + link: isEn ? 'Link' : '連結', + openImg: isEn ? 'Open image' : '開啟圖片內容', + sort: isEn ? 'Sort' : '排序' + }; - // 清理   與 空白 - var linkText = $a.text().replace(/\u00a0/g, '').trim(); - var $img = $a.find('img'); - var currentTitle = ($a.attr('title') || '').trim(); - - // --- 【新增修正:隱藏空連結】 --- - // 若網址沒有 editmode=on 時,判定 a 裡面文字為空且沒有圖片,則隱藏 - if (!isEditMode && linkText === "" && $img.length === 0) { - $a.hide(); - return; // 跳過後續處理 - } + // --- Part 1: 語言選單修正 --- + var $langBtn = $('#languagebutton'); + if ($langBtn.length > 0) { + $langBtn.attr('title', i18n.langBtn); + $langBtn.removeAttr('aria-label'); + } - // A. 視窗動作規範 - var isNewWindow = ($a.attr('target') === '_blank'); - var windowTask = isNewWindow ? i18n.newWin : i18n.selfWin; + // --- Part 2: 全站連結與圖片邏輯處理 --- + $('a').each(function() { + var $a = $(this); - // B. 偵測檔案類型 - var fileExt = ""; - var fileMatches = href.match(/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|odt|ods|odp|zip|rar|jpg|png|csv)$/); - if (fileMatches) { - fileExt = fileMatches[1].toLowerCase(); - } - - // C. 智慧修正與標題補充 - var hasBadSymbol = currentTitle.includes('()') || - currentTitle.includes('另開新視窗') || - currentTitle.includes('Open in new window'); - - if (linkText === "" && $img.length > 0) { - // 【純圖片連結】替代文字邏輯 - var rawAlt = ($img.attr('alt') || '').trim(); - var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', '']; - var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; }) - ? ($a.attr('aria-label') || i18n.link) : rawAlt; - - var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : ''; - - // 確保具備標題與圖片 alt - $a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim()); - $img.attr('alt', imgAlt); - } - else if (linkText !== "") { - // 【有文字連結】 - if (fileExt !== "" || hasBadSymbol || currentTitle === "") { - var isTag = $a.hasClass('label') || $a.hasClass('tag') || $a.find('[class*="tag"]').length > 0; - - if (fileExt !== "") { - $a.attr('title', linkText + " ." + fileExt + " " + windowTask); - } else if (linkText.length <= 6 || isTag) { - $a.attr('title', linkText + " " + windowTask); - } else { - $a.attr('title', windowTask); - } - } - } - - // --- 修正後的 Part D 最終清理 --- - $a.removeAttr('aria-label'); - - // 只有當「真正可見的文字」存在時,才將圖片設為裝飾性 - // 使用 clone() 移除隱藏元件後再計算文字,確保準確度 - var visibleText = $a.clone().find(':hidden, style, script').remove().end().text().replace(/\u00a0/g, '').trim(); - - if (visibleText !== "" && $img.length > 0) { - $img.attr('alt', ''); - } else { - // 如果文字是隱藏的 (如你的範例),則必須保留或補強圖片 alt - var rawAlt = ($img.attr('alt') || '').trim(); - if (rawAlt === "") { - // 如果連圖片 alt 都沒寫,就從 a 的 title 抓 - var cleanTitle = currentTitle.replace(/\(在本視窗開啟\)|\(在新視窗開啟\)/g, '').trim(); - $img.attr('alt', cleanTitle || i18n.link); - } - } - }); + // 【條件 1:排除特定 class】 + if ($a.hasClass('navbar-brand')) { + return; } - setTimeout(function() { - fixAccessibilityAll(); - }, 600); + var href = ($a.attr('href') || '').toLowerCase(); + if (!href || href.startsWith('javascript:')) return; + + // --- 關鍵修正:先偵測是否有原始 title --- + var rawTitleAttr = $a.attr('title'); + var hasOriginalTitle = (typeof rawTitleAttr !== 'undefined' && rawTitleAttr !== false && rawTitleAttr.trim() !== ""); + + // 清理   與 空白 + var linkText = $a.text().replace(/\u00a0/g, '').trim(); + var $img = $a.find('img'); + var $icons = $a.find('i, svg'); + var currentTitle = ($a.attr('title') || '').trim(); + + // ✅ 在 D 區塊清空 alt 之前,先記錄圖片原始 alt + var imgAltOriginal = $img.length > 0 ? ($img.attr('alt') || '').trim() : ''; + + // --- 【修正 1:隱藏空連結】 --- + if (!isEditMode && linkText === "" && $img.length === 0 && $icons.length === 0) { + $a.hide(); + return; + } + + // --- 【修正 2:文字語意防禦】 --- + if ((linkText === "" || linkText.startsWith('/') || linkText.includes('?')) && $img.length === 0 && $icons.length === 0) { + var accessibleText = i18n.link; + if (href.includes('sort')) { + accessibleText = i18n.sort; + } + + var $span = $a.find('span'); + if ($span.length > 0) { + $span.text(accessibleText); + } else { + $a.append('' + accessibleText + ''); + $span = $a.find('span').last(); + } + + $span.css({ + 'display': 'inline-block', 'position': 'absolute', 'width': '1px', 'height': '1px', + 'padding': '0', 'margin': '-1px', 'overflow': 'hidden', 'clip': 'rect(0, 0, 0, 0)', + 'white-space': 'nowrap', 'border': '0' + }); + linkText = accessibleText; + } + + // A. 視窗動作規範 + var isNewWindow = ($a.attr('target') === '_blank'); + var windowTask = isNewWindow ? i18n.newWin : i18n.selfWin; + + // B. 偵測檔案類型 + var fileExt = ""; + var fileMatches = href.match(/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|odt|ods|odp|zip|rar|jpg|png|csv)$/); + if (fileMatches) { + fileExt = fileMatches[1].toLowerCase(); + } + + // C. 智慧修正標題判斷 + var hasBadSymbol = currentTitle.includes('()') || + currentTitle.includes('Open in new window') || + currentTitle.includes('/uploads/'); + + if (currentTitle.startsWith('/') || currentTitle.includes('?')) { + currentTitle = ""; + } + + // D. 處理【HM1240400C】:圖片與文字毗鄰時,替代文字只能有一份 + if (($img.length > 0 || $icons.length > 0) && linkText !== "") { + if ($img.length > 0) { + $img.attr('alt', ''); + } + + var $hiddenSpans = $a.find('span').filter(function() { + return $(this).css('display') === 'none' || $(this).attr('style')?.includes('display: none'); + }); + + if ($hiddenSpans.length > 0) { + $hiddenSpans.each(function() { + var $span = $(this); + if ($span.text().includes('/uploads/')) { + $span.text(i18n.openImg); + } + + $span.css({ + 'display': 'inline-block', + 'position': 'absolute', + 'width': '1px', + 'height': '1px', + 'padding': '0', + 'margin': '-1px', + 'overflow': 'hidden', + 'clip': 'rect(0, 0, 0, 0)', + 'white-space': 'nowrap', + 'border': '0' + }); + }); + } + } + + // E. 重新計算標題 (關鍵邏輯:若 hasOriginalTitle 為真,則不進入此區塊) + if (!hasOriginalTitle) { + if (linkText === "" && $img.length > 0) { + var rawAlt = ($img.attr('alt') || '').trim(); + var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', '']; + var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; }) + ? ($a.attr('aria-label') || i18n.link) : rawAlt; + + var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : ''; + $a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim()); + $img.attr('alt', imgAlt); + } + else if (linkText !== "") { + if (fileExt !== "" || hasBadSymbol || currentTitle === "" || currentTitle.includes('/uploads/')) { + if (fileExt !== "") { + $a.attr('title', linkText + " ." + fileExt + " " + windowTask); + } else { + $a.attr('title', windowTask); + } + } + } + } + + // ✅ 符合 HM1240404E:title 不應與連結文字或圖片 alt 重複 + if (hasOriginalTitle && currentTitle !== "") { + var titleWithoutWindow = currentTitle + .replace('(在本視窗開啟)', '') + .replace('(在新視窗開啟)', '') + .replace('Open in this window', '') + .replace('Open in new window', '') + .replace('另開新視窗前往', '') + .replace('另開新視窗', '') + .trim(); + + // ✅ title 去掉開窗字串後,若與連結文字或圖片原始 alt 相同,則只保留開窗提示 + // ✅ 新增:若 linkText 包含副檔名且 title 也是同樣檔名,也只保留開窗提示 + if ( + (titleWithoutWindow === linkText && linkText !== i18n.link) || + (imgAltOriginal !== '' && titleWithoutWindow === imgAltOriginal) || + (fileExt !== '' && linkText.toLowerCase().endsWith('.' + fileExt) && titleWithoutWindow === linkText) + ) { + $a.attr('title', windowTask); + return; // ✅ 加上 return,避免繼續執行後面的清理邏輯造成二次污染 + } + + // ✅ 最終清理:若 title 出現空括號 () 則移除並補上正確開窗提示 + var finalTitle = ($a.attr('title') || '').trim(); + if (finalTitle.includes('()')) { + finalTitle = finalTitle.replace(/\(\)/g, '').trim(); + $a.attr('title', finalTitle + ' ' + windowTask); + } + } + + // F. 最終清理:移除冗餘 label,避免螢幕閱讀器唸兩次 + $a.removeAttr('aria-label'); }); - // if (location.href.search('editmode=on') === -1) { - // // 1. 處理圖片 alt 重複問題 (保持原邏輯但優化) - // $('a').has('img').each(function () { - // const $link = $(this); - // const linkText = $link.text().trim(); + // ✅ G. 補強特定連結(須在迴圈外,因為 javascript: 連結被迴圈跳過) + $('.btn-o a').each(function() { + var $a = $(this); + if (!$a.attr('target')) { + $a.attr('target', '_blank'); + $a.attr('rel', 'noopener noreferrer'); + } + $a.attr('title', isEn ? 'Share to X Open in new window' : '分享至 X 在新視窗開啟'); + }); - // $link.find('img').each(function () { - // const $img = $(this); - // const altText = $img.attr('alt')?.trim(); + $('.print-button a').each(function() { + var $a = $(this); + if (!$a.attr('title') || $a.attr('title').trim().toLowerCase() === 'print') { + $a.attr('title', isEn ? 'Print this page' : '列印此頁'); + } + }); - // if (altText && altText === linkText) { - // $img.attr('alt', ''); - // } - // }); - // }); - // } - $(function() { - function smartFixIcons() { - $('i').each(function() { - var $icon = $(this); - var $parent = $icon.parent(); + $('a.i-archive__file-name').each(function () { + var $a = $(this); + var isNewWindow = ($a.attr('target') === '_blank'); + $a.attr('title', isNewWindow ? i18n.newWin : i18n.selfWin); + }); + } - // 1. 基本安全:所有圖示先對螢幕閱讀器隱藏 (避免讀出 Unicode 亂碼) - $icon.attr('aria-hidden', 'true'); + // ✅ 延遲 800ms 確保所有其他 function 執行完畢後才處理 + setTimeout(function() { + fixAccessibilityAll(); + }, 800); +}); - // 2. 檢查:如果已經有 aria-label 或旁邊已有 sr-only,就不重複處理 - if ($icon.attr('aria-label') || $icon.next('.sr-only').length > 0 || $parent.find('.sr-only').length > 0) { - return; - } + +$(function() { + function smartFixIcons() { + var isEn = $('html').attr('lang') === 'en'; - var cls = ($icon.attr('class') || '').toLowerCase(); - var labelText = ''; + var labels = { + calendar : isEn ? 'Date: ' : '日期:', + user : isEn ? 'Author: ' : '發布者:', + tag : isEn ? 'Tag: ' : '標籤:', + clock : isEn ? 'Time: ' : '時間:', + location : isEn ? 'Location: ' : '地點:', + phone : isEn ? 'Phone: ' : '電話:', + envelope : isEn ? 'Email: ' : '信箱:', + folder : isEn ? 'Category: ' : '分類:', + eye : isEn ? 'Views: ' : '瀏覽次數:', + download : isEn ? 'Download: ' : '下載檔案:', + search : isEn ? 'Search' : '搜尋', + bars : isEn ? 'Menu' : '選單', + print : isEn ? 'Print this page' : '列印此頁', + share : isEn ? 'Share' : '分享至社群', + close : isEn ? 'Close window' : '關閉視窗', + closePopup : isEn ? 'Close announcement' : '關閉公告視窗', + closeGallery: isEn ? 'Close gallery' : '關閉相簿', + toggleDesc : isEn ? 'Show or hide image description' : '顯示或隱藏圖片說明', + themeSwitch : isEn ? 'Switch gallery theme': '切換相簿主題', + showOriginal: isEn ? 'Show original image' : '顯示原始圖片' + }; - // --- 策略 A:常見資訊型圖示 (自動識別內容意義) --- - if (cls.includes('calendar')) labelText = '日期:'; - else if (cls.includes('user') || cls.includes('male')) labelText = '發布者:'; - else if (cls.includes('tag')) labelText = '標籤:'; - else if (cls.includes('clock') || cls.includes('time')) labelText = '時間:'; - else if (cls.includes('map-marker') || cls.includes('location')) labelText = '地點:'; - else if (cls.includes('phone')) labelText = '電話:'; - else if (cls.includes('envelope') || cls.includes('mail')) labelText = '信箱:'; - else if (cls.includes('folder')) labelText = '分類:'; - else if (cls.includes('eye')) labelText = '瀏覽次數:'; - else if (cls.includes('download')) labelText = '下載檔案:'; - - // --- 策略 B:功能性按鈕 (如果 i 放在 或 - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); + function fixCaptchaImgA11y() { + setTimeout(function () { + // ✅ 先確認頁面上真的有驗證碼圖片,再往下執行 + if (!$('.rucaptcha-image').length) return; + + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + alt: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換', + title: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換', + label: isEn ? 'Click to refresh captcha' : '點擊更換驗證碼', + audioBtn: isEn ? 'Play captcha audio' : '播放驗證碼語音', + audioSrc: isEn ? '/rucaptcha/?format=wav&locale=en' : '/rucaptcha/?format=wav&locale=zh_tw' + }; + + var $captchaImg = $('.rucaptcha-image'); + + // ✅ 移除 onload + $captchaImg.removeAttr('onload'); + + // ✅ 補上有意義的 alt、role、tabindex、title + $captchaImg.attr({ + 'alt': i18n.alt, + 'title': i18n.title, + 'role': 'button', + 'tabindex': '0', + 'aria-label': i18n.label + }); + + // ✅ Enter / Space 觸發更換驗證碼 + $captchaImg.off('keydown.captchaA11y').on('keydown.captchaA11y', function (e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + $(this).trigger('click'); + } + }); + + // ✅ 插入語音按鈕和 audio(若還沒插入過) + if (!$('#captcha_audio').length) { + var $audioButton = $( + '' + ); + + var $audio = $(''); + + $captchaImg.after($audioButton, $audio); + } + + }, 500); } + + fixCaptchaImgA11y(); }); //萬用表格searchbtn2 @@ -1723,6 +2136,14 @@ // if($('.show-announcement').hasClass('show-announcement')) { // $('.').css('', ''); // } + $(function() { + var $headerNav = $('.header-nav'); + $headerNav.contents().each(function() { + if (this.nodeType === 3 && this.nodeValue.trim() === '|') { + $(this).remove(); + } + }); + }); if($('.s-annc').length){ $(".carousel_images h4").remove(); @@ -1737,25 +2158,7 @@ // }); } $('.s-annc__tag-wrap ').after($('.s-annc__post-orbithashtags')); - $('a').each(function () { - const $a = $(this); - // 有圖示或圖片就不刪 - if ($a.find('i, img').length > 0) return; - - // 沒有任何實際文字內容(去除空白) - const hasVisibleText = $a.text().trim().length > 0; - - // 進一步判斷 span 內部是否完全為空 - const allChildrenEmpty = $a.children().length > 0 && $a.children().toArray().every(child => { - return $(child).text().trim().length === 0; - }); - - // 如果沒有文字內容且子元素全為空,則移除 - if (!hasVisibleText && allChildrenEmpty) { - $a.remove(); - } - }); $('.i-member-pic-wrap a').removeAttr('target'); function markCheckStatusButton() { $('.ask-question').each(function () { @@ -1872,6 +2275,11 @@ }else{ $('.navbar-header').before($('.header-nav')); }; + // if ($(window).width() <769) { + // $('.leftnav').append($('.header-nav')); + // }else{ + // $('.leftnav').append($('.header-nav')); + // }; $('.sitemenu-vertical .sitemenu-dropdown-toggle').click(function(){ $('.sitemenu-vertical .dropdown-menu').slideToggle(); $(".sitemenu-vertical .sitemenu-dropdown-toggle").toggleClass("fa-caret-down"); @@ -1939,6 +2347,11 @@ }else{ $('.navbar-header').before($('.header-nav')); }; + // if ($(window).width() <769) { + // $('.leftnav').append($('.header-nav')); + // }else{ + // $('.leftnav').append($('.header-nav')); + // }; if ($(window).width() > 821) { $('.form-horizontal').append($('.cancelbooking')); @@ -2002,118 +2415,276 @@ init(); }); - //orbitbar無障礙js - $(document).ready(function() { - const isEnglish = document.documentElement.lang === 'en'; +// 1. OrbitBar 基礎與搜尋選單邏輯 +$(document).ready(function() { + const isEn = document.documentElement.lang === 'en'; + const $orbitLabel = $('label[for="open-orbit-nav"]'); + const $searchArea = $('.orbit-bar-search-sign-language'); + const $firstInput = $('#q'); // 搜尋框通常是選單內第一個獲焦元素 - if (isEnglish) { - $('.navbar-toggle').attr({ - title: 'menu', - 'aria-label': 'menu' - }); - $('label[for="open-orbit-nav"]').attr({ - title: 'Site search and language menu', - 'aria-label': 'Site search and language menu' - }); - $('.mobile-button').attr({ - title: 'Language menu', - 'aria-label': 'Language menu' - }); - } else { - $('label[for="open-orbit-nav"]').attr({ - title: '全站収尋及語言切換選單', - 'aria-label': '全站収尋及語言切換選單' - }); - $('.mobile-button').attr({ - title: '語言切換選單', - 'aria-label': '語言切換選單' - }); - } - + // 初始化屬性 + if (isEn) { + $orbitLabel.attr({ title: 'Site search and language menu', 'aria-label': 'Site search and language menu' }); + } else { + $orbitLabel.attr({ title: '全站搜尋及語言切換選單', 'aria-label': '全站搜尋及語言切換選單' }); + } + $orbitLabel.attr({ 'role': 'button', 'aria-haspopup': 'true', 'aria-expanded': 'false', 'tabindex': '0' }); - $('label[for="open-orbit-login"]').removeAttr('tabindex'); - $('#orbit-bar').find('li').each(function() { - var $li = $(this); - - // 如果
  • 中没有 元素,则为
  • 设置 tabindex="0" - if ($li.children('a').length === 0) { - $li.attr('tabindex', '0'); - } else { - // 如果
  • 中有 元素,则确保 有 tabindex="0" - $li.find('a').attr('tabindex', '0'); - - // 确保
  • 不影响焦点管理,移除
  • 的 tabindex - $li.removeAttr('tabindex'); - - // 如果
  • 被聚焦,自动跳转到 元素 - $li.on('focus', function() { - $(this).find('a').focus(); - }); - } - }); - $('label[for="open-orbit-nav"]').attr('tabindex', '0'); - // 当屏幕宽度小于 768px 时,将 .orbit-bar-search-sign-language 移动到 + // 桌面版 + 手機版都處理 + // ============================================= + var $activeLis = $langUl.find('li.active') + .add($('#language-li-ul').find('li.active')); - $('#language-li').on('focus', function() { - // 给 #language 内部的 ul 元素添加 show 类 - $(this).find('ul').addClass('show'); - }); - $('#language-li ul > li:last-child>a').on('blur', function() { - $('#language-li ul').removeClass('show'); - $('.orbit-bar-search-sign-language').removeClass('show'); - }); - $('label[for="open-orbit-login"]').on('blur', function() { - $('.orbit-bar-search-sign-language').removeClass('show'); - }); - $('#gotocenter').on('focus', function() { - // 当 #gotocenter 被选中时,移除 .orbit-bar-search-sign-language 上的 show 类 - $('.orbit-bar-search-sign-language').removeClass('show'); - }); - $('label[for="open-orbit-nav"]').on('click', function() { - // 切換 .orbit-bar-search-sign-language 的 .show 類別 - $('.orbit-bar-search-sign-language').removeClass('show'); - }); - $('li[tabindex="0"]').each(function () { - const $li = $(this); - if ($li.find('input').length > 0) { - $li.removeAttr('tabindex'); + $activeLis.each(function() { + var $li = $(this); + if ($li.find('a, button').length === 0) { + var activeText = $li.text().trim(); + $li.html( + '' + + activeText + + '' + ); + } + }); + + // ============================================= + // Desktop 語言按鈕 + // ============================================= + if ($desktopBtn.length > 0) { + $desktopBtn.attr({ + 'aria-expanded': 'false', + 'role': 'button', + 'aria-haspopup': 'true', + 'title': correctTitle + }); + $desktopBtn.removeAttr('aria-label'); + + function openLangMenu() { + $langUl.addClass('show'); + $desktopBtn.attr('aria-expanded', 'true'); + $('.orbit-bar-search-sign-language').addClass('show'); + } + function closeLangMenu() { + $langUl.removeClass('show'); + $desktopBtn.attr('aria-expanded', 'false'); + } + + // 原有:focus 展開 + $desktopBtn.on('focus', function() { + openLangMenu(); + }); + + // ✅ 新增 GN1210100E:Enter / Space 切換、Escape 收合 + $desktopBtn.on('keydown', function(e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + $langUl.hasClass('show') ? closeLangMenu() : openLangMenu(); + } + if (e.which === 27) { + closeLangMenu(); + $desktopBtn.focus(); + } + }); + + // 原有:click 切換 + $desktopBtn.on('click', function(e) { + e.preventDefault(); + $langUl.hasClass('show') ? closeLangMenu() : openLangMenu(); + }); + + // ✅ 新增:選單內 Escape 跳回按鈕 + $langUl.find('a').on('keydown', function(e) { + if (e.which === 27) { + e.preventDefault(); + closeLangMenu(); + $desktopBtn.focus(); + } + }); + + // 原有:焦點離開整個 language-li 時收合 + $langLi.on('focusout', function() { + var $container = $(this); + setTimeout(function() { + if (!$container.is(':focus-within')) { + closeLangMenu(); + } + }, 150); + }); } - }); - - }); + + // ============================================= + // 手機版選單補強(原有邏輯完整保留) + // ============================================= + var $mobileBtn = $('.mobile-button'); + if ($mobileBtn.length > 0) { + $mobileBtn.attr({ 'role': 'button', 'tabindex': '0', 'aria-haspopup': 'true', 'aria-expanded': 'false' }); + $mobileBtn.on('focus', function() { + $(this).closest('li').find('ul').addClass('show'); + $(this).attr('aria-expanded', 'true'); + }); + $mobileBtn.on('keydown', function(e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + var $ul = $(this).closest('li').find('ul'); + $ul.toggleClass('show'); + $(this).attr('aria-expanded', $ul.hasClass('show') ? 'true' : 'false'); + } + }); + $('#language-li-ul').on('focusout', function() { + var $container = $(this); + setTimeout(function() { + if (!$container.is(':focus-within')) { + $container.find('ul').removeClass('show'); + $mobileBtn.attr('aria-expanded', 'false'); + } + }, 150); + }); + } + + // ============================================= + // 原有:MutationObserver 強制鎖定 title + // ============================================= + var target = document.getElementById('languagebutton'); + if (target) { + var observer = new MutationObserver(function() { + if (target.getAttribute('title') !== correctTitle) { + target.setAttribute('title', correctTitle); + } + }); + observer.observe(target, { attributes: true, attributeFilter: ['title'] }); + } + } + + setTimeout(fixLanguageA11y, 600); +}); +// rwd左上選單無障礙 +$(function() { + /** + * 修正:當焦點離開整個區塊(含語言選單最後一項)時,關閉大選單 + */ + function fixSearchMenuFocusOut() { + var $searchArea = $('.orbit-bar-search-sign-language'); + var $orbitLabel = $('label[for="open-orbit-nav"]'); + var $langBtn = $('#languagebutton'); + + // 使用 focusout 監聽整個搜尋/語言區域 + $searchArea.on('focusout', function(e) { + // 關鍵:使用 setTimeout 讓 document.activeElement 抓到下一個獲焦元素 + setTimeout(function() { + // 如果目前的焦點不在 $searchArea 裡面,也不是回到觸發的 $orbitLabel 上 + if (!$searchArea.is(':focus-within') && !$(document.activeElement).is($orbitLabel)) { + + // 1. 移除大區塊顯示 + $searchArea.removeClass('show'); + + // 2. 移除子層語言選單顯示 + $searchArea.find('ul').removeClass('show'); + + // 3. 狀態重置為「折疊」供語音報讀 + $orbitLabel.attr('aria-expanded', 'false'); + $langBtn.attr('aria-expanded', 'false'); + } + }, 50); + }); + + // 桌面版 Language 按鈕特殊處理:焦點移入時 + $langBtn.on('focus', function() { + // 確保父層搜尋區塊是顯示的 (針對從別處直接 tab 過來的情況) + $searchArea.addClass('show'); + $(this).attr('aria-expanded', 'true'); + }); + + // 針對手機版 mobile-button (span) 同理處理 + $('.mobile-button').on('focusout', function() { + var $mobileParent = $('#language-li-ul'); + setTimeout(function() { + if (!$mobileParent.is(':focus-within')) { + $mobileParent.find('ul').removeClass('show'); + $('.mobile-button').attr('aria-expanded', 'false'); + } + }, 50); + }); + } + + setTimeout(fixSearchMenuFocusOut, 600); +}); //萬用表格查詢按鈕翻中英 $(document).ready(function () { const lang = $('html').attr('lang'); @@ -2375,6 +2946,214 @@ $(document).ready(function () { } } }); +}); +//網站導覽 +$(document).ready(function() { + // 1. 定位到網站導覽的連結 (使用 href 屬性定位最精確) + var $sitemapLink = $('.header-nav a[href*="/sitemap"]'); + + // 2. 遍歷該連結之後的所有節點 + $sitemapLink.each(function() { + // 取得該 標籤後方的下一個節點 (可以是文字或標籤) + var nextNode = this.nextSibling; + + // 3. 檢查下一個節點是否為文字節點 (nodeType === 3) + // 並且內容包含 "|" + if (nextNode && nextNode.nodeType === 3) { + // 使用正則表達式將 | 替換為空字串 + nextNode.nodeValue = nextNode.nodeValue.replace('|', ''); + } + }); +}); +$(document).ready(function () { + setTimeout(function () { + $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { + $(this).attr('title', '分享至 X 在新視窗開啟'); + }); + }, 1500); +}); +//orbitbarlogo無障礙 +$(function() { + var $logo = $('.orbit-bar-logo'); + var $inner = $logo.contents().not('p'); + + var $span = $('').addClass('orbit-bar-logo').append($inner); + $logo.replaceWith($span); +}); +//orbitbar登入無障礙 +$(function() { + var $loginWindow = $('.login-window'); + var $checkbox = $('#open-orbit-login'); + + // login-window 顯示時,焦點移到 label.close + $checkbox.on('change', function() { + if ($(this).is(':checked')) { + setTimeout(function() { + $('.login-window .login-header label.close').focus(); + }, 50); + } + }); + + // login-window 失去焦點時,關閉並還原焦點 + $loginWindow.on('focusout', function() { + var $thisWindow = $(this); + setTimeout(function() { + // document.hasFocus() 為 false 代表焦點移到瀏覽器外(開發者工具、右鍵選單等),不關閉 + if (!document.hasFocus()) return; + + if (!$thisWindow.is(':focus-within') && $checkbox.is(':checked')) { + $(".orbit-bar-logo").one("focusin", function() { + if (window.orbit_login_button) { + window.orbit_login_button.focus(); + } + }); + $checkbox.click(); + } + }, 500); + }); +}); +//gallery層級問題 +$(function() { + var target = document.getElementById('gallery-theater-stage'); + if (!target) return; + + // 頁面載入時若已存在 #gallery-theater-stage,則還原 z-index + $('.verticalhome').css('z-index', 'auto'); + + var observer = new MutationObserver(function() { + var display = target.style.display; + if (display === 'block') { + $('.verticalhome').css('z-index', '2000'); + } else if (display === 'none') { + $('.verticalhome').css('z-index', 'auto'); + } + }); + + observer.observe(target, { + attributes : true, + attributeFilter: ['style'] + }); +}); +$(document).ready(function() { + + function removeFakeLinks() { + $('a.fake_link').remove(); + } + + // 初始執行一次 + removeFakeLinks(); + + // Shift+Tab 時也執行 + $(document).on('keydown', function(e) { + if (e.key === 'Tab' && e.shiftKey) { + removeFakeLinks(); + } + }); + + // MutationObserver 監聽 DOM 變化,fake_link 一出現就移除 + var observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + mutation.addedNodes.forEach(function(node) { + // 直接是 fake_link + if ($(node).is('a.fake_link')) { + $(node).remove(); + } + // 或其子元素內含 fake_link + if ($(node).find) { + $(node).find('a.fake_link').remove(); + } + }); + }); + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + +}); +//萬用表格無障礙 +function fixSortLinkA11y() { + $('a').filter(function () { + return $(this).find('.universal-th-icon').length > 0; + }).each(function () { + var $link = $(this); + + // === Step 1: 移除 display:none 的 span === + $link.find('span').each(function () { + if ($(this).css('display') === 'none' || $(this).attr('style') && $(this).attr('style').indexOf('display: none') !== -1) { + $(this).remove(); + } + }); + + // === Step 2: 取得 aria-label === + var ariaLabel = $link.attr('aria-label') || ''; + + // 若 aria-label 空白或含未替換模板變數,從旁邊 .universal-th-text 補 + if (!ariaLabel || ariaLabel.indexOf('{{') !== -1) { + var $th = $link.closest('th, div[class*="col-"]'); + var colName = $th.find('.universal-th-text').text().trim(); + ariaLabel = colName ? '重新排序' + colName : '排序'; + $link.attr('aria-label', ariaLabel); + } + + // === Step 3: 補上 title 屬性 === + if (!$link.attr('title')) { + $link.attr('title', ariaLabel + '(在本視窗開啟)'); + } + + // === Step 4: 確保圖示有 aria-hidden === + $link.find('.universal-th-icon').attr('aria-hidden', 'true'); + + // === Step 5: 補上 visually-hidden 連結文字 === + if ($link.find('.visually-hidden').length === 0) { + $link.append('' + ariaLabel + ''); + } + }); +} +function fixSearchInputA11y() { + $('input[type="search"], input[type="text"]').each(function () { + var $input = $(this); + + // 已有對應 label 就跳過 + var inputId = $input.attr('id'); + if (inputId && $('label[for="' + inputId + '"]').length) return; + + // 已有 aria-label / aria-labelledby / title 就跳過 + if ($input.attr('aria-label') || $input.attr('aria-labelledby') || $input.attr('title')) return; + + // 從 placeholder 取得說明文字 + var placeholder = $input.attr('placeholder') || ''; + + // 從最近的 th 或欄位標題取得欄位名稱 + var colName = ''; + var $th = $input.closest('th, div[class*="col-"]'); + if ($th.length) { + colName = $th.find('.universal-th-text').text().trim(); + } + + // 組合標籤文字 + var label = ''; + if (colName && placeholder) { + label = colName + '搜尋'; + } else if (colName) { + label = colName + '搜尋'; + } else if (placeholder) { + label = placeholder; + } else { + label = '搜尋關鍵字'; + } + + $input.attr('aria-label', label); + $input.attr('title', label); + }); +} + +$(document).ready(function () { + setTimeout(function () { + fixSortLinkA11y(); + fixSearchInputA11y(); + }, 500); }); // 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105 // $(window).load(function() { @@ -2383,4 +3162,137 @@ $(document).ready(function () { // } // }); + //banner英文 + $(function() { + function fixBannerA11yByLang() { + setTimeout(function() { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + playControls: isEn ? 'Playback Controls' : '播放控制選項', + resume: isEn ? 'Play' : '繼續播放', + pause: isEn ? 'Pause' : '暫停播放', + prev: isEn ? 'Previous' : '上一張', + next: isEn ? 'Next' : '下一張', + slide: isEn ? 'Slide' : '第', + slideUnit: isEn ? '' : ' 張投影片' + }; + + $('.w-ba-banner').each(function() { + var $banner = $(this); + + // ✅ 播放控制選項 radiogroup label + $banner.find('.controlplay').attr('aria-label', i18n.playControls); + + // ✅ 繼續播放按鈕 + $banner.find('.resume-slide').attr({ + 'aria-label': i18n.resume, + 'title': i18n.resume + }); + $banner.find('.resume-slide p').text(i18n.resume); + + // ✅ 暫停播放按鈕 + $banner.find('.pause-slide').attr({ + 'aria-label': i18n.pause, + 'title': i18n.pause + }); + $banner.find('.pause-slide p').text(i18n.pause); + + // ✅ 上一張按鈕 + $banner.find('.prev-button').attr('aria-label', i18n.prev); + + // ✅ 下一張按鈕 + $banner.find('.next-button').attr('aria-label', i18n.next); + + // ✅ Pager 按鈕 + var $slides = $banner.find('.w-ba-banner__slide'); + $banner.find('.banner-pager button').each(function(index) { + var slideTitle = $slides.eq(index).data('cycle-title') || ''; + var ariaLabel = isEn + ? i18n.slide + ' ' + (index + 1) + (slideTitle ? ' ' + slideTitle : '') + : i18n.slide + (index + 1) + i18n.slideUnit + (slideTitle ? ' ' + slideTitle : ''); + $(this).attr({ + 'aria-label': ariaLabel, + 'title': ariaLabel + }); + }); + }); + + // ✅ Cycle2 初始化後也重新處理 Pager(因為 pager 是動態產生的) + $('.w-ba-banner .cycle-slideshow').on('cycle-post-initialize cycle-after', function() { + var $banner = $(this).closest('.w-ba-banner'); + var $slides = $banner.find('.w-ba-banner__slide'); + $banner.find('.banner-pager button').each(function(index) { + var slideTitle = $slides.eq(index).data('cycle-title') || ''; + var ariaLabel = isEn + ? i18n.slide + ' ' + (index + 1) + (slideTitle ? ' ' + slideTitle : '') + : i18n.slide + (index + 1) + i18n.slideUnit + (slideTitle ? ' ' + slideTitle : ''); + $(this).attr({ + 'aria-label': ariaLabel, + 'title': ariaLabel + }); + }); + }); + + }, 800); + } + + fixBannerA11yByLang(); + }); +//bannercontrolplay +$(function() { + function fixBannerPlayPauseA11y() { + setTimeout(function() { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + resume: isEn ? 'Play' : '繼續播放', + pause: isEn ? 'Pause' : '暫停播放' + }; + + $('.w-ba-banner').each(function() { + var $banner = $(this); + var $controlplay = $banner.find('.controlplay'); + + // ✅ 把 radiogroup 改為一般容器 + $controlplay.removeAttr('role aria-label'); + + // ✅ 繼續播放按鈕 + var $resume = $banner.find('.resume-slide'); + $resume + .attr('role', 'button') + .attr('aria-pressed', $resume.hasClass('active') ? 'true' : 'false') + .attr('aria-label', i18n.resume) + .attr('title', i18n.resume) + .removeAttr('aria-checked aria-live'); + + // ✅ 暫停播放按鈕 + var $pause = $banner.find('.pause-slide'); + $pause + .attr('role', 'button') + .attr('aria-pressed', $pause.hasClass('active') ? 'true' : 'false') + .attr('aria-label', i18n.pause) + .attr('title', i18n.pause) + .removeAttr('aria-checked aria-live'); + + // ✅ 點擊後同步 aria-pressed + $resume.off('click.bannerA11y').on('click.bannerA11y', function() { + $resume.attr('aria-pressed', 'true'); + $pause.attr('aria-pressed', 'false'); + }); + + $pause.off('click.bannerA11y').on('click.bannerA11y', function() { + $pause.attr('aria-pressed', 'true'); + $resume.attr('aria-pressed', 'false'); + }); + }); + + }, 800); + } + + fixBannerPlayPauseA11y(); +}); + }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index 580979e..dee482b 100644 --- a/assets/stylesheets/template/base/_accesskey.scss +++ b/assets/stylesheets/template/base/_accesskey.scss @@ -3,11 +3,10 @@ a[accesskey] { position: absolute; margin-left: -0.9375em; - color: transparent !important; } #orbit-bar a[accesskey] { - color: #666666 !important; + color: #666666; margin-left: 0; position: relative; &:hover { @@ -21,6 +20,3 @@ a[accesskey] { color: transparent !important; } } -#layout-navigation a[accesskey]{ - position: absolute!important; -} \ No newline at end of file diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index 58825e0..6e01b9b 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -2,15 +2,66 @@ @import "../initial"; @import "variables"; -#orbit-bar .orbit-bar-title a{ - color: #333!important; + +.fa-classic, .fa-regular, .fa-solid, .far, .fas ,.fa{ + font-family: "FontAwesome"; +} +li#language-li { + @media(max-width:767px){ + display: none !important; + } } #orbit-bar .orbit-bar-inner > label:focus, #orbit-bar .orbit-bar-inner > label.focus{ .orbit-bar-search-sign-language{ display: block } } +#orbit-bar .orbit-bar-menu .orbit-bar-logo{ + cursor: unset!important; +} +.login-btn:focus { + outline: 0.3125em auto -webkit-focus-ring-color !important; + transition: all 0.2s ease-in-out!important; +} +.orbit-bar-inner{ + li.active { + @media(min-width:768px){ + padding: 0 !important; + } + } +} +// label[for="open-orbit-login"] { +// @media(max-width:768px){ +// display: none!important; +// } +// } +// [accesskey="U"],[accesskey="W"]{ +// @media(max-width:768px){ +// color: #666!important; +// } +// } +.orbit-bar-inner{ + [accesskey="U"]{ + height: 40px; + display: inline-block!important; + line-height: 40px; + float: left; + @media(min-width:769px){ + color: #fff!important; + } + } + [accesskey="W"]{ + height: 40px; + display: inline-block!important; + line-height: 40px; + float: left; + color: #fff!important; + @media(min-width:769px){ + color: #fff!important; + } + } +} .orbit-bar-search-sign-language{ @media(max-width:767px){ position: absolute !important; @@ -168,6 +219,6 @@ img{ // overflow-x: auto; // } // } -*[data-pp]>.editmode-ps>a, .admin-subpart-area .content>.editmode-ps>a{ - position: !important; -} \ No newline at end of file +input[type=checkbox]:focus { + outline: 0.3125em auto -webkit-focus-ring-color; +} diff --git a/assets/stylesheets/template/base/_unity.scss b/assets/stylesheets/template/base/_unity.scss index 0068336..d1ecf6b 100644 --- a/assets/stylesheets/template/base/_unity.scss +++ b/assets/stylesheets/template/base/_unity.scss @@ -25,7 +25,6 @@ width: 35px; height: 35px; background-size: contain; - margin-top: 9px; margin-right: 4px; } } diff --git a/assets/stylesheets/template/base/_variables.scss b/assets/stylesheets/template/base/_variables.scss index 93eda2b..d0326f1 100644 --- a/assets/stylesheets/template/base/_variables.scss +++ b/assets/stylesheets/template/base/_variables.scss @@ -16,11 +16,14 @@ $theme-red: #d20001; $theme-blue: #003d7e; $theme-color-main: #333; -$theme-color-second:#a28e69; -$theme-color-third: #a28e69; -$theme-color-green: #a28e69; +$theme-color-second:#84714d; +$theme-color-third: #84714d; +$theme-color-green: #84714d; $theme-color-hover:#4f2f26; +.fa, .fa-classic, .fa-regular, .fa-solid, .far, .fas { + font-family: "Font Awesome 6 Free", FontAwesome; +} // Font stacks $main-font: "Noto Sans TC", sans-serif; $sub-font: "Noto Sans TC", sans-serif; diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 05dc418..cee6dde 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,11 @@ @charset "utf-8"; @import "../initial"; +.line-it-button{ + .label{ + color: #333!important; + } +} .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9{ @media(max-width: $screen-xs){ padding: 0; @@ -269,12 +274,12 @@ } .internal-page{ .vk_borderBox_title_container{ - background-color: #f68f46; + background-color: #bb5b16; border-radius: 8px 8px 0 0; } .vk_borderBox_body{ border-radius: 0 0 8px 8px; - border: 2px solid #f68f46; + border: 2px solid #bb5b16; background: transparent; } diff --git a/assets/stylesheets/template/layout/header.scss b/assets/stylesheets/template/layout/header.scss index 48dd7a8..c22603b 100644 --- a/assets/stylesheets/template/layout/header.scss +++ b/assets/stylesheets/template/layout/header.scss @@ -84,7 +84,7 @@ a { color: #333; text-decoration: none; - padding:15px 15px 12px 15px; + padding:5px; } @media (min-width:1025px) { diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index 5a759be..971fa0f 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -8,6 +8,7 @@ // Widget // ## gerenral styles + ul.button-mid{ .prev-button{ height: 2em !important; @@ -30,13 +31,36 @@ ul.button-mid{ } } } -ul.button-mid{ - margin:0; - z-index: 201; +.button-mid { + position: absolute; + width: 100%; + height: 0; + top: 50%; + z-index: 201; } .banner-pager .active-slide button{ background: $theme-color-second!important; } +.w-ba-banner .button-mid { + position: absolute; + width: 100%; + height: 0; + top: 50%; + z-index: 201; +} +.next-button, .prev-button { + cursor: pointer; +} +.w-ba-banner .button-mid { + position: absolute; + width: 100%; + height: 0; + top: 50%; + z-index: 201; +} +.next-button, .prev-button { + cursor: pointer; +} iframe{ border: none; } @@ -252,12 +276,12 @@ ul.button-mid{ width: 100%; height: 100%; } - .banner-pager { - right: 1em; - top: -2em; - z-index: 100; - display: none; - } + // .banner-pager { + // right: 1em; + // top: -2em; + // z-index: 100; + // display: none; + // } .button-mid{ z-index: 101; } @@ -375,12 +399,12 @@ ul.button-mid{ } - .banner-pager { - right: 1em; - top: -2em; - z-index: 100; - display: none; - } + // .banner-pager { + // right: 1em; + // top: -2em; + // z-index: 100; + // display: none; + // } } // Widget 3 diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 03ced6d..c877452 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -2672,12 +2672,6 @@ .i-annc__entry-title { margin-bottom: 0; margin-top: 0; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; - // clear: both; } .i-annc__title { @@ -2685,6 +2679,11 @@ color: $theme-color-main; text-decoration: none; @extend .i-title; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + text-overflow: ellipsis; + overflow: hidden; &:hover { color: $theme-color-second; } diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index 4a1b030..9dbb1d8 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -148,16 +148,19 @@ .i-archive-title { @extend .unity-title; } -.link{margin-left: 0.5em;} -.txt { background-color: #6dbb73; margin-left: 0.5em;} -.xlsx { background-color: #bb6d7f; margin-left: 0.5em;} -.pdf { background-color: #3b8347; margin-left: 0.5em;} -.docx { background-color: #846dbb; margin-left: 0.5em;} -.pptx { background-color: #6d77bb; margin-left: 0.5em;} -.jpg { background-color: #bb6d6d; margin-left: 0.5em;} -.zip { background-color: #dcb957; margin-left: 0.5em;} -.docx{margin-left: 0.5em;} -.odt{margin-left: 0.5em;} +/* 2. 對應的檔案顏色 (轉為 iOS 半透明色調) */ +.link { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.txt { background-color: #2a7e31 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.xlsx { background-color: #9e3050 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.pdf { background-color: #2a7d36 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.docx { background-color: #5e46a0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.doc { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.pptx { background-color: #3d4aa0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.jpg { background-color: #8f3333 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.zip { background-color: #8a6400 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.rar { background-color: #9e5000 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.xls { background-color: #2a7e31 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.odt { background-color: #767676 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ .table>caption+thead>tr:first-child>td, .table>caption+thead>tr:first-child>th, .table>colgroup+thead>tr:first-child>td, .table>colgroup+thead>tr:first-child>th, .table>thead:first-child>tr:first-child>td, .table>thead:first-child>tr:first-child>th{ // border-top: 0.0625em solid #ddd; } @@ -537,6 +540,7 @@ } li{ list-style: none; + margin-bottom: 0.5em; } } .index-archive-15{ diff --git a/assets/stylesheets/template/modules/event_news.scss b/assets/stylesheets/template/modules/event_news.scss index c30b4c3..61b7f3a 100644 --- a/assets/stylesheets/template/modules/event_news.scss +++ b/assets/stylesheets/template/modules/event_news.scss @@ -492,7 +492,6 @@ .i-annc__list { display: flex; flex-wrap: wrap; - justify-content: center; } .i-annc__title { font-family: $main-font; diff --git a/assets/stylesheets/template/modules/member.scss b/assets/stylesheets/template/modules/member.scss index f0f1171..2b91d28 100644 --- a/assets/stylesheets/template/modules/member.scss +++ b/assets/stylesheets/template/modules/member.scss @@ -14,18 +14,18 @@ .i-member-pic-wrap{ overflow: hidden; } -.i-member-item{ - &:hover{ - img{ - transform: scale(1.1) !important; - -webkit-transition: .3s ease-out; - -moz-transition: .3s ease-out; - -ms-transition: .3s ease-out; - -o-transition: .3s ease-out; - transition: .3s ease-out; - } - } -} +// .i-member-item{ +// &:hover{ +// img{ +// transform: scale(1.1) !important; +// -webkit-transition: .3s ease-out; +// -moz-transition: .3s ease-out; +// -ms-transition: .3s ease-out; +// -o-transition: .3s ease-out; +// transition: .3s ease-out; +// } +// } +// } // Index 1 .index-member-1 { .i-member__status-title { diff --git a/assets/stylesheets/template/modules/menu.scss b/assets/stylesheets/template/modules/menu.scss index bc25cd6..881cc94 100644 --- a/assets/stylesheets/template/modules/menu.scss +++ b/assets/stylesheets/template/modules/menu.scss @@ -91,9 +91,6 @@ transition: all .3s ease; } } - .header-nav{ - display: none!important; - } -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -ms-transition: all .3s ease; @@ -426,7 +423,7 @@ box-shadow: 2px 2px 5px #00000033; margin:0; transition-duration: 0.5s; - background: #f0f0f0; + background-color: $theme-color-second; & > a { padding: 1em 1.5em; } @@ -570,13 +567,13 @@ } .navbar-toggle { position: absolute; - left: 0; + left: 1em; background: transparent; top: 40px; z-index: 1; - height: 100vh; + height: 93vh; margin: 0; - width: 20%; + width: 13%; border: 0; } .cover { diff --git a/assets/stylesheets/template/template.scss b/assets/stylesheets/template/template.scss index 100bf95..89eab50 100644 --- a/assets/stylesheets/template/template.scss +++ b/assets/stylesheets/template/template.scss @@ -795,6 +795,23 @@ a.ui-state-default{ // color: #fff; // margin-top: 1em; } + input:focus { + border-color: rgba(82, 168, 236, 0.8); + outline: 0; + outline: thin dotted \9; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + border-radius: 1em; + } +} +.btn-search:focus { + border-color: rgba(82, 168, 236, 0.8); + outline: 0; + outline: thin dotted \9; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); } .search-box{ width: 100%; diff --git a/modules/ad_banner/_ad_banner_widget1.html.erb b/modules/ad_banner/_ad_banner_widget1.html.erb index 72699e2..a5e36dd 100644 --- a/modules/ad_banner/_ad_banner_widget1.html.erb +++ b/modules/ad_banner/_ad_banner_widget1.html.erb @@ -20,7 +20,7 @@ data-cycle-title="{{title}}" data-cycle-desc="{{context}}" data-overlay-template="

    {{title}}

    {{desc}}

    " - data-target="{{target}}" + data-bs-target="{{target}}" >
    @@ -65,7 +65,22 @@ }) $('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){ $(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev"); - }) + }); + /* 修正點:處理 Pager 無障礙朗讀文字 */ + $('.cycle-slideshow').on('cycle-post-initialize', function(event, optionHash) { + var $container = $(this).closest('.w-ba-banner'); + var $slides = $(this).find('.w-ba-banner__slide'); + var $pagerButtons = $container.find(".banner-pager button"); + + $pagerButtons.each(function(index) { + var slideTitle = $slides.eq(index).data('cycle-title') || ""; + var ariaLabel = "第 " + (index + 1) + " 張投影片 " + slideTitle; + $(this).attr({ + "aria-label": ariaLabel, + "title": ariaLabel + }); + }); + }); \ No newline at end of file diff --git a/modules/announcement/_annc_widget1.html.erb b/modules/announcement/_annc_widget1.html.erb index 37a44d2..801531d 100644 --- a/modules/announcement/_annc_widget1.html.erb +++ b/modules/announcement/_annc_widget1.html.erb @@ -7,7 +7,7 @@
    - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget15.html.erb b/modules/announcement/_annc_widget15.html.erb index 8135e52..1ae3f85 100644 --- a/modules/announcement/_annc_widget15.html.erb +++ b/modules/announcement/_annc_widget15.html.erb @@ -27,7 +27,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget16.html.erb b/modules/announcement/_annc_widget16.html.erb index 859fe57..dcc68b0 100644 --- a/modules/announcement/_annc_widget16.html.erb +++ b/modules/announcement/_annc_widget16.html.erb @@ -22,7 +22,7 @@
    - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget18.html.erb b/modules/announcement/_annc_widget18.html.erb index fc7c154..27239f2 100644 --- a/modules/announcement/_annc_widget18.html.erb +++ b/modules/announcement/_annc_widget18.html.erb @@ -9,7 +9,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget2.html.erb b/modules/announcement/_annc_widget2.html.erb index fcd093f..8985c13 100644 --- a/modules/announcement/_annc_widget2.html.erb +++ b/modules/announcement/_annc_widget2.html.erb @@ -6,7 +6,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget20.html.erb b/modules/announcement/_annc_widget20.html.erb index dbb32c2..e5f428d 100644 --- a/modules/announcement/_annc_widget20.html.erb +++ b/modules/announcement/_annc_widget20.html.erb @@ -9,7 +9,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget21.html.erb b/modules/announcement/_annc_widget21.html.erb index 80c9b2f..5e1afff 100644 --- a/modules/announcement/_annc_widget21.html.erb +++ b/modules/announcement/_annc_widget21.html.erb @@ -27,7 +27,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget23.html.erb b/modules/announcement/_annc_widget23.html.erb index 33e64c3..d9cf614 100644 --- a/modules/announcement/_annc_widget23.html.erb +++ b/modules/announcement/_annc_widget23.html.erb @@ -7,7 +7,7 @@
    - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget24.html.erb b/modules/announcement/_annc_widget24.html.erb index 6dc75ab..110d301 100644 --- a/modules/announcement/_annc_widget24.html.erb +++ b/modules/announcement/_annc_widget24.html.erb @@ -9,7 +9,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget25.html.erb b/modules/announcement/_annc_widget25.html.erb index 85d1e8a..aada901 100644 --- a/modules/announcement/_annc_widget25.html.erb +++ b/modules/announcement/_annc_widget25.html.erb @@ -29,7 +29,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget26.html.erb b/modules/announcement/_annc_widget26.html.erb index 5da89d8..4cab655 100644 --- a/modules/announcement/_annc_widget26.html.erb +++ b/modules/announcement/_annc_widget26.html.erb @@ -7,7 +7,7 @@
    - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/_annc_widget3.html.erb b/modules/announcement/_annc_widget3.html.erb index 91f218a..bfea3e6 100644 --- a/modules/announcement/_annc_widget3.html.erb +++ b/modules/announcement/_annc_widget3.html.erb @@ -24,7 +24,7 @@

    {{subtitle}}

    - {{img_description}} + {{img_description}}
  • diff --git a/modules/announcement/_annc_widget4.html.erb b/modules/announcement/_annc_widget4.html.erb index 5fb4743..19e695e 100644 --- a/modules/announcement/_annc_widget4.html.erb +++ b/modules/announcement/_annc_widget4.html.erb @@ -9,7 +9,7 @@
  • - {{img_description}} + {{img_description}}
    diff --git a/modules/announcement/annc_index18.html.erb b/modules/announcement/annc_index18.html.erb index 778bb74..6ecfb02 100644 --- a/modules/announcement/annc_index18.html.erb +++ b/modules/announcement/annc_index18.html.erb @@ -3,7 +3,7 @@