From 26d7c5eddf14171da7acfd604bf5d7f04b0503e9 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 2 Sep 2026 20:20:30 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 76 ++++++-- assets/stylesheets/template/base/_global.scss | 8 +- .../stylesheets/template/layout/content.scss | 7 + modules/archive/archive_index2.html.erb | 3 +- modules/member/member_index2.html.erb | 6 +- modules/member/member_index9.html.erb | 2 +- modules/text_marquee/_widget.html.erb | 171 ++++++++++++++---- .../web_resource/_web_res_widget8.html.erb | 3 +- 8 files changed, 221 insertions(+), 55 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 0a12577..5defeeb 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -533,20 +533,28 @@ $(document).ready(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 @@ -3429,6 +3437,50 @@ $(document).ready(function () { // 比 fixAccessibilityAll 的 800ms 晚,確保最後執行 setTimeout(fixGalleryViewLinkA11y, 2000); }); +//No History Records +function fixTicketHistoryStatusA11y() { + var $form = $('#check_history_form'); + if (!$form.length) return; + + // 建立 role=status 播報區(若不存在) + if (!$('#ticket-history-result-status').length) { + $form.after('
'); + } + + var $statusBox = $('#ticket-history-result-status'); + + // MutationObserver 監聽 #history_area 的變化 + var $historyArea = $('#history_area'); + if (!$historyArea.length) return; + + var observer = new MutationObserver(function () { + var $noRecord = $historyArea.find('span.translation_missing'); + if ($noRecord.length) { + // 取得文字(顯示文字或 title 屬性) + var msg = $noRecord.text().trim() || $noRecord.attr('title') || 'No History Records'; + + // 把訊息寫入 role=status 區塊觸發播報 + $statusBox.text('').text(msg); + + // 同時在 span 上加 role=status(雙保險) + if ($noRecord.attr('role') !== 'status') { + $noRecord.attr('role', 'status').attr('aria-live', 'polite').attr('aria-atomic', 'true'); + } + } else { + // 有查到結果時清空播報區 + $statusBox.text(''); + } + }); + + observer.observe($historyArea[0], { + childList: true, + subtree: true + }); +} + +$(document).ready(function () { + setTimeout(fixTicketHistoryStatusA11y, 500); +}); //會員 $(function() { function fixMemberAcademicLinkA11y() { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index b5ee77e..c520561 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -214,6 +214,10 @@ img{ // overflow-x: auto; // } // } -*[data-pp]>.editmode-ps>a, .admin-subpart-area .content>.editmode-ps>a{ - position: !important; +input[type=checkbox]:focus { + outline: 0.3125em auto -webkit-focus-ring-color!important; +} +button.fas.fa-volume-up:focus { + outline: 0.3125em auto -webkit-focus-ring-color!important; + outline-offset: -0.125em!important; } \ No newline at end of file diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index a56fb95..23c68ee 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,13 @@ @charset "utf-8"; @import "../initial"; +.ask-question-form .form-actions input { + float: none !important; + margin-right: 1em; +} +.ask-question .form-horizontal .form-actions { + text-align: end!important; +} .line-it-button{ .label{ color: #333!important; diff --git a/modules/archive/archive_index2.html.erb b/modules/archive/archive_index2.html.erb index 8befccd..054a806 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/member/member_index2.html.erb b/modules/member/member_index2.html.erb index 01a79dd..555a6fa 100644 --- a/modules/member/member_index2.html.erb +++ b/modules/member/member_index2.html.erb @@ -8,9 +8,9 @@
- - - + + {{name}} +
    diff --git a/modules/member/member_index9.html.erb b/modules/member/member_index9.html.erb index f7387ec..064ca5d 100644 --- a/modules/member/member_index9.html.erb +++ b/modules/member/member_index9.html.erb @@ -9,7 +9,7 @@
    diff --git a/modules/text_marquee/_widget.html.erb b/modules/text_marquee/_widget.html.erb index 5fdde4f..c410cb1 100644 --- a/modules/text_marquee/_widget.html.erb +++ b/modules/text_marquee/_widget.html.erb @@ -1,40 +1,143 @@
    -

    - {{widget-title}} -

    -
      -
    • {{content}}
    • -
    +
    +

    + {{widget-title}} +

    + +
    +
      +
    • {{content}}
    • +
    - + + + - - - + main_div.find("ul li").hide(); + function textTransform() { + if (isPaused) return; + current_text++; + current_text = (current_text > total_texts ? 0 : current_text); + last_text = (current_text == 0 ? total_texts : current_text - 1); + + var speed = main_div.find('.marquee > li > a').eq(current_text).attr('speed'); + + main_div.find("ul li").eq(last_text).slideUp(500); + main_div.find("ul li").eq(current_text).slideDown(500); + + if (total_texts > 0) { + timer = setTimeout(textTransform, speed); + } + } + + function pauseAll() { + isPaused = true; + clearTimeout(timer); + $pauseBtn.attr('aria-checked', 'true').addClass('active'); + $resumeBtn.attr('aria-checked', 'false').removeClass('active'); + } + + function resumeAll() { + isPaused = false; + $resumeBtn.attr('aria-checked', 'true').addClass('active'); + $pauseBtn.attr('aria-checked', 'false').removeClass('active'); + var speed = main_div.find('.marquee > li > a').eq(current_text).attr('speed') || 500; + timer = setTimeout(textTransform, speed); + } + + $resumeBtn.on('click', function(e) { + e.preventDefault(); + if (isPaused) resumeAll(); + }); + + $pauseBtn.on('click', function(e) { + e.preventDefault(); + if (!isPaused) pauseAll(); + }); + + $resumeBtn.addClass('active').attr('aria-checked', 'true'); + $pauseBtn.attr('aria-checked', 'false'); + + timer = setTimeout(textTransform, 500); + })(); + \ No newline at end of file diff --git a/modules/web_resource/_web_res_widget8.html.erb b/modules/web_resource/_web_res_widget8.html.erb index 009ceac..995623b 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}}
    +