From 5023071e0ab40e85f2ce928f811c881560f7b387 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 19 Aug 2026 13:28:35 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 246 ++++++++++++------ assets/stylesheets/template/base/_global.scss | 10 +- .../stylesheets/template/layout/content.scss | 6 + .../template/modules/archives.scss | 26 +- modules/archive/archive_index1.html.erb | 3 +- modules/archive/archive_index12.html.erb | 3 +- modules/archive/archive_index17.html.erb | 3 +- modules/archive/archive_index2.html.erb | 3 +- modules/archive/archive_index3.html.erb | 3 +- modules/archive/archive_index4.html.erb | 3 +- modules/archive/archive_index6.html.erb | 3 +- modules/custom_announcement/show.html.erb | 2 +- modules/video_pro/_video_pro_widget1.html.erb | 2 +- modules/video_pro/_video_pro_widget2.html.erb | 2 +- modules/video_pro/_video_pro_widget3.html.erb | 2 +- modules/video_pro/_video_pro_widget4.html.erb | 2 +- modules/video_pro/_video_pro_widget5.html.erb | 2 +- modules/video_pro/_video_pro_widget6.html.erb | 2 +- modules/video_pro/video_pro_index1.html.erb | 2 +- modules/video_pro/video_pro_index2.html.erb | 2 +- .../video_pro/video_pro_index2_tag.html.erb | 2 +- modules/video_pro/video_pro_index3.html.erb | 2 +- modules/video_pro/video_pro_index4.html.erb | 2 +- .../video_pro_index_post_agency1.html.erb | 2 +- 24 files changed, 208 insertions(+), 127 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 9a8b465..a5fc7ad 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -963,7 +963,7 @@ $(function(){ $(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', '網內搜尋'); @@ -1193,56 +1193,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'); }); @@ -3162,7 +3165,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 就跳過 @@ -3241,43 +3244,6 @@ function fixSortLinkA11y() { } }); } -function fixSearchInputA11y() { - $('input[type="search"], input[type="text"]').each(function () { - var $input = $(this); - - // 已有對應 label 就跳過 - var inputId = $input.attr('id'); - if (inputId && $('label[for="' + inputId + '"]').length) return; - - // 已有 aria-label / aria-labelledby / title 就跳過 - if ($input.attr('aria-label') || $input.attr('aria-labelledby') || $input.attr('title')) return; - - // 從 placeholder 取得說明文字 - var placeholder = $input.attr('placeholder') || ''; - - // 從最近的 th 或欄位標題取得欄位名稱 - var colName = ''; - var $th = $input.closest('th, div[class*="col-"]'); - if ($th.length) { - colName = $th.find('.universal-th-text').text().trim(); - } - - // 組合標籤文字 - var label = ''; - if (colName && placeholder) { - label = colName + '搜尋'; - } else if (colName) { - label = colName + '搜尋'; - } else if (placeholder) { - label = placeholder; - } else { - label = '搜尋關鍵字'; - } - - $input.attr('aria-label', label); - $input.attr('title', label); - }); -} $(document).ready(function () { setTimeout(function () { @@ -3285,5 +3251,121 @@ $(document).ready(function () { fixSearchInputA11y(); }, 500); }); +//會員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/base/_global.scss b/assets/stylesheets/template/base/_global.scss index c7c5363..38b2343 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -26,11 +26,11 @@ } } } -label[for="open-orbit-login"] { - @media(max-width:768px){ - display: none!important; - } -} +// label[for="open-orbit-login"] { +// @media(max-width:768px){ +// display: none!important; +// } +// } [accesskey="U"],[accesskey="W"]{ @media(max-width:768px){ color: #666!important; diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index a997e59..3454ac4 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,12 @@ @charset "utf-8"; @import "../initial"; +button#backbtn{ + background: $theme-color-second; + &:hover{ + background: $theme-color-hover; + } +} .sign-up{ .checkbox-card li{ background-color: #525252; diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index cdf598b..036d5f0 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -152,19 +152,19 @@ @extend .unity-title; } /* 2. 對應的檔案顏色 (轉為 iOS 半透明色調) */ -.link { background-color: rgba(18, 115, 235, 0.6) !important; } /* iOS Blue */ -.txt { background-color: rgba(109, 187, 115, 0.6) !important; } /* iOS Green */ -.xlsx { background-color: rgba(187, 109, 127, 0.6) !important; } /* iOS Pink/Red */ -.pdf { background-color: rgba(59, 131, 71, 0.7) !important; } /* 深一點的 Green */ -.docx { background-color: rgba(132, 109, 187, 0.6) !important; } /* iOS Purple */ -.doc { background-color: rgba(18, 115, 235, 0.6)!important; } -.pptx { background-color: rgba(109, 119, 187, 0.6) !important; } /* iOS Indigo */ -.jpg { background-color: rgba(187, 109, 109, 0.6) !important; } /* iOS Red */ -.zip { background-color: rgba(220, 185, 87, 0.6) !important; } /* iOS Yellow/Orange */ -.rar { background-color: rgba(230, 149, 0, 0.6) !important; } /* iOS Orange (與 zip 區隔,更偏橘) */ -.xls { background-color: rgba(109, 187, 115, 0.6) !important; } /* 沿用 iOS Green (試算表系列) */ -.odt { background-color: rgba(100, 100, 100, 0.6) !important; } /* iOS Gray (通用文件/系統灰色) */ -// Archive index 1 +.link { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.txt { background-color: #3a8a40 !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 */ +.doc { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.pptx { background-color: #3d4aa0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.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 */ +.odt { background-color: #767676 !important; margin-left: 0.5em; } /* 對比 4.6:1 */// Archive index 1 + .index-archive-1 { font-family: $main-font; 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..7ac44db 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/custom_announcement/show.html.erb b/modules/custom_announcement/show.html.erb index b31da4c..c275c70 100644 --- a/modules/custom_announcement/show.html.erb +++ b/modules/custom_announcement/show.html.erb @@ -7,7 +7,7 @@ }
-

{{title}}

+

{{title}}