This commit is contained in:
ken 2026-09-01 17:52:49 +08:00
parent 0630a4bb6d
commit 31cd89686e
17 changed files with 224 additions and 106 deletions

View File

@ -964,7 +964,7 @@
$(this).append('<span class="sr-only">網路資源標題</span>');
}
});
$('input.input-search, .search-container input, .search-box input, #search input').each(function() {
$('input').each(function() {
var $this = $(this);
if (!$this.attr('title') || $this.attr('title').trim() === '') {
$this.attr('title', '網內搜尋');
@ -992,7 +992,7 @@
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;
@ -1248,7 +1248,16 @@ $(function() {
}
// F. 最終清理:移除冗餘 label避免螢幕閱讀器唸兩次
$a.removeAttr('aria-label');
// 但若是純圖示連結(沒有文字、沒有可讀 img alt保留 aria-label
var $iconsInA = $a.find('i, svg');
var $imgsInA = $a.find('img');
var textInA = $a.text().replace(/\u00a0/g, '').trim();
var hasReadableImg = $imgsInA.length > 0 && ($imgsInA.attr('alt') || '').trim() !== '';
var isIconOnly = ($iconsInA.length > 0 || $imgsInA.length > 0) && textInA === '' && !hasReadableImg;
if (!isIconOnly) {
$a.removeAttr('aria-label');
}
});
// ✅ G. 補強特定連結(須在迴圈外,因為 javascript: 連結被迴圈跳過)
@ -1801,17 +1810,32 @@ $(function() {
var key = getTabKey($currentTab);
var $visibleItems = getVisibleItems($scope, key);
// Shift+Tab若是第一個連結跳回對應頁籤
// 找出當前類別的 .w-annc__more
var $more = $scope.find('.w-annc__more-wrap a, .w-annc__more').filter(':visible').first();
// Shift+Tab若在第一個連結跳回對應頁籤
if (e.which === 9 && e.shiftKey) {
if ($currentLink.is($visibleItems.find('a').first())) {
e.preventDefault();
$currentTab.focus();
}
// Shift+Tab若在 .w-annc__more跳回最後一個公告連結
if ($more.length && $currentLink.is($more)) {
e.preventDefault();
$visibleItems.find('a').last().focus();
}
}
// Tab若是最後一個連結跳到下一個頁籤並切換
// Tab在最後一個連結,跳到 .w-annc__more
if (e.which === 9 && !e.shiftKey) {
if ($currentLink.is($visibleItems.find('a').last())) {
if ($more.length) {
e.preventDefault();
$more.focus();
}
}
// Tab若在 .w-annc__more才跳到下一個頁籤
if ($more.length && $currentLink.is($more)) {
var $nextTab = $currentTab.next('.filter_tab');
if ($nextTab.length > 0) {
e.preventDefault();
@ -2166,7 +2190,8 @@ $(function() {
//萬用表格searchbtn2
$(document).ready(function () {
$('.searchbtn2').click(function (event) {
event.preventDefault(); // 防止預設行為
event.preventDefault();
event.stopPropagation(); // ✅ 加這行,防止冒泡到 .ken-click
$(".searchbox").slideToggle(300, function () {
updateAriaExpanded();
});
@ -2183,27 +2208,36 @@ $(function() {
// 預設 aria-expanded 為 false
$(".searchbtn2").attr("aria-expanded", "false");
});
// searchbtn2 Tab 鍵聚焦時自動展開 .searchbox
// searchbtn2 Tab 鍵聚焦時自動展開 .searchbox
$(document).ready(function() {
function fixSearchbtn2FocusA11y() {
setTimeout(function() {
$('.searchbtn2').on('focus', function() {
var $searchbox = $('.searchbox');
function fixSearchbtn2FocusA11y() {
setTimeout(function() {
// ✅ 只在收合狀態時才展開,不影響已展開的狀態
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);
}
var isMouseClick = false;
fixSearchbtn2FocusA11y();
// 滑鼠按下時標記
$('.searchbtn2').on('mousedown', function() {
isMouseClick = true;
setTimeout(function() { isMouseClick = false; }, 300);
});
// focus 事件:只有 Tab 聚焦(非滑鼠)才自動展開
$('.searchbtn2').on('focus', function() {
if (isMouseClick) return; // 滑鼠點擊來的 focus跳過
var $searchbox = $('.searchbox');
if (!$searchbox.is(':visible')) {
$searchbox.slideDown(300, function() {
$('.searchbtn2').attr('aria-expanded', 'true');
$('.searchbtn2').closest('.ken-click').addClass('ken-click2');
});
}
});
}, 500);
}
fixSearchbtn2FocusA11y();
});
// 強制保持全站search展開
$(document).ready(function () {
@ -3097,6 +3131,11 @@ $(document).ready(function() {
// 執行修復功能
fixVideoPosterAlt();
});
//網站導覽換icon
// $(document).ready(function() {
// $('a[href="/zh_tw/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>');
// $('a[href="/en/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>')
// });
//#tdstylesp表格樣式
$(function () {
$('#tdstylesp').each(function () {
@ -3131,6 +3170,11 @@ function fixCarouselBtnA11y() {
$('.carousel_images .w-ba-banner ~ div .button-mid').remove();
}, 500);
}
$(document).ready(function () {
setTimeout(function () {
$('.dtr-control').removeAttr('tabindex');
}, 500);
});
//cycle2無障礙
$(document).ready(function() {
// 取得頁面上所有的 Cycle2 輪播圖
@ -3369,7 +3413,6 @@ $(function() {
attributeFilter: ['style']
});
});
//fake_link問題
$(document).ready(function() {
function removeFakeLinks() {
@ -3448,7 +3491,7 @@ function fixSortLinkA11y() {
});
}
function fixSearchInputA11y() {
$('input[type="search"], input.input-search, .search-container input, .search-box input').each(function () {
$('input[type="search"], input[type="text"]').each(function () {
var $input = $(this);
// 已有對應 label 就跳過
@ -3520,6 +3563,7 @@ function removeHiddenContentLinks() {
$(document).ready(function () {
setTimeout(removeHiddenContentLinks, 500);
});
//某頁重複的問題
$(document).ready(function () {
if ($('.orbit-bar-search-sign-language').length > 1) {
$('.orbit-bar-search-sign-language').not(':first').remove();
@ -3568,16 +3612,6 @@ setTimeout(function() {
}
}, 600);
$(document).ready(function () {
$('.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>');
}
});
});
//會員tab邏輯
$(document).ready(function () {
setTimeout(function () {
@ -3692,17 +3726,64 @@ $(document).ready(function () {
// 比 fixAccessibilityAll 的 800ms 晚,確保最後執行
setTimeout(fixGalleryViewLinkA11y, 2000);
});
//公告活動公告tabindex
//會員
$(function() {
function removeAnncItemTabindex() {
function fixMemberAcademicLinkA11y() {
setTimeout(function() {
$('.widget-announcement-4 .w-annc__item, .event-news-4 .w-annc__item')
.removeAttr('tabindex');
$('.i-member-item').each(function() {
var $item = $(this);
// ✅ 取得該成員的姓名
var memberName = $item.find('.member-data-value-name a').text().trim();
if (!memberName) return;
// ✅ 找到學術歷程連結,補上包含姓名的 title
$item.find('.member-data-value-11 a').each(function() {
var $a = $(this);
var currentTitle = $a.attr('title') || '';
// ✅ 移除舊的開窗字串,組合新 title
var titleWithoutWindow = currentTitle
.replace('另開新視窗前往', '')
.replace('在新視窗開啟', '')
.replace('在本視窗開啟', '')
.trim();
var isNewWindow = $a.attr('target') === '_blank';
var windowText = isNewWindow ? ' 在新視窗開啟' : ' 在本視窗開啟';
$a.attr('title', memberName + ' ' + titleWithoutWindow + windowText);
});
});
}, 500);
}
removeAnncItemTabindex();
fixMemberAcademicLinkA11y();
});
//中英切換紐 class用lang-switch
$(function() {
$('.lang-switch').on('click', function(e) {
e.preventDefault();
var path = window.location.pathname;
var search = window.location.search;
var newUrl;
// 首頁用 ?locale= 判斷
if (search.includes('locale=en')) {
newUrl = '/?locale=zh_tw';
} else if (search.includes('locale=zh_tw')) {
newUrl = '/?locale=en';
// 內頁用路徑判斷
} else if (path.startsWith('/en')) {
newUrl = path.replace(/^\/en/, '/zh_tw');
} else if (path.startsWith('/zh_tw')) {
newUrl = path.replace(/^\/zh_tw/, '/en');
} else {
newUrl = '/?locale=zh_tw';
}
window.location.href = newUrl;
});
});
}(jQuery, window));

View File

@ -3,7 +3,7 @@
a[accesskey] {
position: absolute;
margin-left: -0.9375em;
color: transparent !important;
color: transparent;
}
#orbit-bar a[accesskey] {

View File

@ -6,6 +6,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

View File

@ -309,31 +309,7 @@ a {
.i-annc__content-wrap{
padding: 0.5em;
}
.index-announcement-7{
.i-annc__item{
&:hover{
-webkit-transition: .6s all ease;
-o-transition: .6s all ease;
transition: .6s all ease;
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
.i-annc__content-wrap{
background: radial-gradient(circle at 70% 80%, #66a9e2b3, transparent 60%), radial-gradient(circle at 1% 1%, #fb8f72, transparent 30%), radial-gradient(circle at 50% 50%, #3c78ff4d, transparent 70%), linear-gradient(135deg, #2b7bbe 0%, #00437c 80%, #fb8f72 100%);
color: #fff !important;
.i-annc__title,.i-annc__postdate-wrap,.i-annc__category-wrap,.i-annc__subtitle,i{
color: #fff !important;
}
}
}
}
.i-annc__content-wrap{
margin-top: 0;
}
.i-annc__img-wrap{
margin: 0 0.5em!important;
}
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0,0);

View File

@ -8,6 +8,9 @@
// Widget
// ## gerenral styles
.w-ba-banner {
position: relative;
}
ul.button-mid{
.prev-button{
height: 2em !important;
@ -167,7 +170,6 @@ iframe{
content:"\f04c"
}
@media(max-width: $screen-sm) {
right: 0;
a { padding: 0 5px;}
a i { font-size: 0.75em; }
}

View File

@ -2790,6 +2790,7 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl
.s-annc__tag-wrap {
.s-annc__tag {
font-weight: normal;
background-color: $theme-color-second;
}
}
}

View File

@ -551,7 +551,7 @@
.pager-controls{
position: absolute;
right: 1em;
bottom: 1em;
bottom:0;
z-index: 100;
width: auto;
.prev-btn,.next-btn{

View File

@ -357,6 +357,7 @@
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
height: 100%;
width: 100%;

View File

@ -29,7 +29,9 @@
</div>
</div>
<ul class="w-ba-banner__pager-2 banner-pager banner_caption_{{subpart-id}}"></ul>
<div class="w-ad-banner__pager-2 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
</div>
<ul class="controlplay" role="radiogroup" aria-label="播放控制選項">
<a role="radio" aria-checked="true" href="javascript:;" class="resume-slide active" title="繼續播放" aria-label="繼續播放" aria-live="assertive">
<i aria-hidden="true"></i>
@ -47,20 +49,23 @@
</ul>
</div>
<script>
var flag = 1;
$('.pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
});
$('.resume-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('resume');
});
$('.next-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
$('[data-subpart-id="{{subpart-id}}"] .pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
$(this).addClass('active')
$(this).parents('.controlplay').eq(0).find('.resume-slide').removeClass('active')
});
$('[data-subpart-id="{{subpart-id}}"] .resume-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('resume');
$(this).addClass('active')
$(this).parents('.controlplay').eq(0).find('.pause-slide').removeClass('active')
});
$('[data-subpart-id="{{subpart-id}}"] .next-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
})
$('.prev-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
});
})
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
});
/* 修正點:處理 Pager 無障礙朗讀文字 */
$('.cycle-slideshow').on('cycle-post-initialize', function(event, optionHash) {
var $container = $(this).closest('.w-ba-banner');
@ -77,3 +82,23 @@
});
});
</script>
<style type="text/css">
.w-ba-banner .controlplay .resume-slide.active i{
color: #32D9C3;
}
.w-ba-banner .controlplay .pause-slide.active i{
color: #ff4500;
}
.w-ba-banner .controlplay{
width: auto;
}
.w-ba-banner .button-mid{
position: absolute;
width: 100%;
height: 0;
top: 50%;
}
.next-button,.prev-button{
cursor: pointer;
}
</style>

View File

@ -25,7 +25,9 @@
{{html}}
</div>
<div class="ad-overlay w-ad-banner__overlay_{{subpart-id}}"></div>
<div class="w-ba-banner__caption w-ad-banner__pager-2 banner-pager banner_caption_{{subpart-id}}"></div>
<div class="w-ad-banner__pager-2 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
</div>
<ul class="controlplay" role="radiogroup" aria-label="播放控制選項">
<a role="radio" aria-checked="true" href="javascript:;" class="resume-slide active" title="繼續播放" aria-label="繼續播放" aria-live="assertive">
<i aria-hidden="true"></i>

View File

@ -26,7 +26,20 @@
</a>
</div>
</div>
<ul class="w-ba-banner__pager-3 banner-pager banner_caption_{{subpart-id}}"></ul>
<div class="w-ad-banner__pager-3 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
</div>
<ul class="controlplay" role="radiogroup" aria-label="播放控制選項">
<a role="radio" aria-checked="true" href="javascript:;" class="resume-slide active" title="繼續播放" aria-label="繼續播放" aria-live="assertive">
<i aria-hidden="true"></i>
<p style="display: none;"><%= I18n.t("ad_banner.resume") %></p>
</a>
<a role="radio" aria-checked="false" href="javascript:;" class="pause-slide" title="暫停播放" aria-label="暫停播放" aria-live="assertive">
<i aria-hidden="true"></i>
<p style="display: none;"><%= I18n.t("ad_banner.pause") %></p>
</a>
</ul>
<ul class="button-mid">
<i class="fa fa-angle-left prev-button" aria-label="<%= I18n.t("ad_banner.prev") %>"></i>
<i class="fa fa-angle-right next-button" aria-label="<%= I18n.t("ad_banner.next") %>"></i>
@ -37,8 +50,7 @@
</ul>
</div>
<script>
var flag = 1;
$('[data-subpart-id="{{subpart-id}}"] .pause-slide').click(function(){
$('[data-subpart-id="{{subpart-id}}"] .pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
$(this).addClass('active')
$(this).parents('.controlplay').eq(0).find('.resume-slide').removeClass('active')
@ -48,19 +60,13 @@
$(this).addClass('active')
$(this).parents('.controlplay').eq(0).find('.pause-slide').removeClass('active')
});
$('.pause-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
});
$('.resume-slide').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('resume');
});
$('.next-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
$('[data-subpart-id="{{subpart-id}}"] .next-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("next");
})
$('.prev-button').off('click').on('click',function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
});
})
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
});
/* 修正點:處理 Pager 無障礙朗讀文字 */
$('.cycle-slideshow').on('cycle-post-initialize', function(event, optionHash) {
var $container = $(this).closest('.w-ba-banner');
@ -77,3 +83,17 @@
});
});
</script>
<style type="text/css">
.w-ba-banner .controlplay .resume-slide.active i{
color: #32D9C3;
}
.w-ba-banner .controlplay .pause-slide.active i{
color: #ff4500;
}
.w-ba-banner .controlplay{
width: auto;
}
.next-button,.prev-button{
cursor: pointer;
}
</style>

View File

@ -28,7 +28,9 @@
{{html}}
</div>
<div class="ad-overlay w-ad-banner__overlay_{{subpart-id}}"></div>
<div class="w-ba-banner__caption w-ad-banner__pager-2 banner-pager banner_caption_{{subpart-id}}"></div>
<div class="w-ad-banner__pager-2 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
</div>
<ul class="controlplay">
<a role="button" class="resume-slide" title = "<%= (I18n.locale.to_s =="zh_tw") ? "繼續播放" : "resume" %>"><i></i></a>
<a class="pause-slide" title = "<%= (I18n.locale.to_s =="zh_tw") ? "暫停播放" : "pause"%>"><i></i></a>

View File

@ -25,7 +25,9 @@
{{html}}
</div>
<div class="ad-overlay banner-overlay"><div class="ad-overlay2 w-ad-banner__overlay_{{subpart-id}}"></div></div>
<div class="w-ba-banner__caption w-ad-banner__pager-2 banner-pager banner_caption_{{subpart-id}}"></div>
<div class="w-ad-banner__pager-2 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
</div>
<ul class="controlplay"><a role="button" href="javascript:;" class="resume-slide active" title="<%= I18n.t("ad_banner.resume") %>"><i aria-hidden="true" aria-label="<%= I18n.t("ad_banner.resume") %>"></i><p style="display: none;"><%= I18n.t("ad_banner.resume") %></p></a><a href="javascript:;" class="pause-slide" title="<%= I18n.t("ad_banner.pause") %>"><i aria-hidden="true" aria-label="<%= I18n.t("ad_banner.pause") %>"></i><p style="display: none;"><%= I18n.t("ad_banner.pause") %></p></a></ul>
<ul class="button-mid">
<i class="fa fa-angle-left prev-button" aria-label="<%= I18n.t("ad_banner.prev") %>"></i>

View File

@ -87,6 +87,7 @@
clearNavTabsFilterStyle_{{subpart-id}}();
}
})
setTimeout(function() {
$('.widget-announcement-4 .w-annc__item').removeAttr('tabindex');
}, 500);
</script>

View File

@ -9,10 +9,10 @@
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
</div>
<div class="widget-content-title">
<span class="title_text">{{title}}</span>
<span data-list="statuses" data-level="1">
<span class="label status {{status-class}}">{{status}}</span>
</span>
<span class="title_text">{{title}}</span>
</div>
</a>
</li>

View File

@ -9,10 +9,10 @@
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
</div>
<div class="widget-content-title">
<span class="title_text">{{title}}</span>
<span data-list="statuses" data-level="1">
<span class="label status {{status-class}}">{{status}}</span>
</span>
<span class="title_text">{{title}}</span>
</div>
</a>
</li>

View File

@ -9,10 +9,10 @@
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
</div>
<div class="widget-content-title">
<span class="title_text">{{title}}</span>
<span data-list="statuses" data-level="1">
<span class="label status {{status-class}}">{{status}}</span>
</span>
<span class="title_text">{{title}}</span>
</div>
</a>
</li>