diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index a5fc7ad..b04f714 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -991,7 +991,7 @@ $(function(){ var isLinkImage = $parentA.length > 0 && $parentA.text().replace(/\u00a0/g, '').trim() === ""; // --- 1. 處理「裝飾性圖片」標註 --- - if (currentAlt === "announcement image" || currentAlt === "裝飾圖片" || currentTitle === "裝飾圖片" || 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; @@ -2169,27 +2169,28 @@ $(function() { }); //rucaptcha-image $(document).ready(function () { - $('.rucaptcha-image').removeAttr('onload'); - - // 檢查是否已插入過 - if (!$('#captcha_audio').length) { - const audioButton = $(` - - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); + // >>> 修正:先確認頁面上真的有驗證碼圖片,再往下執行,避免沒有驗證碼的頁面也發出多餘的 wav 請求 + if ($('.rucaptcha-image').length) { + $('.rucaptcha-image').removeAttr('onload'); + // 檢查是否已插入過 + if (!$('#captcha_audio').length) { + const audioButton = $(` + + `); + const audio = $(''); + $('.rucaptcha-image').after(audioButton, audio); + } } + // <<< 修正結束 }); //萬用表格searchbtn2 @@ -2212,6 +2213,28 @@ $(function() { // 預設 aria-expanded 為 false $(".searchbtn2").attr("aria-expanded", "false"); }); + // ✅ searchbtn2 Tab 鍵聚焦時自動展開 .searchbox + $(document).ready(function() { + function fixSearchbtn2FocusA11y() { + setTimeout(function() { + $('.searchbtn2').on('focus', function() { + var $searchbox = $('.searchbox'); + + // ✅ 只在收合狀態時才展開,不影響已展開的狀態 + if (!$searchbox.is(':visible')) { + $searchbox.slideDown(300, function() { + // ✅ 同步更新 aria-expanded(與原本 click 邏輯一致) + $('.searchbtn2').attr('aria-expanded', 'true'); + // ✅ 同步加上 ken-click2(與原本 click 邏輯一致) + $('.searchbtn2').closest('.ken-click').addClass('ken-click2'); + }); + } + }); + }, 500); + } + + fixSearchbtn2FocusA11y(); + }); // 強制保持全站search展開 $(document).ready(function () { @@ -3332,12 +3355,16 @@ $(document).ready(function() { }); //麵包屑無障礙 $(document).ready(function () { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var navLabel = isEn ? 'Breadcrumb navigation' : '麵包屑導覽'; + $('.widget-breadcrumb .breadcrumb li:last-child a').attr('aria-current', 'page'); - // 若尚未有 nav 包住,自動加上 $('.widget-breadcrumb .breadcrumb').each(function () { if (!$(this).closest('nav').length) { - $(this).wrap(''); + $(this).wrap(''); } }); }); @@ -3368,4 +3395,136 @@ $(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(); + }); + + +$(function() { + function fixCheckItemA11y() { + setTimeout(function() { + $('.check-item').each(function() { + var $li = $(this); + var labelText = $li.find('label').text().trim(); + + // ✅ li 保留 tabindex="0",但補上正確的 aria-label + $li.attr('aria-label', labelText + ',按下 Enter 或空白鍵選取'); + + // ✅ checkbox 設為 tabindex="-1",讓焦點只停在 li 一次 + $li.find('input[type="checkbox"]').attr('tabindex', '-1'); + + // ✅ li 補上 role="checkbox" 讓螢幕閱讀器正確播報 + $li.attr('role', 'checkbox'); + + // ✅ 初始化 aria-checked 狀態 + var isChecked = $li.find('input[type="checkbox"]').prop('checked'); + $li.attr('aria-checked', isChecked ? 'true' : 'false'); + }); + + // ✅ li 的 Enter/Space 觸發 click + $('.check-item').off('keydown.a11y').on('keydown.a11y', function(e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + var label = this.querySelector('label'); + if (label) { + label.click(); // 直接點 label,瀏覽器會自動連動勾選 checkbox,click 事件也會正常往上冒泡 + } + } + }); + + // ✅ click 後同步 aria-checked 狀態 + $('.check-item').off('click.a11y').on('click.a11y', function() { + var $li = $(this); + var isChecked = $li.find('input[type="checkbox"]').prop('checked'); + $li.attr('aria-checked', isChecked ? 'true' : 'false'); + // 同步更新其他 li 的 aria-checked + $('.check-item').not($li).attr('aria-checked', 'false'); + }); + + }, 800); + } + + fixCheckItemA11y(); + + $(window).on('resize', function() { + fixCheckItemA11y(); + }); +}); + + }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index 6e2c48e..ec178e6 100644 --- a/assets/stylesheets/template/base/_accesskey.scss +++ b/assets/stylesheets/template/base/_accesskey.scss @@ -3,7 +3,7 @@ a[accesskey] { position: absolute; margin-left: -0.9375em; - color: transparent !important; + color: transparent; } #orbit-bar a[accesskey] { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index 38b2343..23ca0a0 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: "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 diff --git a/assets/stylesheets/template/layout/bo5.scss b/assets/stylesheets/template/layout/bo5.scss index 762c594..959ca55 100644 --- a/assets/stylesheets/template/layout/bo5.scss +++ b/assets/stylesheets/template/layout/bo5.scss @@ -307,7 +307,6 @@ a { } .i-annc__content-wrap{ padding: 0.5em; - height: 100%; } .index-announcement-7{ .i-annc__item{ diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 3454ac4..138b729 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,12 +1,19 @@ @charset "utf-8"; @import "../initial"; +.label-warning, .badge-warning { + background-color: #c24100!important; +} button#backbtn{ background: $theme-color-second; + color: #fff !important; &:hover{ background: $theme-color-hover; } } +button.register_this_role.btn.btn-primary{ + color: #fff !important; +} .sign-up{ .checkbox-card li{ background-color: #525252; diff --git a/assets/stylesheets/template/layout/footer.scss b/assets/stylesheets/template/layout/footer.scss index 923beda..97ba5f6 100644 --- a/assets/stylesheets/template/layout/footer.scss +++ b/assets/stylesheets/template/layout/footer.scss @@ -36,7 +36,7 @@ &:hover, &:focus { - opacity: .8; + opacity: .95; } } } diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index cb27e4b..c8cdaf6 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -569,7 +569,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -583,6 +583,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -611,7 +613,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -785,7 +787,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -799,6 +801,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -824,7 +828,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1139,7 +1143,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1153,6 +1157,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -1231,7 +1237,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1483,7 +1489,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1497,6 +1503,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -1529,7 +1537,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1583,7 +1591,7 @@ font-size: 1.6rem!important; } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1597,6 +1605,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -1644,7 +1654,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } diff --git a/assets/stylesheets/template/modules/event_news.scss b/assets/stylesheets/template/modules/event_news.scss index 2d0a00d..e9d6bd8 100644 --- a/assets/stylesheets/template/modules/event_news.scss +++ b/assets/stylesheets/template/modules/event_news.scss @@ -315,7 +315,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -329,6 +329,8 @@ opacity: 0; -webkit-transition: max-height .6s,opacity .6s; transition: max-height .6s,opacity .6s; + padding-bottom: 0; + margin-bottom: 0; @media(min-width:1920px){ font-size: 1.2em; } @@ -354,7 +356,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index e6908c7..ad608fe 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,9 +29,7 @@ - +