diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 062d9bf..23882ba 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -1101,56 +1101,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'); }); @@ -2314,7 +2317,7 @@ $(document).ready(function() { if ($(window).width() <769) { $('.modules-menu-level-0').after($('.header-nav')); }else{ - $('.navbar-header').before($('.header-nav')); + $('.navbar-header').after($('.header-nav')); }; $('.sitemenu-vertical .sitemenu-dropdown-toggle').click(function(){ $('.sitemenu-vertical .dropdown-menu').slideToggle(); @@ -2382,7 +2385,7 @@ $(document).ready(function() { $('.modules-menu-level-0').after($('.header-nav')); }else{ - $('.navbar-header').before($('.header-nav')); + $('.navbar-header').after($('.header-nav')); }; if ($(window).width() > 821) { @@ -3074,6 +3077,104 @@ $(document).ready(function () { fixSortLinkA11y(); fixSearchInputA11y(); }, 500); +}); +setTimeout(function() { + var found = false; + $('.navbar-header a[accesskey="M"]').each(function() { + if (found) { + $(this).remove(); + } else { + found = true; + } + }); +}, 1000); +function fixTabFocusA11y() { + var TAB_ID_MAP = { + '榮譽榜公告': '68d39935085777e3d824750d', + '招生公告': '68d39945085777e3d8247519', + '學校公告': '68d39952085777e3d8247525', + '系所公告': '68d39960085777e3d8247531', + '實習徵才公告': '68d3996f085777e3d824753d', + '校外資訊': '68d3997d085777e3d8247549' + }; + + // 更新 tab li 加上 aria-controls 關聯 + $('.tab_nav2 li').each(function () { + var text = $.trim($(this).text()); + var targetId = TAB_ID_MAP[text]; + if (targetId) { + $(this).attr('aria-controls', targetId); + } + }); + + // 移除舊的 click 事件,重新綁定含焦點移轉的版本 + $('.tab_nav2 li').off('click').on('click', function () { + var text = $.trim($(this).text()); + var targetId = TAB_ID_MAP[text]; + if (!targetId) return; + + var $target = $('[data-subpart-id="' + targetId + '"]'); + if (!$target.length) return; + + // 找到區塊內第一個可聚焦的元素 + var $firstFocusable = $target.find( + 'a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])' + ).filter(':visible').first(); + + // 捲動到目標區塊 + $('html, body').animate({ + scrollTop: $target.offset().top - 200 + }, 500, function () { + if ($firstFocusable.length) { + // 有可聚焦元素就直接 focus 到第一個 + $firstFocusable.focus(); + } else { + // 沒有的話 fallback 到區塊本身 + $target.attr('tabindex', '-1').focus(); + } + }); + }); + + // 鍵盤 Enter / Space 也觸發同樣行為 + $('.tab_nav2 li').off('keydown.tabFocus').on('keydown.tabFocus', function (e) { + if (e.keyCode === 13 || e.keyCode === 32) { + e.preventDefault(); + $(this).trigger('click'); + } + }); +} + +$(document).ready(function () { + setTimeout(fixTabFocusA11y, 500); +}); +function fixYoutubeiframeTitle() { + // 建立影片 ID 對應標題的對照表 + var YOUTUBE_TITLE_MAP = { + '0HJlYrG4FCk': '國立虎尾科技大學多媒體設計系系所介紹影片' + // 可繼續補充其他影片 ID 與對應標題 + // 'xxxxxxxx': '另一支影片的描述' + }; + + $('iframe[src*="youtube.com/embed"]').each(function () { + var $iframe = $(this); + var src = $iframe.attr('src') || ''; + + // 從 src 取得影片 ID + var match = src.match(/youtube\.com\/embed\/([^?&]+)/); + if (!match) return; + var videoId = match[1]; + + // 若 title 是無意義的預設值 + var currentTitle = $iframe.attr('title') || ''; + if (currentTitle === '' || currentTitle.toLowerCase() === 'youtube') { + var newTitle = YOUTUBE_TITLE_MAP[videoId] || '嵌入式 YouTube 影片(影片ID:' + videoId + ')'; + $iframe.attr('title', newTitle); + } + }); +} + +$(document).ready(function () { + setTimeout(fixYoutubeiframeTitle, 500); }); // 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105 // $(window).load(function() { diff --git a/assets/stylesheets/template/base/_accesskey.scss b/assets/stylesheets/template/base/_accesskey.scss index c0b1b0a..181992b 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: #fff !important; background:transparent !important ; border:transparent!important; } @@ -21,6 +21,7 @@ a[accesskey] { position: relative!important; margin-left: -0.9375em; color: transparent !important; + float: left; } } diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index d37ff36..fa9166d 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -28,16 +28,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 2fb4141..f62cab1 100644 --- a/assets/stylesheets/template/layout/header.scss +++ b/assets/stylesheets/template/layout/header.scss @@ -77,7 +77,7 @@ } .header-banner { overflow: hidden; } .header-nav { - padding:2em 0 0 0; + padding:1em 0 0 0; font-family: $main-font; text-transform:uppercase; display: flex; @@ -121,12 +121,6 @@ z-index: 10; padding: 0; margin: 0; - @media(min-width:769px){ - - } - @media (min-width: 769px){ - float: none!important; - } // @media (max-width: $screen-sm) { // width: 100%; // display: flex; diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index bc3004d..6ce70aa 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -7,6 +7,9 @@ // // Widget // ## gerenral styles +.i-archive__file-name { + white-space: normal; +} .i-archive__list{ .date-thead{ min-width: 4em; diff --git a/home/header.html.erb b/home/header.html.erb index e366d76..f3cb94f 100644 --- a/home/header.html.erb +++ b/home/header.html.erb @@ -22,10 +22,7 @@
diff --git a/modules/gallery/show.html.erb b/modules/gallery/show.html.erb index fed7da1..b82c13e 100644 --- a/modules/gallery/show.html.erb +++ b/modules/gallery/show.html.erb @@ -3,8 +3,8 @@ {{album-title}} {{album-description}} -
- + + \ No newline at end of file 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 @@ - {{title}} + {{title}} {{status}}