From 75281cf5f24ee431a0b29c7e84487cd945328ef0 Mon Sep 17 00:00:00 2001 From: ken Date: Fri, 18 Sep 2026 11:11:02 +0800 Subject: [PATCH] up --- assets/javascripts/app.js | 248 +++++++++++++++--- assets/stylesheets/template/base/_global.scss | 31 ++- .../template/modules/ad_banner.scss | 26 +- .../template/modules/archives.scss | 4 +- .../stylesheets/template/modules/member.scss | 14 +- home/index.html.erb | 8 +- modules/ad_banner/_ad_banner_widget2.html.erb | 53 ++-- modules/announcement/annc_index18.html.erb | 2 +- modules/announcement/annc_index19.html.erb | 4 +- modules/announcement/annc_index5.html.erb | 4 +- modules/announcement/annc_index6.html.erb | 4 +- modules/archive/archive_index14.html.erb | 3 +- .../event_news_mod/event_news_index5.html.erb | 2 +- .../event_news_mod/event_news_index6.html.erb | 2 +- .../event_news_mod/event_news_index7.html.erb | 2 +- modules/member/member_index11.html.erb | 2 +- modules/member/member_index12.html.erb | 2 +- modules/member/member_index2.html.erb | 2 +- modules/member/member_index3.html.erb | 2 +- modules/member/member_index5.html.erb | 2 +- modules/member/member_index7.html.erb | 2 +- modules/member/member_index8.html.erb | 2 +- modules/member/member_index9.html.erb | 2 +- modules/universal_table/index3.html.erb | 5 +- .../web_resource/_web_res_widget1.html.erb | 2 +- .../web_resource/_web_res_widget10.html.erb | 2 +- .../web_resource/_web_res_widget2.html.erb | 2 +- .../web_resource/_web_res_widget7.html.erb | 2 +- .../web_resource/_web_res_widget8.html.erb | 5 +- .../web_resource/_web_res_widget9.html.erb | 4 +- modules/web_resource/web_res_index1.html.erb | 4 +- modules/web_resource/web_res_index2.html.erb | 4 +- modules/web_resource/web_res_index3.html.erb | 4 +- 33 files changed, 330 insertions(+), 127 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 4584898..25f83c3 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -515,20 +515,28 @@ $(function() { }); //播放驗證碼語音 $(function () { - $('.ask-question') - .find('.controls button.fas.fa-volume-up') - .each(function () { - const $btn = $(this); + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + var label = isEn ? 'Play Captcha Voice' : '播放驗證碼語音'; - // 已經補過就不重複處理 - if ($btn.attr('aria-label')) return; + $('.ask-question') + .find('.controls button.fas.fa-volume-up') + .each(function () { + var $btn = $(this); - $btn.attr({ - 'aria-label': '播放驗證碼語音', - 'aria-controls': 'captcha_audio', - 'role': 'button' - }); - }); + $btn.attr({ + 'aria-label': label, + 'title': label, + 'aria-controls': 'captcha_audio', + 'role': 'button' + }); + + // ✅ 同步更新 sr-only 文字(若有) + var $sr = $btn.find('.sr-only'); + if ($sr.length > 0) { + $sr.text(label); + } + }); }); //刪除td的id @@ -913,7 +921,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; @@ -1981,27 +1989,68 @@ $(function() { }); //rucaptcha-image $(document).ready(function () { - $('.rucaptcha-image').removeAttr('onload'); - - // 檢查是否已插入過 - if (!$('#captcha_audio').length) { - const audioButton = $(` - - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); + function fixCaptchaImgA11y() { + setTimeout(function () { + // ✅ 先確認頁面上真的有驗證碼圖片,再往下執行 + if (!$('.rucaptcha-image').length) return; + + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + alt: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換', + title: isEn ? 'Captcha image, click to refresh' : '驗證碼圖片,點擊可更換', + label: isEn ? 'Click to refresh captcha' : '點擊更換驗證碼', + audioBtn: isEn ? 'Play captcha audio' : '播放驗證碼語音', + audioSrc: isEn ? '/rucaptcha/?format=wav&locale=en' : '/rucaptcha/?format=wav&locale=zh_tw' + }; + + var $captchaImg = $('.rucaptcha-image'); + + // ✅ 移除 onload + $captchaImg.removeAttr('onload'); + + // ✅ 補上有意義的 alt、role、tabindex、title + $captchaImg.attr({ + 'alt': i18n.alt, + 'title': i18n.title, + 'role': 'button', + 'tabindex': '0', + 'aria-label': i18n.label + }); + + // ✅ Enter / Space 觸發更換驗證碼 + $captchaImg.off('keydown.captchaA11y').on('keydown.captchaA11y', function (e) { + if (e.which === 13 || e.which === 32) { + e.preventDefault(); + $(this).trigger('click'); + } + }); + + // ✅ 插入語音按鈕和 audio(若還沒插入過) + if (!$('#captcha_audio').length) { + var $audioButton = $( + '' + ); + + var $audio = $(''); + + $captchaImg.after($audioButton, $audio); + } + + }, 500); } + + fixCaptchaImgA11y(); }); //萬用表格searchbtn2 @@ -3173,4 +3222,137 @@ $(document).ready(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(); + }); +//bannercontrolplay +$(function() { + function fixBannerPlayPauseA11y() { + setTimeout(function() { + var pageLang = ($('html').attr('lang') || 'zh-Hant').toLowerCase(); + var isEn = pageLang.startsWith('en'); + + var i18n = { + resume: isEn ? 'Play' : '繼續播放', + pause: isEn ? 'Pause' : '暫停播放' + }; + + $('.w-ba-banner').each(function() { + var $banner = $(this); + var $controlplay = $banner.find('.controlplay'); + + // ✅ 把 radiogroup 改為一般容器 + $controlplay.removeAttr('role aria-label'); + + // ✅ 繼續播放按鈕 + var $resume = $banner.find('.resume-slide'); + $resume + .attr('role', 'button') + .attr('aria-pressed', $resume.hasClass('active') ? 'true' : 'false') + .attr('aria-label', i18n.resume) + .attr('title', i18n.resume) + .removeAttr('aria-checked aria-live'); + + // ✅ 暫停播放按鈕 + var $pause = $banner.find('.pause-slide'); + $pause + .attr('role', 'button') + .attr('aria-pressed', $pause.hasClass('active') ? 'true' : 'false') + .attr('aria-label', i18n.pause) + .attr('title', i18n.pause) + .removeAttr('aria-checked aria-live'); + + // ✅ 點擊後同步 aria-pressed + $resume.off('click.bannerA11y').on('click.bannerA11y', function() { + $resume.attr('aria-pressed', 'true'); + $pause.attr('aria-pressed', 'false'); + }); + + $pause.off('click.bannerA11y').on('click.bannerA11y', function() { + $pause.attr('aria-pressed', 'true'); + $resume.attr('aria-pressed', 'false'); + }); + }); + + }, 800); + } + + fixBannerPlayPauseA11y(); +}); + }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index a6fbe7f..0e6d6ad 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -6,6 +6,11 @@ .fa-classic, .fa-regular, .fa-solid, .far, .fas ,.fa{ font-family: "FontAwesome"; } +li#language-li { + @media(max-width:767px){ + display: none !important; + } +} #orbit-bar .orbit-bar-inner > label:focus, #orbit-bar .orbit-bar-inner > label.focus{ .orbit-bar-search-sign-language{ display: block @@ -25,16 +30,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; @@ -208,6 +213,6 @@ img{ // overflow-x: auto; // } // } -*[data-pp]>.editmode-ps>a, .admin-subpart-area .content>.editmode-ps>a{ - position: !important; -} \ No newline at end of file +input[type=checkbox]:focus { + outline: 0.3125em auto -webkit-focus-ring-color; +} diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index 1997616..b559bb2 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -35,6 +35,7 @@ ul.button-mid{ width: 100%; height: 0; top: 50%; + z-index: 201; } .banner-pager .active-slide button{ background: $theme-color-second!important; @@ -44,6 +45,7 @@ ul.button-mid{ width: 100%; height: 0; top: 50%; + z-index: 201; } .next-button, .prev-button { cursor: pointer; @@ -264,12 +266,12 @@ ul.button-mid{ width: 100%; height: 100%; } - .banner-pager { - right: 1em; - top: -2em; - z-index: 100; - display: none; - } + // .banner-pager { + // right: 1em; + // top: -2em; + // z-index: 100; + // display: none; + // } .button-mid{ z-index: 101; } @@ -387,12 +389,12 @@ ul.button-mid{ } - .banner-pager { - right: 1em; - top: -2em; - z-index: 100; - display: none; - } + // .banner-pager { + // right: 1em; + // top: -2em; + // z-index: 100; + // display: none; + // } } // Widget 3 diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index bc4bd84..12af062 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -149,7 +149,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 */ @@ -158,7 +158,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/modules/member.scss b/assets/stylesheets/template/modules/member.scss index 960e8e3..2391770 100644 --- a/assets/stylesheets/template/modules/member.scss +++ b/assets/stylesheets/template/modules/member.scss @@ -750,13 +750,13 @@ } .member-data-value-4{ position: relative; - &:before{ - font-family: "Font Awesome 5 Free"; - font-weight: 900; - padding-right: 0.5em; - content: ""; - color: #0693e3; - } + // &:before{ + // font-family: "Font Awesome 5 Free"; + // font-weight: 900; + // padding-right: 0.5em; + // content: ""; + // color: #0693e3; + // } } .i-member-section { max-width: 31.25em; diff --git a/home/index.html.erb b/home/index.html.erb index 4c467ae..bb5fce5 100644 --- a/home/index.html.erb +++ b/home/index.html.erb @@ -81,13 +81,7 @@
-
-
-
- NATIONAL FORMOSA UNIVERSITY -
-
-
+
diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index 70ef492..b74bbbc 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/announcement/annc_index18.html.erb b/modules/announcement/annc_index18.html.erb index 778bb74..6ecfb02 100644 --- a/modules/announcement/annc_index18.html.erb +++ b/modules/announcement/annc_index18.html.erb @@ -3,7 +3,7 @@