diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 2ffc795..249a166 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -940,7 +940,7 @@ $(function() { $(this).append('網路資源標題'); } }); - $('input').each(function() { + $('input.input-search, .search-container input, .search-box input, #search input').each(function() { var $this = $(this); if (!$this.attr('title') || $this.attr('title').trim() === '') { $this.attr('title', '網內搜尋'); @@ -968,7 +968,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; @@ -2000,27 +2000,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 @@ -2043,6 +2044,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 () { @@ -3734,7 +3757,7 @@ $(function() { }); //萬用表格無障礙 function fixSearchInputA11y() { - $('input[type="search"], input[type="text"]').each(function () { + $('input[type="search"], input.input-search, .search-container input, .search-box input').each(function () { var $input = $(this); // 已有對應 label 就跳過 @@ -3814,7 +3837,7 @@ function fixSortLinkA11y() { }); } function fixSearchInputA11y() { - $('input[type="search"], input[type="text"]').each(function () { + $('input[type="search"], input.input-search, .search-container input, .search-box input').each(function () { var $input = $(this); // 已有對應 label 就跳過 @@ -3864,4 +3887,82 @@ setTimeout(function() { }, 500); + //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(); + }); }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index f08f664..ea1874f 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 a9cbbf7..791c801 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -5,6 +5,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 diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index 92e8f8f..34b81f7 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -568,7 +568,7 @@ ul.button-mid{ display: flex; flex-wrap: wrap; align-items: center; - bottom: 70px; + bottom: 40px; h3{ text-align: right; width: 30%; diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 3250184..8cd11b6 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -624,7 +624,7 @@ dt.detail-title { } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -638,6 +638,8 @@ dt.detail-title { 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; } @@ -667,7 +669,7 @@ dt.detail-title { .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -842,7 +844,7 @@ dt.detail-title { } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -856,6 +858,8 @@ dt.detail-title { 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; } @@ -881,7 +885,7 @@ dt.detail-title { .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1196,7 +1200,7 @@ dt.detail-title { } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1210,6 +1214,8 @@ dt.detail-title { 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; } @@ -1288,7 +1294,7 @@ dt.detail-title { .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1540,7 +1546,7 @@ dt.detail-title { } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1554,6 +1560,8 @@ dt.detail-title { 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; } @@ -1586,7 +1594,7 @@ dt.detail-title { .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1640,7 +1648,7 @@ dt.detail-title { font-size: 1.6rem!important; } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1654,6 +1662,8 @@ dt.detail-title { 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; } @@ -1701,7 +1711,7 @@ dt.detail-title { .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 e9bfe0c..7f5ff0a 100644 --- a/assets/stylesheets/template/modules/event_news.scss +++ b/assets/stylesheets/template/modules/event_news.scss @@ -212,7 +212,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -226,6 +226,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; } @@ -251,7 +253,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 d64448c..e6908c7 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,7 +29,9 @@ - +