From e98f6575061270b0840ada46d04bf7fe4d5234a4 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 9 Sep 2026 19:03:10 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 141 ++++++++++++++---- .../stylesheets/template/layout/content.scss | 2 +- .../template/modules/ad_banner.scss | 1 + .../template/modules/announcement.scss | 24 ++- .../template/modules/event_news.scss | 6 +- modules/universal_table/index3.html.erb | 2 +- modules/universal_table/index4.html.erb | 2 +- 7 files changed, 138 insertions(+), 40 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 1862599..97f3bc8 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2149,27 +2149,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 @@ -3275,11 +3276,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() { @@ -3673,12 +3678,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(''); } }); }); @@ -3823,4 +3832,82 @@ $(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(); + }); }(jQuery, window)); diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 7c2a75c..7e5bde8 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -156,7 +156,7 @@ position: relative; width: 100%; padding-bottom: 2em; - padding-top: 2em; + padding-top: 1em; } .contentwrap1{ background:url(/assets/bglight.png) repeat; diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index deb5cca..3e2e0d0 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -296,6 +296,7 @@ ul.button-mid{ @media(max-width:768px){ position: relative; background-color: $theme-color-second!important; + display: none!important; } } .w-ba-banner__caption { diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 76ad550..10fd4c7 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -556,7 +556,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -570,6 +570,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; } @@ -598,7 +600,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -772,7 +774,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -786,6 +788,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; } @@ -811,7 +815,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1127,7 +1131,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1141,6 +1145,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; } @@ -1218,7 +1224,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1281,7 +1287,7 @@ font-size: 1.6rem!important; } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1295,6 +1301,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; } @@ -1342,7 +1350,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/universal_table/index3.html.erb b/modules/universal_table/index3.html.erb index 7094248..d2c8ad0 100644 --- a/modules/universal_table/index3.html.erb +++ b/modules/universal_table/index3.html.erb @@ -105,7 +105,7 @@ - +
{{title}}