diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 00d9c6b..a7ca7d0 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2117,29 +2117,31 @@ $(document).ready(function () { }); -$(document).ready(function () { - $('.rucaptcha-image').removeAttr('onload'); - - // 檢查是否已插入過 - if (!$('#captcha_audio').length) { - const audioButton = $(` - - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); - } -}); + //rucaptcha-image + $(document).ready(function () { + // >>> 修正:先確認頁面上真的有驗證碼圖片,再往下執行,避免沒有驗證碼的頁面也發出多餘的 wav 請求 + if ($('.rucaptcha-image').length) { + $('.rucaptcha-image').removeAttr('onload'); + // 檢查是否已插入過 + if (!$('#captcha_audio').length) { + const audioButton = $(` + + `); + const audio = $(''); + $('.rucaptcha-image').after(audioButton, audio); + } + } + // <<< 修正結束 + }); //萬用表格searchbtn2 $(document).ready(function () { @@ -2902,11 +2904,15 @@ $(document).ready(function() { }); //post $(document).ready(function () { - setTimeout(function () { - $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { - $(this).attr('title', '分享至 X 在新視窗開啟'); - }); - }, 1500); + setTimeout(function () { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + var title = isEn ? 'Share to X Open in new window' : '分享至 X 在新視窗開啟'; + + $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { + $(this).attr('title', title); + }); + }, 1500); }); $(function() { function bindIframeFocus() { @@ -3152,12 +3158,20 @@ setTimeout(function() { }, 1000); function fixTabFocusA11y() { var TAB_ID_MAP = { + // 中文版 '榮譽榜公告': '68d39935085777e3d824750d', '招生公告': '68d39945085777e3d8247519', '學校公告': '68d39952085777e3d8247525', '系所公告': '68d39960085777e3d8247531', '實習徵才公告': '68d3996f085777e3d824753d', - '校外資訊': '68d3997d085777e3d8247549' + '校外資訊': '68d3997d085777e3d8247549', + // 英文版 + 'Honors': '68d39935085777e3d824750d', + 'Admissions': '68d39945085777e3d8247519', + 'NFU News': '68d39952085777e3d8247525', + 'Announcements':'68d39960085777e3d8247531', + 'Career': '68d3996f085777e3d824753d', + 'External News':'68d3997d085777e3d8247549' }; // 更新 tab li 加上 aria-controls 關聯 @@ -3369,4 +3383,82 @@ $(function() { // } // }); + //banner英文 + $(function() { + function fixBannerA11yByLang() { + setTimeout(function() { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + playControls: isEn ? 'Playback Controls' : '播放控制選項', + resume: isEn ? 'Play' : '繼續播放', + pause: isEn ? 'Pause' : '暫停播放', + prev: isEn ? 'Previous' : '上一張', + next: isEn ? 'Next' : '下一張', + slide: isEn ? 'Slide' : '第', + slideUnit: isEn ? '' : ' 張投影片' + }; + + $('.w-ba-banner').each(function() { + var $banner = $(this); + + // ✅ 播放控制選項 radiogroup label + $banner.find('.controlplay').attr('aria-label', i18n.playControls); + + // ✅ 繼續播放按鈕 + $banner.find('.resume-slide').attr({ + 'aria-label': i18n.resume, + 'title': i18n.resume + }); + $banner.find('.resume-slide p').text(i18n.resume); + + // ✅ 暫停播放按鈕 + $banner.find('.pause-slide').attr({ + 'aria-label': i18n.pause, + 'title': i18n.pause + }); + $banner.find('.pause-slide p').text(i18n.pause); + + // ✅ 上一張按鈕 + $banner.find('.prev-button').attr('aria-label', i18n.prev); + + // ✅ 下一張按鈕 + $banner.find('.next-button').attr('aria-label', i18n.next); + + // ✅ Pager 按鈕 + var $slides = $banner.find('.w-ba-banner__slide'); + $banner.find('.banner-pager button').each(function(index) { + var slideTitle = $slides.eq(index).data('cycle-title') || ''; + var ariaLabel = isEn + ? i18n.slide + ' ' + (index + 1) + (slideTitle ? ' ' + slideTitle : '') + : i18n.slide + (index + 1) + i18n.slideUnit + (slideTitle ? ' ' + slideTitle : ''); + $(this).attr({ + 'aria-label': ariaLabel, + 'title': ariaLabel + }); + }); + }); + + // ✅ Cycle2 初始化後也重新處理 Pager(因為 pager 是動態產生的) + $('.w-ba-banner .cycle-slideshow').on('cycle-post-initialize cycle-after', function() { + var $banner = $(this).closest('.w-ba-banner'); + var $slides = $banner.find('.w-ba-banner__slide'); + $banner.find('.banner-pager button').each(function(index) { + var slideTitle = $slides.eq(index).data('cycle-title') || ''; + var ariaLabel = isEn + ? i18n.slide + ' ' + (index + 1) + (slideTitle ? ' ' + slideTitle : '') + : i18n.slide + (index + 1) + i18n.slideUnit + (slideTitle ? ' ' + slideTitle : ''); + $(this).attr({ + 'aria-label': ariaLabel, + 'title': ariaLabel + }); + }); + }); + + }, 800); + } + + fixBannerA11yByLang(); + }); }(jQuery, window)); diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index 6cc584d..585915e 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,9 +29,7 @@ - + + \ No newline at end of file diff --git a/modules/member/member_index2.html.erb b/modules/member/member_index2.html.erb index 1b55e70..bd3f3e9 100644 --- a/modules/member/member_index2.html.erb +++ b/modules/member/member_index2.html.erb @@ -8,7 +8,7 @@
- + {{name}}
diff --git a/modules/member/member_index9.html.erb b/modules/member/member_index9.html.erb index 0494f20..5585a6c 100644 --- a/modules/member/member_index9.html.erb +++ b/modules/member/member_index9.html.erb @@ -8,7 +8,7 @@
diff --git a/modules/universal_table/index3.html.erb b/modules/universal_table/index3.html.erb index a27344f..0894390 100644 --- a/modules/universal_table/index3.html.erb +++ b/modules/universal_table/index3.html.erb @@ -13,12 +13,11 @@ white-space: nowrap; } .universal-th-text{ - overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; - white-space: normal; -} + white-space: pre !important; + } .universal-dropdown-menu { padding: 15px 18px; white-space: nowrap; diff --git a/modules/web_resource/_web_res_widget8.html.erb b/modules/web_resource/_web_res_widget8.html.erb index a1fb269..a9d009d 100644 --- a/modules/web_resource/_web_res_widget8.html.erb +++ b/modules/web_resource/_web_res_widget8.html.erb @@ -9,11 +9,12 @@ {{img_description}}
- {{title}} + {{title}} {{status}}
+