diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 3172ef3..b238806 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -1194,56 +1194,59 @@ $(function() { } } - // E. 重新計算標題 (關鍵邏輯:若 hasOriginalTitle 為真,則不進入此區塊) - if (!hasOriginalTitle) { - if (linkText === "" && $img.length > 0) { - var rawAlt = ($img.attr('alt') || '').trim(); - var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', '']; - var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; }) - ? ($a.attr('aria-label') || i18n.link) : rawAlt; - - var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : ''; - $a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim()); - $img.attr('alt', imgAlt); - } - else if (linkText !== "") { - if (fileExt !== "" || hasBadSymbol || currentTitle === "" || currentTitle.includes('/uploads/')) { - if (fileExt !== "") { - $a.attr('title', linkText + " ." + fileExt + " " + windowTask); - } else { - $a.attr('title', windowTask); - } + // E. 重新計算標題 (關鍵邏輯:若 hasOriginalTitle 為真,則不進入此區塊) + if (!hasOriginalTitle) { + if (linkText === "" && $img.length > 0) { + var rawAlt = ($img.attr('alt') || '').trim(); + var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', '']; + var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; }) + ? ($a.attr('aria-label') || i18n.link) : rawAlt; + + var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : ''; + $a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim()); + $img.attr('alt', imgAlt); + } + else if (linkText !== "") { + if (fileExt !== "" || hasBadSymbol || currentTitle === "" || currentTitle.includes('/uploads/')) { + if (fileExt !== "") { + $a.attr('title', linkText + " ." + fileExt + " " + windowTask); + } else { + $a.attr('title', windowTask); } } } + } - // ✅ 符合 HM1240404E:title 不應與連結文字或圖片 alt 重複 - if (hasOriginalTitle && currentTitle !== "") { - var titleWithoutWindow = currentTitle - .replace('(在本視窗開啟)', '') - .replace('(在新視窗開啟)', '') - .replace('Open in this window', '') - .replace('Open in new window', '') - .replace('另開新視窗前往', '') - .replace('另開新視窗', '') - .trim(); + // ✅ 符合 HM1240404E:title 不應與連結文字或圖片 alt 重複 + if (hasOriginalTitle && currentTitle !== "") { + var titleWithoutWindow = currentTitle + .replace('(在本視窗開啟)', '') + .replace('(在新視窗開啟)', '') + .replace('Open in this window', '') + .replace('Open in new window', '') + .replace('另開新視窗前往', '') + .replace('另開新視窗', '') + .trim(); - // ✅ title 去掉開窗字串後,若與連結文字或圖片原始 alt 相同,則只保留開窗提示 - if ( - (titleWithoutWindow === linkText && linkText !== i18n.link) || - (imgAltOriginal !== '' && titleWithoutWindow === imgAltOriginal) - ) { - $a.attr('title', windowTask); - } - - // ✅ 最終清理:若 title 出現空括號 () 則移除並補上正確開窗提示 - var finalTitle = ($a.attr('title') || '').trim(); - if (finalTitle.includes('()')) { - finalTitle = finalTitle.replace(/\(\)/g, '').trim(); - $a.attr('title', finalTitle + ' ' + windowTask); - } + // ✅ title 去掉開窗字串後,若與連結文字或圖片原始 alt 相同,則只保留開窗提示 + // ✅ 新增:若 linkText 包含副檔名且 title 也是同樣檔名,也只保留開窗提示 + if ( + (titleWithoutWindow === linkText && linkText !== i18n.link) || + (imgAltOriginal !== '' && titleWithoutWindow === imgAltOriginal) || + (fileExt !== '' && linkText.toLowerCase().endsWith('.' + fileExt) && titleWithoutWindow === linkText) + ) { + $a.attr('title', windowTask); + return; // ✅ 加上 return,避免繼續執行後面的清理邏輯造成二次污染 } + // ✅ 最終清理:若 title 出現空括號 () 則移除並補上正確開窗提示 + var finalTitle = ($a.attr('title') || '').trim(); + if (finalTitle.includes('()')) { + finalTitle = finalTitle.replace(/\(\)/g, '').trim(); + $a.attr('title', finalTitle + ' ' + windowTask); + } + } + // F. 最終清理:移除冗餘 label,避免螢幕閱讀器唸兩次 $a.removeAttr('aria-label'); }); @@ -2981,17 +2984,17 @@ $(function() { $("iframe[src*='google']").attr('title','googleOauth'); }); - //tabtitle位置 - $(document).ready(function() { - $('.w-annc .w-annc__widget-title').each(function() { - var $title = $(this); - var $tabs = $title.find('.nav-tabs, .tab_nav, .nav_tabs_filter'); + // //tabtitle位置 + // $(document).ready(function() { + // $('.w-annc .w-annc__widget-title').each(function() { + // var $title = $(this); + // var $tabs = $title.find('.nav-tabs, .tab_nav, .nav_tabs_filter'); - if ($tabs.length) { - $tabs.insertAfter($title); - } - }); - }); + // if ($tabs.length) { + // $tabs.insertAfter($title); + // } + // }); + // }); //會員信箱a $(document).ready(function() { $('.member-data-value-6 a[href^="mailto:"]').each(function() { @@ -3478,7 +3481,8 @@ $(document).ready(function () { function removeHiddenContentLinks() { // 若網址含有 editmode=on 則不執行 if (window.location.href.indexOf('editmode=on') !== -1) return; - + // 排除 gallery view 連結,由 fixGalleryViewLinkA11y 處理 + if ($link.hasClass('view')) return; $('a').each(function () { var $link = $(this); @@ -3551,6 +3555,130 @@ 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 () { + $('.dtr-control').removeAttr('tabindex'); + }, 500); +}); +function fixTabKeyboardNav() { + setTimeout(function () { + var $tablist = $('.member-plugins[role="tablist"]'); + var $tabs = $tablist.find('a[role="tab"]'); + + // 初始化 roving tabindex 和 aria-selected + $tabs.each(function (i) { + var $tab = $(this); + var isActive = $tab.closest('li').hasClass('active'); + $tab.attr({ + 'tabindex': isActive ? '0' : '-1', + 'aria-selected': isActive ? 'true' : 'false' + }); + }); + + // 方向鍵切換頁籤 + $tabs.on('keydown', function (e) { + var $current = $(this); + var currentIndex = $tabs.index($current); + var $target; + + if (e.keyCode === 39 || e.keyCode === 40) { + // 右鍵或下鍵:下一個 + e.preventDefault(); + $target = $tabs.eq((currentIndex + 1) % $tabs.length); + } else if (e.keyCode === 37 || e.keyCode === 38) { + // 左鍵或上鍵:上一個 + e.preventDefault(); + $target = $tabs.eq((currentIndex - 1 + $tabs.length) % $tabs.length); + } else if (e.keyCode === 36) { + // Home:第一個 + e.preventDefault(); + $target = $tabs.first(); + } else if (e.keyCode === 35) { + // End:最後一個 + e.preventDefault(); + $target = $tabs.last(); + } else { + return; + } + + // 更新 roving tabindex 和 aria-selected + $tabs.attr({ 'tabindex': '-1', 'aria-selected': 'false' }); + $target.attr({ 'tabindex': '0', 'aria-selected': 'true' }); + $target.focus().trigger('click'); + }); + + // 點擊頁籤時同步更新狀態 + $tabs.on('click', function () { + $tabs.attr({ 'tabindex': '-1', 'aria-selected': 'false' }); + $(this).attr({ 'tabindex': '0', 'aria-selected': 'true' }); + }); + + }, 500); +} +$(document).ready(function () { + fixTabKeyboardNav(); +}); +function removeBareUrlLinks() { + setTimeout(function() { + $('.dataTables_wrapper a').each(function() { + var $a = $(this); + var text = $a.text().trim(); + + if (/^https?:\/\//i.test(text)) { + $a.replaceWith(text); + } + }); + }, 500); +} +$(document).ready(function() { + removeBareUrlLinks(); +}); +//麵包屑無障礙 +$(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(''); + } + }); +}); +//gallery view +function fixGalleryViewLinkA11y() { + $('a.btn.view').each(function () { + var $a = $(this); + + $a.find('span').each(function () { + var $span = $(this); + + // 避免重複處理 + if ($span.hasClass('sr-only')) return; + + var style = $span.attr('style') || ''; + if (style.indexOf('display: none') !== -1 || style.indexOf('display:none') !== -1) { + $span.removeAttr('style').addClass('sr-only'); + } + }); + + $a.find('i, svg').attr('aria-hidden', 'true'); + }); +} + +$(document).ready(function () { + // 比 fixAccessibilityAll 的 800ms 晚,確保最後執行 + setTimeout(fixGalleryViewLinkA11y, 2000); +}); }(jQuery, window)); diff --git a/assets/stylesheets/template/layout/header.scss b/assets/stylesheets/template/layout/header.scss index 96f265a..0f9fb4f 100644 --- a/assets/stylesheets/template/layout/header.scss +++ b/assets/stylesheets/template/layout/header.scss @@ -254,11 +254,11 @@ a[href="/en/sitemap"]{ .site-logo { margin-right: 0.5em; float: left; - height: 70px; + height: 50px; padding-right: 0.5em; width: auto!important; @media(min-width: 1024px){ - height: 70px; + height: 50px; } @media(max-width: $screen-xs){ height: 45px; diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index b28bfdd..860cf74 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -2282,9 +2282,6 @@ .w-annc__title{ white-space: normal; } - .cycle-carousel-wrap{ - display: flex; - } .w-annc__th{ white-space: nowrap; @media(max-width: $screen-xs){ @@ -2302,8 +2299,6 @@ } .w-annc__list { - justify-content: center; - display: flex; @media(max-width: 768px){ align-items: baseline; } @@ -2317,6 +2312,8 @@ overflow: hidden; } .w-annc__item{ + vertical-align: top; + .w-annc__content-wrap{ padding: 30px 40px!important; margin-bottom: 1em; margin-top: 1em; @@ -2326,21 +2323,9 @@ margin-right: 0.5em; margin-left: 0.5em; height: 14em; - @media(min-width: $screen-lg){ - width:582px !important; } - @media(max-width: 1025px)and(min-width: 821px){ - width: 30.5vw !important; - } - @media(max-width: 820px)and(min-width: $screen-xs){ - width: 356px!important; - } - @media (max-width: $screen-xs) { - width: 89vw !important; - margin-left: 0.5em !important; - margin-right: 0.5em !important; - } - } +} + } // widget-23 diff --git a/assets/stylesheets/template/modules/menu.scss b/assets/stylesheets/template/modules/menu.scss index 2398433..37ba489 100644 --- a/assets/stylesheets/template/modules/menu.scss +++ b/assets/stylesheets/template/modules/menu.scss @@ -206,13 +206,13 @@ width: 100%; padding: 0; align-items: center; - @media (min-width:769px)and(max-width: 1024px){ + @media (min-width:769px)and(max-width: 1200px){ display: flex; flex-wrap: wrap; padding: 0; width: 100%; } - @media (min-width:1025px) { + @media (min-width:1201px) { margin: 0; list-style: none; display: flex; @@ -281,7 +281,7 @@ display: block; padding: 1em 0.8em; font-family: $main-font; - font-size: 1.1em; + font-size: 1em; &:after{ content:''; position:absolute; @@ -380,7 +380,7 @@ } & > a { - font-size:1.1em; + font-size:1em; color:#686868; font-weight: bold; position: relative; @@ -430,7 +430,7 @@ font-family: $main-font; font-weight: 600; color: #686868; - font-size: 1.1em; + font-size: 1em; @media(max-width: 768px){ color: #686868; } diff --git a/assets/stylesheets/template/modules/video.scss b/assets/stylesheets/template/modules/video.scss index 05b4a2d..cbd1bb0 100644 --- a/assets/stylesheets/template/modules/video.scss +++ b/assets/stylesheets/template/modules/video.scss @@ -552,6 +552,8 @@ position: absolute; right: 1em; bottom: 1em; + z-index: 100; + width: auto; .prev-btn,.next-btn{ color: #909090; background: #fff; diff --git a/modules/announcement/_annc_widget15.html.erb b/modules/announcement/_annc_widget15.html.erb index 08776c8..ff0a51d 100644 --- a/modules/announcement/_annc_widget15.html.erb +++ b/modules/announcement/_annc_widget15.html.erb @@ -66,49 +66,7 @@ overflow: hidden; } - + diff --git a/modules/announcement/_annc_widget19.html.erb b/modules/announcement/_annc_widget19.html.erb index 7774209..eac1008 100644 --- a/modules/announcement/_annc_widget19.html.erb +++ b/modules/announcement/_annc_widget19.html.erb @@ -49,127 +49,3 @@ - diff --git a/modules/announcement/_annc_widget4.html.erb b/modules/announcement/_annc_widget4.html.erb index 162aba8..b1d0769 100644 --- a/modules/announcement/_annc_widget4.html.erb +++ b/modules/announcement/_annc_widget4.html.erb @@ -56,53 +56,8 @@ } diff --git a/modules/archive/archive_index1.html.erb b/modules/archive/archive_index1.html.erb index 39c0a75..4d2f037 100644 --- a/modules/archive/archive_index1.html.erb +++ b/modules/archive/archive_index1.html.erb @@ -17,8 +17,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index12.html.erb b/modules/archive/archive_index12.html.erb index 7bcbec6..a4d464a 100644 --- a/modules/archive/archive_index12.html.erb +++ b/modules/archive/archive_index12.html.erb @@ -26,8 +26,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index17.html.erb b/modules/archive/archive_index17.html.erb index 8cdec44..e847a6c 100644 --- a/modules/archive/archive_index17.html.erb +++ b/modules/archive/archive_index17.html.erb @@ -17,8 +17,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index2.html.erb b/modules/archive/archive_index2.html.erb index ed5dfca..b1e3a97 100644 --- a/modules/archive/archive_index2.html.erb +++ b/modules/archive/archive_index2.html.erb @@ -26,8 +26,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index3.html.erb b/modules/archive/archive_index3.html.erb index a9545e2..43c5db8 100644 --- a/modules/archive/archive_index3.html.erb +++ b/modules/archive/archive_index3.html.erb @@ -15,8 +15,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index4.html.erb b/modules/archive/archive_index4.html.erb index dab0713..ff406c9 100644 --- a/modules/archive/archive_index4.html.erb +++ b/modules/archive/archive_index4.html.erb @@ -23,8 +23,7 @@ {{description}}
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/archive/archive_index6.html.erb b/modules/archive/archive_index6.html.erb index 79fb38e..70c7e0d 100644 --- a/modules/archive/archive_index6.html.erb +++ b/modules/archive/archive_index6.html.erb @@ -18,8 +18,7 @@
- {{file-name}} - {{file-type}} + {{file-name}}{{file-type}}
diff --git a/modules/publication/publications_index2.html.erb b/modules/publication/publications_index2.html.erb index b4c7345..ddb08e7 100644 --- a/modules/publication/publications_index2.html.erb +++ b/modules/publication/publications_index2.html.erb @@ -31,6 +31,9 @@ {{pagination_goes_here}} diff --git a/modules/publication/publications_index3.html.erb b/modules/publication/publications_index3.html.erb index 6656d81..cd13dda 100644 --- a/modules/publication/publications_index3.html.erb +++ b/modules/publication/publications_index3.html.erb @@ -30,6 +30,9 @@ {{pagination_goes_here}}