This commit is contained in:
ken 2026-07-07 17:59:47 +08:00
parent 38fa085d39
commit e79d74bd5d
11 changed files with 192 additions and 57 deletions

View File

@ -313,7 +313,13 @@ $(document).ready(function() {
$('.mobile-menu').toggleClass('active');
$('body').toggleClass('noscroll');
$('.mobile-menu .navbar-toggle').removeClass('collapsed');
// ★ 修正:依據 active 狀態決定 collapsed 的加/移除
if ($('.mobile-menu').hasClass('active')) {
$('.mobile-menu .navbar-toggle').removeClass('collapsed'); // 打開 → 叉叉
} else {
$('.mobile-menu .navbar-toggle').addClass('collapsed'); // 關閉 → 三條橫線
}
// 關閉所有下拉選單
$('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500);
@ -327,6 +333,34 @@ $(document).ready(function() {
}
});
// ✅ Tab 鍵跳過 .mobile-menu 時,觸發收合邏輯
$(document).on('focusout', '.mobile-menu', function(e) {
setTimeout(function() {
var $newFocus = $(document.activeElement);
// 焦點在 body 時代表滑鼠正在點擊中,不處理
if ($newFocus.is('body')) return;
if ($('.mobile-menu').hasClass('active') && $newFocus.closest('.mobile-menu').length === 0) {
var $btn = $('.navbar-toggle').first();
if ($btn.attr('data-bs-toggle')) {
var target = $btn.attr('data-bs-target');
var bsCollapse = window.bootstrap && bootstrap.Collapse.getInstance($(target)[0]);
if (bsCollapse) bsCollapse.hide();
$('.mobile-menu').removeClass('active');
$('body').removeClass('noscroll');
$('.mobile-menu .navbar-toggle').addClass('collapsed');
$('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500);
$('.mobile-menu1 > .menu-drop, .mobile-menu2 > .menu-drop').removeClass('opened');
} else {
$btn.trigger('click');
}
}
}, 50);
});
$('.mobile-menu1 > .menu-drop').click(function(){
var $that = $(this);
var opencheck1 = $that.hasClass('opened');
@ -634,35 +668,46 @@ $(document).ready(function() {
}
});
function handleHover() {
// 先統一移除舊事件,避免重複綁定
$('li').off('mouseenter mouseleave focusin focusout');
function handleHover() {
// 先統一移除舊事件,避免重複綁定
$('li').off('mouseenter mouseleave focusin focusout');
if ($(window).width() > 769) {
// 1. 處理滑鼠 Hover
$('li').hover(
function() { $(this).children('ul').addClass('show'); },
function() { $(this).children('ul').removeClass('show'); }
);
if ($(window).width() > 769) {
// 1. 處理滑鼠 Hover
$('li').hover(
function() {
// ✅ 排除 .menu-bx 內的 li
if (!$(this).closest('.menu-bx').length) {
$(this).children('ul').addClass('show');
}
},
function() {
if (!$(this).closest('.menu-bx').length) {
$(this).children('ul').removeClass('show');
}
}
);
// 2. 處理鍵盤 Tab 聚焦 (關鍵修正)
$('li').on('focusin', function() {
// 當焦點進入 li 或其子元素時,顯示選單
$(this).children('ul').addClass('show');
});
// 2. 處理鍵盤 Tab 聚焦
$('li').on('focusin', function() {
// ✅ 排除 .menu-bx 內的 li
if (!$(this).closest('.menu-bx').length) {
$(this).children('ul').addClass('show');
}
});
$('li').on('focusout', function() {
var $this = $(this);
// 延遲偵測焦點是否真的「離開」了這個 li 區塊
setTimeout(function() {
// 如果新的焦點不在當前這個 li 裡面,才移除 show
if ($this.find(':focus').length === 0) {
$this.children('ul').removeClass('show');
}
}, 10);
});
}
}
$('li').on('focusout', function() {
var $this = $(this);
// ✅ 排除 .menu-bx 內的 li
if ($this.closest('.menu-bx').length) return;
setTimeout(function() {
if ($this.find(':focus').length === 0) {
$this.children('ul').removeClass('show');
}
}, 10);
});
}
}
// 初始化與 Resize 監聽保持不變
handleHover();
@ -871,7 +916,7 @@ $(document).ready(function() {
var isLinkImage = $parentA.length > 0 && $parentA.text().replace(/\u00a0/g, '').trim() === "";
// --- 1. 處理「裝飾性圖片」標註 ---
if (currentAlt === "announcement image" || currentAlt === "裝飾圖片" || currentTitle === "裝飾圖片") {
if (currentAlt === "announcement image" || currentAlt === "裝飾圖片" || currentTitle === "裝飾圖片" || currentAlt === "這是一張圖片" || currentTitle === "這是一張圖片") {
$img.attr('alt', '');
$img.removeAttr('title');
return;
@ -2884,6 +2929,9 @@ $(function() {
var target = document.getElementById('gallery-theater-stage');
if (!target) return;
// 頁面載入時若已存在 #gallery-theater-stage則還原 z-index
$('.verticalhome').css('z-index', 'auto');
var observer = new MutationObserver(function() {
var display = target.style.display;
if (display === 'block') {
@ -2935,6 +2983,89 @@ $(document).ready(function() {
subtree: true
});
});
//萬用表格無障礙
function fixSortLinkA11y() {
$('a').filter(function () {
return $(this).find('.universal-th-icon').length > 0;
}).each(function () {
var $link = $(this);
// === Step 1: 移除 display:none 的 span ===
$link.find('span').each(function () {
if ($(this).css('display') === 'none' || $(this).attr('style') && $(this).attr('style').indexOf('display: none') !== -1) {
$(this).remove();
}
});
// === Step 2: 取得 aria-label ===
var ariaLabel = $link.attr('aria-label') || '';
// 若 aria-label 空白或含未替換模板變數,從旁邊 .universal-th-text 補
if (!ariaLabel || ariaLabel.indexOf('{{') !== -1) {
var $th = $link.closest('th, div[class*="col-"]');
var colName = $th.find('.universal-th-text').text().trim();
ariaLabel = colName ? '重新排序' + colName : '排序';
$link.attr('aria-label', ariaLabel);
}
// === Step 3: 補上 title 屬性 ===
if (!$link.attr('title')) {
$link.attr('title', ariaLabel + '(在本視窗開啟)');
}
// === Step 4: 確保圖示有 aria-hidden ===
$link.find('.universal-th-icon').attr('aria-hidden', 'true');
// === Step 5: 補上 visually-hidden 連結文字 ===
if ($link.find('.visually-hidden').length === 0) {
$link.append('<span class="visually-hidden">' + ariaLabel + '</span>');
}
});
}
function fixSearchInputA11y() {
$('input[type="search"], input[type="text"]').each(function () {
var $input = $(this);
// 已有對應 label 就跳過
var inputId = $input.attr('id');
if (inputId && $('label[for="' + inputId + '"]').length) return;
// 已有 aria-label / aria-labelledby / title 就跳過
if ($input.attr('aria-label') || $input.attr('aria-labelledby') || $input.attr('title')) return;
// 從 placeholder 取得說明文字
var placeholder = $input.attr('placeholder') || '';
// 從最近的 th 或欄位標題取得欄位名稱
var colName = '';
var $th = $input.closest('th, div[class*="col-"]');
if ($th.length) {
colName = $th.find('.universal-th-text').text().trim();
}
// 組合標籤文字
var label = '';
if (colName && placeholder) {
label = colName + '搜尋';
} else if (colName) {
label = colName + '搜尋';
} else if (placeholder) {
label = placeholder;
} else {
label = '搜尋關鍵字';
}
$input.attr('aria-label', label);
$input.attr('title', label);
});
}
$(document).ready(function () {
setTimeout(function () {
fixSortLinkA11y();
fixSearchInputA11y();
}, 500);
});
// 執行 member等高計算目前改用flexbox故mark掉 by ika 20160105
// $(window).load(function() {

View File

@ -11,6 +11,9 @@
display: block
}
}
#orbit-bar .orbit-bar-menu .orbit-bar-logo{
cursor: unset!important;
}
.login-btn:focus {
outline: 0.3125em auto -webkit-focus-ring-color !important;

View File

@ -144,18 +144,18 @@
.i-archive-title {
@extend .unity-title;
}
.link { background-color: #1368d4 !important; } /* 對比 4.6:1 */
.txt { background-color: #3a8a40 !important; } /* 對比 4.6:1 */
.xlsx { background-color: #9e3050 !important; } /* 對比 4.6:1 */
.pdf { background-color: #2a7d36 !important; } /* 對比 4.6:1 */
.docx { background-color: #5e46a0 !important; } /* 對比 4.6:1 */
.doc { background-color: #1368d4 !important; } /* 對比 4.6:1 */
.pptx { background-color: #3d4aa0 !important; } /* 對比 4.6:1 */
.jpg { background-color: #8f3333 !important; } /* 對比 4.6:1 */
.zip { background-color: #8a6400 !important; } /* 對比 4.6:1 */
.rar { background-color: #9e5000 !important; } /* 對比 4.6:1 */
.xls { background-color: #3a8a40 !important; } /* 對比 4.6:1 */
.odt { background-color: #767676 !important; } /* 對比 4.6:1 */
.link { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.txt { background-color: #3a8a40 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.xlsx { background-color: #9e3050 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.pdf { background-color: #2a7d36 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.docx { background-color: #5e46a0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.doc { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.pptx { background-color: #3d4aa0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.jpg { background-color: #8f3333 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.zip { background-color: #8a6400 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.rar { background-color: #9e5000 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.xls { background-color: #3a8a40 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.odt { background-color: #767676 !important; margin-left: 0.5em; } /* 對比 4.6:1 */
.table>caption+thead>tr:first-child>td, .table>caption+thead>tr:first-child>th, .table>colgroup+thead>tr:first-child>td, .table>colgroup+thead>tr:first-child>th, .table>thead:first-child>tr:first-child>td, .table>thead:first-child>tr:first-child>th{
// border-top: 0.0625em solid #ddd;
}

View File

@ -6,7 +6,7 @@
<div class="index-content col-xs-4 col-sm-3">
<div class="index-content-inner">
<div class="index-pic">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{alt_title}}">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{album-name}}">
</div>
<section class="index-part">
<h4 class="index-content-title">

View File

@ -6,7 +6,7 @@
<div class="index-content col-xs-4 col-sm-3">
<div class="index-content-inner">
<div class="index-pic">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{alt_title}}">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{album-name}}">
</div>
<section class="index-part">
<h4 class="index-content-title">

View File

@ -4,15 +4,16 @@
</h3>
<div class="row" data-level="0" data-list="albums" style="display: flex;flex-wrap: wrap;">
<div class="index-content col-sm-3">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<div class="index-content-inner">
<a href="{{link_to_show}}" title="{{album-name}}">
<div class="index-pic">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{alt_title}}">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{album-name}}">
</div>
</a>
<div class="index-part">
<h4 class="index-content-title">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">{{album-name}}</a>
<a href="{{link_to_show}}" title="{{album-name}}">{{album-name}}</a>
</h4>
<div class="index-img-description">{{album-description}}</div>
</div>

View File

@ -5,14 +5,14 @@
<div class="row" data-level="0" data-list="albums" style="display: flex;flex-wrap: wrap;">
<div class="index-content">
<div class="index-content-inner clearfix row">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<div class="index-pic col-xs-5 col-sm-2">
<img class="index-img" src="{{thumb-src}}" alt="{{alt_title}}">
</div>
</a>
<div class="index-part col-xs-7 col-sm-10">
<h4 class="index-content-title">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">{{album-name}}</a>
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">{{album-name}}</a>
</h4>
<div class="index-img-description">{{album-description}}</div>
</div>

View File

@ -4,15 +4,15 @@
</h3>
<div class="row" data-level="0" data-list="albums" style="display: flex;flex-wrap: wrap;">
<div class="index-content col-sm-3">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<div class="index-content-inner">
<div class="index-pic">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{alt_title}}">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{album-name}}">
</div>
</a>
<div class="index-part">
<h4 class="index-content-title">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">{{album-name}}</a>
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">{{album-name}}</a>
</h4>
</div>
</div>

View File

@ -5,14 +5,14 @@
<div class="row" data-level="0" data-list="albums" style="display: flex;flex-wrap: wrap;">
<div class="index-content">
<div class="index-content-inner clearfix row">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<div class="index-pic col-xs-5 col-sm-2">
<img class="index-img" src="{{thumb-src}}" alt="{{alt_title}}">
</div>
</a>
<div class="index-part col-xs-7 col-sm-10">
<h4 class="index-content-title">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">{{album-name}}</a>
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">{{album-name}}</a>
</h4>
</div>

View File

@ -8,11 +8,11 @@
<div class="card-front">
<div class="card-body" style="padding:0;">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<img src="{{thumb-src}}"alt="{{alt_title}}">
</a>
<div class="card-footer">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<h3 class="card-title">{{album-name}}</h3>
</a>
</div>

View File

@ -6,14 +6,14 @@
<div class="index-content col-sm-3">
<div class="index-content-inner">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">
<div class="index-pic">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{alt_title}}">
<img class="img-thumbnail" src="{{thumb-src}}" alt="{{album-name}}">
</div>
</a>
<section class="index-part">
<h4 class="index-content-title">
<a href="{{link_to_show}}" aria-label="前往{{page-title}}" title="{{page-title}}">{{album-name}}</a>
<a href="{{link_to_show}}" aria-label="前往{{album-name}}" title="{{album-name}}">{{album-name}}</a>
</h4>
</section>
</div>