diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 6c7e2b2..8fa96a8 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -1118,56 +1118,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'); }); @@ -3323,6 +3326,41 @@ setTimeout(function() { } }); }, 500); +function fixSearchButtonA11y() { + var pageLang = $('html').attr('lang') || 'zh-Hant-TW'; + var isEn = pageLang.toLowerCase().startsWith('en'); + + var label = isEn ? 'Submit site search' : '送出網內搜尋'; + + // 找搜尋表單內的送出按鈕 + $('.search-container button[type="submit"], .search-box button[type="submit"], #search button[type="submit"]').each(function () { + var $btn = $(this); + + // 修正 title + if (!$btn.attr('title') || $btn.attr('title').trim() === '按鈕' || $btn.attr('title').trim() === 'button') { + $btn.attr('title', label); + } + + // 修正 sr-only / visually-hidden span 文字 + var $srSpan = $btn.find('.sr-only, .visually-hidden'); + if ($srSpan.length) { + if ($srSpan.text().trim() === '按鈕' || $srSpan.text().trim() === 'button' || $srSpan.text().trim() === '') { + $srSpan.text(label); + } + } else { + // 沒有 sr-only span 就補一個 + $btn.find('i, svg').attr('aria-hidden', 'true'); + $btn.append('' + label + ''); + } + + // 移除 role="button"(button 本身已是 button) + $btn.removeAttr('role'); + }); +} + +$(document).ready(function () { + setTimeout(fixSearchButtonA11y, 500); +}); // 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105 // $(window).load(function() { // if ($('.index-member-3').length && $(window).width() > 992) { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index b738ccb..05a6e24 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -26,16 +26,16 @@ } } } -label[for="open-orbit-login"] { - @media(max-width:768px){ - display: none!important; - } -} -[accesskey="U"],[accesskey="W"]{ - @media(max-width:768px){ - color: #666!important; - } -} +// label[for="open-orbit-login"] { +// @media(max-width:768px){ +// display: none!important; +// } +// } +// [accesskey="U"],[accesskey="W"]{ +// @media(max-width:768px){ +// color: #666!important; +// } +// } .orbit-bar-inner{ [accesskey="U"]{ height: 40px; diff --git a/assets/stylesheets/template/layout/header.scss b/assets/stylesheets/template/layout/header.scss index 3ad3698..738eab6 100644 --- a/assets/stylesheets/template/layout/header.scss +++ b/assets/stylesheets/template/layout/header.scss @@ -46,6 +46,7 @@ outline: 0.3125em auto -webkit-focus-ring-color !important; } .layout-header { + background-image:linear-gradient(180deg, transparent 0, #000000ba 30%, #000000fa); width: 100%; z-index: 10; position: relative; diff --git a/assets/stylesheets/template/modules/universal-table.scss b/assets/stylesheets/template/modules/universal-table.scss index 91f4958..8b6db9f 100644 --- a/assets/stylesheets/template/modules/universal-table.scss +++ b/assets/stylesheets/template/modules/universal-table.scss @@ -5,7 +5,10 @@ a.voice-player { padding-left: 0.5em; color: #ff6300; } - +.btn-info{ + background-color: #007da3; + border-color: #007da3; +} .universal-th-text{ white-space: pre; } diff --git a/modules/web_resource/_web_res_widget9.html.erb b/modules/web_resource/_web_res_widget9.html.erb index 54e493f..82f1aa7 100644 --- a/modules/web_resource/_web_res_widget9.html.erb +++ b/modules/web_resource/_web_res_widget9.html.erb @@ -9,7 +9,7 @@