diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 9a2a5e6..aa4318c 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -876,7 +876,7 @@ $(function(){ 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; @@ -1078,56 +1078,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'); }); @@ -1161,6 +1164,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() { @@ -3148,11 +3192,7 @@ function removeHiddenContentLinks() { $(document).ready(function () { setTimeout(removeHiddenContentLinks, 500); }); -$(document).ready(function () { - setTimeout(function () { - $('.dtr-control').removeAttr('tabindex'); - }, 500); -}); + $(function() { $('h3.page-module-title').each(function() { var $h3 = $(this); @@ -3271,101 +3311,77 @@ $(document).ready(function () { var $btn = $('.btn-search'); var $input = $('.input-search'); - // 點擊按鈕展開/收合 - $btn.on('click', function () { + // ✅ 將按鈕移到 input 之前 + $btn.insertBefore($input); + + function expandSearch() { + $btn.attr('aria-expanded', 'true'); + $btn.attr('aria-label', '收合搜尋欄'); + $btn.attr('title', '收合搜尋欄'); + $searchBox.addClass('searching'); + } + + function collapseSearch() { + $btn.attr('aria-expanded', 'false'); + $btn.attr('aria-label', '展開搜尋欄'); + $btn.attr('title', '展開搜尋欄'); + $searchBox.removeClass('searching'); + } + + // ✅ 初始狀態 + collapseSearch(); + + // ✅ 點擊按鈕:展開或收合 + $btn.on('click', function (e) { var isExpanded = $btn.attr('aria-expanded') === 'true'; if (isExpanded) { - $btn.attr('aria-expanded', 'false'); - $searchBox.removeClass('searching'); - $input.blur(); + if ($input.val().trim()) { + // 有內容才送出,讓 form 正常 submit + } else { + e.preventDefault(); + collapseSearch(); + } } else { - $btn.attr('aria-expanded', 'true'); - $searchBox.addClass('searching'); - $input.focus(); + e.preventDefault(); + expandSearch(); + setTimeout(function () { $input.focus(); }, 100); } }); - // ✅ 監聽整個 search-box 的焦點進入(含 Tab 鍵進入 input) - $searchBox.on('focusin', function () { - $btn.attr('aria-expanded', 'true'); - $searchBox.addClass('searching'); + // ✅ Tab 遊走到 btn 時展開 + $btn.on('focus', function () { + expandSearch(); }); - // ✅ 監聽整個 search-box 的焦點離開 + // ✅ Tab 遊走到 input 時維持展開 + $input.on('focus', function () { + expandSearch(); + }); + + // ✅ 焦點離開整個 search-box 時收合(無內容才收) $searchBox.on('focusout', function () { - // 延遲確認焦點是否還在 search-box 內 setTimeout(function () { if (!$searchBox.find(':focus').length) { - $btn.attr('aria-expanded', 'false'); - $searchBox.removeClass('searching'); + if (!$input.val().trim()) { + collapseSearch(); + } } }, 150); }); - // Escape 收合並返回按鈕 + // ✅ Escape 收合並回到按鈕 $input.on('keydown', function (e) { if (e.keyCode === 27) { - $btn.attr('aria-expanded', 'false'); - $searchBox.removeClass('searching'); + collapseSearch(); $btn.focus(); } }); }); +//會員tab邏輯 $(document).ready(function () { - var $searchBox = $('.search-box'); - var $btn = $('.btn-search'); - var $input = $('.input-search'); - - // ✅ 將按鈕移到 input 之前,Tab 順序變為:按鈕 → input → 送出 - $btn.insertBefore($input); - - // ✅ 補充 aria-label 說明展開收合功能 - $btn.attr('aria-label', '展開或收合搜尋欄'); - $btn.attr('title', '展開或收合搜尋欄'); - - // 點擊按鈕展開/收合 - $btn.on('click', function () { - var isExpanded = $btn.attr('aria-expanded') === 'true'; - if (isExpanded) { - $btn.attr('aria-expanded', 'false'); - $btn.attr('aria-label', '展開搜尋欄'); - $('.search-box').removeClass('searching'); - $input.blur(); - } else { - $btn.attr('aria-expanded', 'true'); - $btn.attr('aria-label', '收合搜尋欄'); - $('.search-box').addClass('searching'); - $input.focus(); - } - }); - - // focusin 同步狀態 - $searchBox.on('focusin', function () { - $btn.attr('aria-expanded', 'true'); - $btn.attr('aria-label', '收合搜尋欄'); - $searchBox.addClass('searching'); - }); - - // focusout 同步狀態 - $searchBox.on('focusout', function () { - setTimeout(function () { - if (!$searchBox.find(':focus').length) { - $btn.attr('aria-expanded', 'false'); - $btn.attr('aria-label', '展開搜尋欄'); - $searchBox.removeClass('searching'); - } - }, 150); - }); - - // Escape 收合 - $input.on('keydown', function (e) { - if (e.keyCode === 27) { - $btn.attr('aria-expanded', 'false'); - $btn.attr('aria-label', '展開搜尋欄'); - $searchBox.removeClass('searching'); - $btn.focus(); - } - }); + setTimeout(function () { + $('.dtr-control').removeAttr('tabindex'); + }, 500); }); function fixTabKeyboardNav() { setTimeout(function () { diff --git a/assets/stylesheets/template/RWD.scss b/assets/stylesheets/template/RWD.scss index 6ecaa77..b76ffd3 100644 --- a/assets/stylesheets/template/RWD.scss +++ b/assets/stylesheets/template/RWD.scss @@ -21,7 +21,10 @@ position: relative!important; } } -@media(max-width: 769px){ +@media(max-width: 768px){ + .lang-switch{ + display: none; + } .ad-banner-widget-6{ .w-ba-banner__wrap { position: absolute!important; diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index d8c9ece..d2c550e 100644 --- a/assets/stylesheets/template/base/_accesskey.scss +++ b/assets/stylesheets/template/base/_accesskey.scss @@ -3,6 +3,7 @@ a[accesskey] { position: relative; color: transparent ; + float: left; } #orbit-bar a[accesskey] { diff --git a/assets/stylesheets/template/layout/addcss.scss b/assets/stylesheets/template/layout/addcss.scss index aca99b8..03ec0ce 100644 --- a/assets/stylesheets/template/layout/addcss.scss +++ b/assets/stylesheets/template/layout/addcss.scss @@ -28,7 +28,7 @@ border-style: solid; border-width: 1px 1px 1px 1px; border-color: #fff; - background: #6495ed; + background: #3970d5; .sppb-addon-title{ span{ color: #fff; @@ -3147,7 +3147,7 @@ border-style: solid; border-width: 1px 1px 1px 1px; border-color: #fff; - background: #6495ed; + background: #3970d5; } @media (max-width: 1199.98px) { @@ -4442,7 +4442,7 @@ border-style: solid; border-width: 1px 1px 1px 1px; border-color: #fff; - background: #6495ed; + background: #3970d5; } .sppb-addon-table-main th { border: none; @@ -4471,7 +4471,7 @@ border-width: 1px 1px 1px 1px; border-color: #000000; color: #FFFFFF; - background: #6495ed; + background: #3970d5; } #sppb-addon-954ac96d-0916-47b6-abcc-0ba4834ef260 .sppb-addon-table-main th { padding-top: 5px; diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index ba34087..0dbe11f 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -145,7 +145,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 */ @@ -154,7 +154,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/assets/stylesheets/template/template.scss b/assets/stylesheets/template/template.scss index 09f8d35..fb29ef1 100644 --- a/assets/stylesheets/template/template.scss +++ b/assets/stylesheets/template/template.scss @@ -924,7 +924,7 @@ a.ui-state-default{ outline: none; cursor: pointer; border-radius: 50%; - position: absolute; + position: relative; right: 0px; color:#fff; background-color:transparent; diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index 70ef492..fefd9e8 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -50,19 +50,23 @@ \ No newline at end of file diff --git a/modules/member/member_index3.html.erb b/modules/member/member_index3.html.erb index 73b226d..8a92e18 100644 --- a/modules/member/member_index3.html.erb +++ b/modules/member/member_index3.html.erb @@ -8,7 +8,7 @@
- + {{name}}
diff --git a/modules/member/member_index5.html.erb b/modules/member/member_index5.html.erb index c5919d8..a681aa4 100644 --- a/modules/member/member_index5.html.erb +++ b/modules/member/member_index5.html.erb @@ -8,7 +8,7 @@
diff --git a/modules/member/member_index7.html.erb b/modules/member/member_index7.html.erb index b3cf9d7..7ae87aa 100644 --- a/modules/member/member_index7.html.erb +++ b/modules/member/member_index7.html.erb @@ -8,7 +8,7 @@
diff --git a/modules/member/member_index8.html.erb b/modules/member/member_index8.html.erb index 22a8190..6f09b19 100644 --- a/modules/member/member_index8.html.erb +++ b/modules/member/member_index8.html.erb @@ -10,7 +10,7 @@
diff --git a/modules/web_resource/_web_res_widget1.html.erb b/modules/web_resource/_web_res_widget1.html.erb index 8a32f9a..0477ed4 100644 --- a/modules/web_resource/_web_res_widget1.html.erb +++ b/modules/web_resource/_web_res_widget1.html.erb @@ -6,7 +6,7 @@
  • {{title}} diff --git a/modules/web_resource/_web_res_widget10.html.erb b/modules/web_resource/_web_res_widget10.html.erb index 395ad7c..cded130 100644 --- a/modules/web_resource/_web_res_widget10.html.erb +++ b/modules/web_resource/_web_res_widget10.html.erb @@ -7,7 +7,7 @@
  • diff --git a/modules/web_resource/_web_res_widget2.html.erb b/modules/web_resource/_web_res_widget2.html.erb index 02b928c..a448075 100644 --- a/modules/web_resource/_web_res_widget2.html.erb +++ b/modules/web_resource/_web_res_widget2.html.erb @@ -7,7 +7,7 @@
    diff --git a/modules/web_resource/_web_res_widget7.html.erb b/modules/web_resource/_web_res_widget7.html.erb index ca3119b..351710c 100644 --- a/modules/web_resource/_web_res_widget7.html.erb +++ b/modules/web_resource/_web_res_widget7.html.erb @@ -6,7 +6,7 @@
  • diff --git a/modules/web_resource/_web_res_widget8.html.erb b/modules/web_resource/_web_res_widget8.html.erb index e067eeb..451c72a 100644 --- a/modules/web_resource/_web_res_widget8.html.erb +++ b/modules/web_resource/_web_res_widget8.html.erb @@ -6,7 +6,7 @@
  • {{title}} diff --git a/modules/web_resource/_web_res_widget9.html.erb b/modules/web_resource/_web_res_widget9.html.erb index c519498..aeab09b 100644 --- a/modules/web_resource/_web_res_widget9.html.erb +++ b/modules/web_resource/_web_res_widget9.html.erb @@ -7,7 +7,7 @@
    {{title}} diff --git a/modules/web_resource/web_res_index1.html.erb b/modules/web_resource/web_res_index1.html.erb index 2e48441..9dd58d4 100644 --- a/modules/web_resource/web_res_index1.html.erb +++ b/modules/web_resource/web_res_index1.html.erb @@ -6,7 +6,7 @@
  • {{title}} diff --git a/modules/web_resource/web_res_index2.html.erb b/modules/web_resource/web_res_index2.html.erb index ec489f1..0fe3d43 100644 --- a/modules/web_resource/web_res_index2.html.erb +++ b/modules/web_resource/web_res_index2.html.erb @@ -6,7 +6,7 @@