diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index d5c2327..d87d0ea 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -964,7 +964,7 @@ $(this).append('網路資源標題'); } }); - $('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(''); +// $('a[href="/en/sitemap"]').html('') +// }); //#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(''); - } - }); -}); //會員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)); diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index c6cd8cd..164f7a1 100644 --- a/assets/stylesheets/template/base/_accesskey.scss +++ b/assets/stylesheets/template/base/_accesskey.scss @@ -3,7 +3,7 @@ a[accesskey] { position: absolute; margin-left: -0.9375em; - color: transparent !important; + color: transparent; } #orbit-bar a[accesskey] { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index d2d1a5f..9c50378 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -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 diff --git a/assets/stylesheets/template/layout/bo5.scss b/assets/stylesheets/template/layout/bo5.scss index 9e96402..fa83f0d 100644 --- a/assets/stylesheets/template/layout/bo5.scss +++ b/assets/stylesheets/template/layout/bo5.scss @@ -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); diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index 1f4eb5b..0b0a880 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -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; } } diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 0c9f921..46bd206 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -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; } } } diff --git a/assets/stylesheets/template/modules/video.scss b/assets/stylesheets/template/modules/video.scss index cbd1bb0..c1ec642 100644 --- a/assets/stylesheets/template/modules/video.scss +++ b/assets/stylesheets/template/modules/video.scss @@ -551,7 +551,7 @@ .pager-controls{ position: absolute; right: 1em; - bottom: 1em; + bottom:0; z-index: 100; width: auto; .prev-btn,.next-btn{ diff --git a/assets/stylesheets/template/modules/web_resource.scss b/assets/stylesheets/template/modules/web_resource.scss index f31fdbd..40f786c 100644 --- a/assets/stylesheets/template/modules/web_resource.scss +++ b/assets/stylesheets/template/modules/web_resource.scss @@ -357,6 +357,7 @@ z-index: 2; display: flex; align-items: center; + justify-content: center; flex-wrap: wrap; height: 100%; width: 100%; diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index e7c9f79..81c01d0 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,7 +29,9 @@ -
+