From 1fb55c96abe7223afced31b19a6561f09d6b4ad0 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 26 Aug 2026 20:39:51 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 123 +++++++++++++++++- .../template/base/_go_back_top.scss | 2 +- .../template/modules/ad_banner.scss | 3 + .../template/modules/archives.scss | 4 +- modules/ad_banner/_ad_banner_widget3.html.erb | 32 +++-- modules/archive/archive_index14.html.erb | 3 +- modules/member/member_index3.html.erb | 2 +- modules/member/member_index5.html.erb | 2 +- modules/member/member_index7.html.erb | 2 +- modules/member/member_index8.html.erb | 2 +- modules/universal_table/show.html.erb | 2 +- .../web_resource/_web_res_widget1.html.erb | 2 +- .../web_resource/_web_res_widget10.html.erb | 2 +- .../web_resource/_web_res_widget11.html.erb | 2 +- .../web_resource/_web_res_widget2.html.erb | 2 +- .../web_resource/_web_res_widget7.html.erb | 2 +- .../web_resource/_web_res_widget8.html.erb | 2 +- .../web_resource/_web_res_widget9.html.erb | 2 +- modules/web_resource/web_res_index1.html.erb | 2 +- modules/web_resource/web_res_index2.html.erb | 2 +- 20 files changed, 163 insertions(+), 32 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index b62dd29..b08e93a 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -1204,6 +1204,47 @@ $(function() { fixAccessibilityAll(); }, 800); }); +// 修正漢堡選單按鈕無障礙 +$(function() { + function fixNavbarToggleA11y() { + var isEn = $('html').attr('lang') === 'en'; + var label = isEn ? '開啟或關閉導覽選單' : '開啟或關閉導覽選單'; + + $('.navbar-toggle').each(function() { + var $btn = $(this); + + // 修正 title + $btn.attr('title', label); + + // 修正 sr-only 文字(原本是 "Toggle navigation") + var $sr = $btn.find('.sr-only'); + if ($sr.length) { + $sr.text(label); + } else { + $btn.prepend('' + label + ''); + } + + // 補上 aria-label + $btn.attr('aria-label', label); + + // 補上 aria-expanded(依據目前是否展開) + if (!$btn.attr('aria-expanded')) { + var isExpanded = !$btn.hasClass('collapsed'); + $btn.attr('aria-expanded', isExpanded ? 'true' : 'false'); + } + + // 點擊時同步更新 aria-expanded + $btn.off('click.navA11y').on('click.navA11y', function() { + setTimeout(function() { + var isExpanded = !$('.navbar-toggle').hasClass('collapsed'); + $('.navbar-toggle').attr('aria-expanded', isExpanded ? 'true' : 'false'); + }, 50); + }); + }); + } + + setTimeout(fixNavbarToggleA11y, 500); +}); $(function() { @@ -3308,7 +3349,6 @@ setTimeout(function() { if (href) { $tr.css('cursor', 'pointer') - .attr('tabindex', '0') .attr('role', 'link') .attr('aria-label', $tr.find('a').first().text().trim() + ' ' + title); @@ -3422,4 +3462,85 @@ $(document).ready(function () { setTimeout(fixVoicePlayerA11y, 500); }); +$(function() { + function fixSearchBtnNewWindowA11y() { + setTimeout(function() { + // ✅ 找所有 target="_blank" 的搜尋 form 裡的送出按鈕 + $('form[target="_blank"] .btn-search').each(function() { + var $btn = $(this); + + $btn.attr('aria-label', '全站搜尋 在新視窗開啟'); + $btn.attr('title', '全站搜尋 在新視窗開啟'); + + // ✅ 更新 sr-only 文字 + var $sr = $btn.find('.sr-only'); + if ($sr.length > 0) { + $sr.text('全站搜尋 在新視窗開啟'); + } else { + $btn.append('全站搜尋 在新視窗開啟'); + } + }); + + // ✅ 同步修正搜尋 input 的 title + $('form[target="_blank"] .input-search').each(function() { + $(this).attr('title', '全站搜尋'); + }); + + }, 500); + } + + fixSearchBtnNewWindowA11y(); +}); +$(function() { + function fixVoicePlayerA11y() { + setTimeout(function() { + $('a.voice-player').each(function() { + var $a = $(this); + + // ✅ 補上 role="button" + $a.attr('role', 'button'); + + // ✅ 補上 tabindex 確保可被 Tab 聚焦 + if (!$a.attr('tabindex')) { + $a.attr('tabindex', '0'); + } + + // ✅ 補上 aria-pressed 初始狀態(未播放) + $a.attr('aria-pressed', 'false'); + + // ✅ Enter / Space 觸發點擊 + $a.off('keydown.voiceA11y').on('keydown.voiceA11y', function(e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + $(this).trigger('click'); + } + }); + + // ✅ 點擊時切換 aria-pressed 和圖示狀態 + $a.off('click.voiceA11y').on('click.voiceA11y', function() { + var $btn = $(this); + var $icon = $btn.find('i.fa'); + var isPlaying = $icon.hasClass('fa-pause'); + + if (isPlaying) { + $icon.removeClass('fa-pause').addClass('fa-play'); + $btn.attr('aria-pressed', 'false'); + } else { + // ✅ 其他播放中的按鈕先重置 + $('a.voice-player').not($btn).each(function() { + $(this).find('i.fa').removeClass('fa-pause').addClass('fa-play'); + $(this).attr('aria-pressed', 'false'); + }); + $icon.removeClass('fa-play').addClass('fa-pause'); + $btn.attr('aria-pressed', 'true'); + } + }); + }); + + }, 500); + } + + fixVoicePlayerA11y(); +}); + }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_go_back_top.scss b/assets/stylesheets/template/base/_go_back_top.scss index b419928..c6983bc 100644 --- a/assets/stylesheets/template/base/_go_back_top.scss +++ b/assets/stylesheets/template/base/_go_back_top.scss @@ -17,6 +17,6 @@ z-index: 1050; &:hover { - background:$theme-color-second; + background:#ff6300; } } diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index 7fdfcd9..09b00ba 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -252,6 +252,9 @@ ul.button-mid{ .ba-banner-widget-0 { height: 75vh !important; z-index: 0; + .ad-overlay{ + display: none; + } .w-ba-banner__wrap{ height: 75vh !important; } diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index bc4bd84..12af062 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -149,7 +149,7 @@ @extend .unity-title; } .link { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ -.txt { background-color: #3a8a40 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.txt { background-color: #2a7e31 !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 */ @@ -158,7 +158,7 @@ .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 */ +.xls { background-color: #2a7e31 !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; diff --git a/modules/ad_banner/_ad_banner_widget3.html.erb b/modules/ad_banner/_ad_banner_widget3.html.erb index f5bebb3..fc1d671 100644 --- a/modules/ad_banner/_ad_banner_widget3.html.erb +++ b/modules/ad_banner/_ad_banner_widget3.html.erb @@ -19,7 +19,7 @@ data-cycle-title="{{title}}" data-cycle-desc="{{context}}" data-overlay-template="

{{title}}

{{desc}}" - data-target="{{target}}" + data-bs-target="{{target}}" > @@ -27,16 +27,9 @@ -