From 9ffec98704813a157d4d5e33327fda4679b7ac22 Mon Sep 17 00:00:00 2001 From: ken Date: Thu, 27 Aug 2026 16:13:34 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 30 ++++++++++++++--- modules/ad_banner/_ad_banner_widget2.html.erb | 33 ++++++++++--------- modules/ad_banner/_ad_banner_widget5.html.erb | 8 +++-- modules/announcement/_annc_widget1.html.erb | 2 +- modules/announcement/_annc_widget15.html.erb | 2 +- modules/announcement/_annc_widget16.html.erb | 2 +- modules/announcement/_annc_widget18.html.erb | 2 +- modules/announcement/_annc_widget2.html.erb | 2 +- modules/announcement/_annc_widget20.html.erb | 2 +- modules/announcement/_annc_widget21.html.erb | 2 +- modules/announcement/_annc_widget23.html.erb | 2 +- modules/announcement/_annc_widget24.html.erb | 2 +- modules/announcement/_annc_widget25.html.erb | 2 +- modules/announcement/_annc_widget26.html.erb | 2 +- modules/announcement/_annc_widget3.html.erb | 2 +- modules/announcement/_annc_widget4.html.erb | 2 +- modules/announcement/annc_index18.html.erb | 2 +- modules/announcement/annc_index19.html.erb | 2 +- modules/announcement/annc_index5.html.erb | 2 +- modules/announcement/annc_index6.html.erb | 2 +- .../_annc_widget1.html.erb | 2 +- .../_annc_widget15.html.erb | 2 +- .../_annc_widget16.html.erb | 2 +- .../_annc_widget18.html.erb | 2 +- .../_annc_widget2.html.erb | 2 +- .../_annc_widget3.html.erb | 2 +- .../_annc_widget4.html.erb | 2 +- modules/custom_announcement/show.html.erb | 2 +- .../_event_news_widget1.html.erb | 2 +- .../_event_news_widget15.html.erb | 2 +- .../_event_news_widget2.html.erb | 2 +- .../_event_news_widget20.html.erb | 2 +- .../_event_news_widget21.html.erb | 2 +- .../_event_news_widget22.html.erb | 2 +- .../_event_news_widget3.html.erb | 2 +- .../_event_news_widget4.html.erb | 2 +- 36 files changed, 82 insertions(+), 55 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index bcba999..0de2bba 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -871,7 +871,7 @@ $(this).append('網路資源標題'); } }); - $('input').each(function() { + $('input.input-search, .search-container input, .search-box input, #search input').each(function() { var $this = $(this); if (!$this.attr('title') || $this.attr('title').trim() === '') { $this.attr('title', '網內搜尋'); @@ -899,7 +899,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; @@ -2117,6 +2117,28 @@ $(function() { // 預設 aria-expanded 為 false $(".searchbtn2").attr("aria-expanded", "false"); }); + // ✅ searchbtn2 Tab 鍵聚焦時自動展開 .searchbox + $(document).ready(function() { + function fixSearchbtn2FocusA11y() { + setTimeout(function() { + $('.searchbtn2').on('focus', function() { + var $searchbox = $('.searchbox'); + + // ✅ 只在收合狀態時才展開,不影響已展開的狀態 + 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); + } + + fixSearchbtn2FocusA11y(); + }); //強制保持全站search展開 $(document).ready(function () { @@ -2951,7 +2973,7 @@ $(function() { }); //萬用表格無障礙 function fixSearchInputA11y() { - $('input[type="search"], input[type="text"]').each(function () { + $('input[type="search"], input.input-search, .search-container input, .search-box input').each(function () { var $input = $(this); // 已有對應 label 就跳過 @@ -3309,7 +3331,7 @@ function fixSortLinkA11y() { }); } function fixSearchInputA11y() { - $('input[type="search"], input[type="text"]').each(function () { + $('input[type="search"], input.input-search, .search-container input, .search-box input').each(function () { var $input = $(this); // 已有對應 label 就跳過 diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index e7c9f79..33128b9 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -23,9 +23,9 @@ data-overlay-template="

{{title}}

{{desc}}" data-bs-target="{{target}}" > - +
- +
@@ -47,20 +47,23 @@