From b719a7ca55dc4312c0d5d377d3727f166057de4d Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 9 Sep 2026 23:05:59 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 133 ++++++++++++++---- .../template/modules/announcement.scss | 30 ++-- .../template/modules/event_news.scss | 6 +- modules/ad_banner/_ad_banner_widget2.html.erb | 12 +- 4 files changed, 141 insertions(+), 40 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 0de2bba..f2df229 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2074,27 +2074,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 @@ -3139,11 +3140,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() { @@ -3375,4 +3380,82 @@ $(document).ready(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/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 3d762b2..71a1d43 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -546,7 +546,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -560,6 +560,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; } @@ -597,7 +599,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -801,7 +803,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -815,6 +817,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; } @@ -847,7 +851,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1162,7 +1166,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1176,6 +1180,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; } @@ -1254,7 +1260,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1500,7 +1506,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1514,6 +1520,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; } @@ -1546,7 +1554,7 @@ .card:before{ height:100%; } - .w-annc__subtitle{ + .w-annc__subtitle,p{ max-height: 100px; opacity: 1; } @@ -1600,7 +1608,7 @@ font-size: 1.6rem!important; } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -1614,6 +1622,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; } @@ -1661,7 +1671,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 c30b4c3..0230b2d 100644 --- a/assets/stylesheets/template/modules/event_news.scss +++ b/assets/stylesheets/template/modules/event_news.scss @@ -233,7 +233,7 @@ } } } - .w-annc__subtitle{ + .w-annc__subtitle,p{ color: #fff; font-size: 1rem; display: -webkit-box; @@ -247,6 +247,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; } @@ -279,7 +281,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 43718e3..81c01d0 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -23,13 +23,13 @@ data-overlay-template="

{{title}}

{{desc}}" data-bs-target="{{target}}" > -
+ -
+ -