This commit is contained in:
ken 2026-09-09 19:03:10 +08:00
parent 6e09876b80
commit e98f657506
7 changed files with 138 additions and 40 deletions

View File

@ -2149,27 +2149,28 @@ $(function() {
});
//rucaptcha-image
$(document).ready(function () {
$('.rucaptcha-image').removeAttr('onload');
// 檢查是否已插入過
if (!$('#captcha_audio').length) {
const audioButton = $(`
<button
title="播放驗證碼語音"
type="button"
onclick="document.getElementById('captcha_audio').play();"
class="fas fa-volume-up"
aria-label="播放驗證碼語音"
role="button"
style="font-size: 1.5em; color: #333; cursor: pointer; border: 2px solid #333; padding: 0.2em;">
<span class="sr-only">播放驗證碼語音</span>
</button>
`);
const audio = $('<audio id="captcha_audio" src="/rucaptcha/?format=wav&amp;locale=zh_tw"></audio>');
$('.rucaptcha-image').after(audioButton, audio);
// >>> 修正:先確認頁面上真的有驗證碼圖片,再往下執行,避免沒有驗證碼的頁面也發出多餘的 wav 請求
if ($('.rucaptcha-image').length) {
$('.rucaptcha-image').removeAttr('onload');
// 檢查是否已插入過
if (!$('#captcha_audio').length) {
const audioButton = $(`
<button
title="播放驗證碼語音"
type="button"
onclick="document.getElementById('captcha_audio').play();"
class="fas fa-volume-up"
aria-label="播放驗證碼語音"
role="button"
style="font-size: 1.5em; color: #333; cursor: pointer; border: 2px solid #333; padding: 0.2em;">
<span class="sr-only">播放驗證碼語音</span>
</button>
`);
const audio = $('<audio id="captcha_audio" src="/rucaptcha/?format=wav&amp;locale=zh_tw"></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('<nav aria-label="麵包屑導覽"></nav>');
$(this).wrap('<nav aria-label="' + navLabel + '"></nav>');
}
});
});
@ -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));

View File

@ -156,7 +156,7 @@
position: relative;
width: 100%;
padding-bottom: 2em;
padding-top: 2em;
padding-top: 1em;
}
.contentwrap1{
background:url(/assets/bglight.png) repeat;

View File

@ -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 {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -105,7 +105,7 @@
<thead class="theadsearch">
<tr data-list="head-columns" data-level="0">
<th class="col-ken">
<a href="{{sort-url}}" class="{{sort}}" aria-label="重新排序{{title}}"><i class="universal-th-icon fa fa-{{sort-class}}"></i></a>
<div class="universal-th-text {{title-class}}">{{title}}</div>
<div class="dropdown universal-dropdown {{search}}">
<button class="btn btn-sm" id="dLabel" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="搜尋" title="搜尋" role="button">

View File

@ -99,7 +99,7 @@
<thead class="theadsearch">
<tr data-list="head-columns" data-level="0">
<th class="col-ken">
<a href="{{sort-url}}" class="{{sort}}" aria-label="重新排序{{title}}"><i class="universal-th-icon fa fa-{{sort-class}}"></i></a>
<div class="universal-th-text {{title-class}}">{{title}}</div>
<div class="dropdown universal-dropdown {{search}}">
<button class="btn btn-sm" id="dLabel" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="搜尋" title="搜尋" role="button">