diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 022ea5c..c3c0d42 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -492,20 +492,28 @@ $(function(){ }); //播放驗證碼語音 $(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 @@ -1726,17 +1734,32 @@ $(function() { var key = getTabKey($currentTab); var $visibleItems = getVisibleItems($scope, key); - // Shift+Tab:若是第一個連結,跳回對應頁籤 + // 找出當前類別的 .w-annc__more + var $more = $scope.find('.w-annc__more-wrap a, .w-annc__more').filter(':visible').first(); + + // Shift+Tab:若在第一個連結,跳回對應頁籤 if (e.which === 9 && e.shiftKey) { if ($currentLink.is($visibleItems.find('a').first())) { e.preventDefault(); $currentTab.focus(); } + // Shift+Tab:若在 .w-annc__more,跳回最後一個公告連結 + if ($more.length && $currentLink.is($more)) { + e.preventDefault(); + $visibleItems.find('a').last().focus(); + } } - // Tab:若是最後一個連結,跳到下一個頁籤並切換 + // Tab:若在最後一個連結,跳到 .w-annc__more if (e.which === 9 && !e.shiftKey) { if ($currentLink.is($visibleItems.find('a').last())) { + if ($more.length) { + e.preventDefault(); + $more.focus(); + } + } + // Tab:若在 .w-annc__more,才跳到下一個頁籤 + if ($more.length && $currentLink.is($more)) { var $nextTab = $currentTab.next('.filter_tab'); if ($nextTab.length > 0) { e.preventDefault(); @@ -2094,29 +2117,71 @@ $(document).ready(function () { }); -$(document).ready(function () { - $('.rucaptcha-image').removeAttr('onload'); - - // 檢查是否已插入過 - if (!$('#captcha_audio').length) { - const audioButton = $(` - - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); - } -}); + //rucaptcha-image + $(document).ready(function () { + 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 $(document).ready(function () { @@ -2884,11 +2949,15 @@ $(document).ready(function() { }); //post $(document).ready(function () { - setTimeout(function () { - $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { - $(this).attr('title', '分享至 X 在新視窗開啟'); - }); - }, 1500); + setTimeout(function () { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + var title = isEn ? 'Share to X Open in new window' : '分享至 X 在新視窗開啟'; + + $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { + $(this).attr('title', title); + }); + }, 1500); }); $(function() { function bindIframeFocus() { @@ -3589,4 +3658,195 @@ $(document).ready(function () { fixLangSwitchA11y(); }); + //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(); +}); + +//無障礙搜尋 +$(function() { + function fixAccesskeySearch() { + setTimeout(function() { + // ✅ 找 accesskey="s" 的元素 + var $accesskeyEl = $('[accesskey="s"], [accesskey="S"]'); + + if ($accesskeyEl.length === 0) { + // ✅ 若沒有 accesskey="s",在 .search-box 的 input 前加一個隱藏的錨點 + var $searchInput = $('.search-box .input-search, .search-box input[type="search"], .search-box input[type="text"]').first(); + if ($searchInput.length === 0) return; + + if ($('#search-accesskey-anchor').length === 0) { + $searchInput.before('全站搜尋'); + } + + // ✅ 點擊錨點時把焦點移到搜尋框 + $('#search-accesskey-anchor').on('click', function(e) { + e.preventDefault(); + $searchInput.focus(); + }); + + // ✅ 監聽 accesskey 觸發(Alt+S) + $(document).on('keydown', function(e) { + if (e.altKey && (e.key === 's' || e.key === 'S')) { + e.preventDefault(); + $searchInput.focus(); + // ✅ 若搜尋框被收合,先展開 + var $searchBox = $('.search-box'); + if (!$searchInput.is(':visible')) { + $searchBox.addClass('searching'); + $('.btn-search').attr('aria-expanded', 'true'); + } + } + }); + + } else { + // ✅ 已有 accesskey="s" 的元素,修正其跳位目標 + $accesskeyEl.on('click', function(e) { + e.preventDefault(); + var $searchInput = $('.search-box .input-search, .search-box input[type="search"]').first(); + if ($searchInput.length > 0) { + var $searchBox = $('.search-box'); + if (!$searchInput.is(':visible')) { + $searchBox.addClass('searching'); + $('.btn-search').attr('aria-expanded', 'true'); + } + $searchInput.focus(); + } + }); + } + + }, 500); + } + + fixAccesskeySearch(); +}); + }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index 530d65b..9053e3c 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -6,6 +6,11 @@ .fa-classic, .fa-regular, .fa-solid, .far, .fas ,.fa{ font-family: var(--fa-style-family, "FontAwesome")!important; } +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 @@ -215,6 +220,9 @@ img { // overflow-x: auto; // } // } +input[type=checkbox]:focus { + outline: 0.3125em auto -webkit-focus-ring-color; +} // html { // scrollbar-gutter: stable; // } diff --git a/assets/stylesheets/template/layout/addcss.scss b/assets/stylesheets/template/layout/addcss.scss index 03ec0ce..e72a8fa 100644 --- a/assets/stylesheets/template/layout/addcss.scss +++ b/assets/stylesheets/template/layout/addcss.scss @@ -1,6 +1,27 @@ @charset "utf-8"; @import "../initial"; +.fin-faq-page .fin-faq-filter[data-filter="actual"]:hover, .fin-faq-page .fin-faq-filter[data-filter="actual"].is-active { + color: #fff!important; +} + .fin-faq-page { + --fin-navy:#102a4c; + --fin-navy-deep:#0b1f3a; + --fin-gold:#7f5006!important; + --fin-gold-deep:#9b7337; + --fin-ivory:#f7f1e8; + --fin-ivory-light:#fbf8f2; + --fin-bluegray:#6f7c90; + --fin-text:#263445; + --fin-muted:#667085; + --fin-border:#d9c8ad; + --fin-white:#fff; + color:var(--fin-text); + font-family:"Noto Sans TC","Microsoft JhengHei","PingFang TC",system-ui,sans-serif; + line-height:1.75; + background:var(--fin-white); + box-sizing:border-box; + } .sppb-addon-content { padding: 0.5em; } diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index c6e90e7..d33c4a2 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,9 @@ @charset "utf-8"; @import "../initial"; +caption{ + color: #000!important; +} .line-it-button{ .label{ color: #333!important; diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index 0dbe11f..62fdd29 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -7,6 +7,9 @@ // // Widget // ## gerenral styles +.i-archive-files-item-a{ + display: block; +} .i-archive__list{ .date-thead{ min-width: 4em; diff --git a/modules/announcement/_annc_widget1.html.erb b/modules/announcement/_annc_widget1.html.erb index 17570e8..46c6018 100644 --- a/modules/announcement/_annc_widget1.html.erb +++ b/modules/announcement/_annc_widget1.html.erb @@ -7,7 +7,7 @@
-{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
diff --git a/modules/announcement/_annc_widget23.html.erb b/modules/announcement/_annc_widget23.html.erb index 45fa528..eb5ec15 100644 --- a/modules/announcement/_annc_widget23.html.erb +++ b/modules/announcement/_annc_widget23.html.erb @@ -7,7 +7,7 @@ -{{subtitle}}
{{subtitle}}
{{subtitle}}
diff --git a/modules/announcement/_annc_widget3.html.erb b/modules/announcement/_annc_widget3.html.erb index e79ee4d..c5c0243 100644 --- a/modules/announcement/_annc_widget3.html.erb +++ b/modules/announcement/_annc_widget3.html.erb @@ -18,13 +18,13 @@ {{category}} -{{subtitle}}
{{subtitle}}
diff --git a/modules/announcement/annc_index18.html.erb b/modules/announcement/annc_index18.html.erb index 5062916..f6b9f38 100644 --- a/modules/announcement/annc_index18.html.erb +++ b/modules/announcement/annc_index18.html.erb @@ -3,7 +3,7 @@{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
{{subtitle}}
diff --git a/modules/event_news_mod/event_news_index5.html.erb b/modules/event_news_mod/event_news_index5.html.erb index 898a74d..0ee0f96 100644 --- a/modules/event_news_mod/event_news_index5.html.erb +++ b/modules/event_news_mod/event_news_index5.html.erb @@ -4,7 +4,7 @@