This commit is contained in:
ken 2026-08-14 10:26:28 +08:00
parent f4a7506328
commit ab355dda50
12 changed files with 170 additions and 62 deletions

View File

@ -1107,56 +1107,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);
}
}
}
}
// ✅ 符合 HM1240404Etitle 不應與連結文字或圖片 alt 重複
if (hasOriginalTitle && currentTitle !== "") {
var titleWithoutWindow = currentTitle
.replace('(在本視窗開啟)', '')
.replace('(在新視窗開啟)', '')
.replace('Open in this window', '')
.replace('Open in new window', '')
.replace('另開新視窗前往', '')
.replace('另開新視窗', '')
.trim();
// ✅ 符合 HM1240404Etitle 不應與連結文字或圖片 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');
});
@ -1190,6 +1193,47 @@ $(function() {
fixAccessibilityAll();
}, 800);
});
// 修正漢堡選單按鈕無障礙
$(function() {
function fixNavbarToggleA11y() {
var isEn = $('html').attr('lang') === 'en';
var label = isEn ? '開啟或關閉導覽選單' : '開啟或關閉導覽選單';
$('.navbar-toggle').each(function() {
var $btn = $(this);
// 修正 title
$btn.attr('title', label);
// 修正 sr-only 文字(原本是 "Toggle navigation"
var $sr = $btn.find('.sr-only');
if ($sr.length) {
$sr.text(label);
} else {
$btn.prepend('<span class="sr-only">' + label + '</span>');
}
// 補上 aria-label
$btn.attr('aria-label', label);
// 補上 aria-expanded依據目前是否展開
if (!$btn.attr('aria-expanded')) {
var isExpanded = !$btn.hasClass('collapsed');
$btn.attr('aria-expanded', isExpanded ? 'true' : 'false');
}
// 點擊時同步更新 aria-expanded
$btn.off('click.navA11y').on('click.navA11y', function() {
setTimeout(function() {
var isExpanded = !$('.navbar-toggle').hasClass('collapsed');
$('.navbar-toggle').attr('aria-expanded', isExpanded ? 'true' : 'false');
}, 50);
});
});
}
setTimeout(fixNavbarToggleA11y, 500);
});
$(function() {
@ -3150,9 +3194,7 @@ $(document).ready(function() {
});
});
setTimeout(function() {
$('.internal-page [data-pp="300"] .w-ba-banner__image').attr('alt', '');
}, 500);
//會員tab邏輯
$(document).ready(function () {
setTimeout(function () {
@ -3220,7 +3262,7 @@ $(document).ready(function () {
});
function removeBareUrlLinks() {
setTimeout(function() {
$('#table0_wrapper td a').each(function() {
$('.dataTables_wrapper a').each(function() {
var $a = $(this);
var text = $a.text().trim();
@ -3250,5 +3292,59 @@ $(document).ready(function () {
// ORBITFRONT.member.equalHeight('.i-member-item-inner');
// }
// });
setTimeout(function() {
$('.internal-page [data-pp="300"] .w-ba-banner__image').attr('alt', '');
}, 700);
function fixMemberDownloadLinkA11y() {
$('.i-member-item').each(function () {
var $item = $(this);
// 取得教師姓名(從 alt 或姓名連結文字)
var teacherName = $item.find('.i-member-pic').attr('alt') ||
$item.find('.member-data-value-name a').text().trim() ||
'';
if (!teacherName) return;
// 找到個人資料欄位內的所有下載連結
$item.find('.member-data-value-6 a').each(function () {
var $link = $(this);
var linkText = $link.text().trim();
// 只處理「下載論文附件」或類似通用文字的連結
var isGeneric = !linkText ||
linkText === '下載論文附件' ||
linkText === '下載附件' ||
linkText === '下載' ||
linkText === 'Download';
if (isGeneric) {
var newTitle = teacherName + '' + (linkText || '下載論文附件');
$link.attr('title', newTitle);
$link.attr('aria-label', newTitle);
} else {
// 連結文字有意義但 title 仍補上教師姓名
var currentTitle = ($link.attr('title') || '').trim();
if (!currentTitle || currentTitle.indexOf(teacherName) === -1) {
$link.attr('title', teacherName + '' + linkText);
$link.attr('aria-label', teacherName + '' + linkText);
}
}
});
// 同時處理姓名連結的 title補上教師姓名
$item.find('.member-data-value-name a').each(function () {
var $link = $(this);
var currentTitle = ($link.attr('title') || '').trim();
if (!currentTitle || currentTitle === '在本視窗開啟') {
$link.attr('title', teacherName + '的個人頁面(在本視窗開啟)');
}
});
});
}
$(document).ready(function () {
setTimeout(fixMemberDownloadLinkA11y, 500);
});
}(jQuery, window));

View File

@ -16,10 +16,10 @@ $theme-red: #d20001;
$theme-blue: #003d7e;
$theme-color-main: #333333;
$theme-color-second:#3d78ae;
$theme-color-third: #3d78ae;
$theme-color-second:#2268aa;
$theme-color-third: #2268aa;
$theme-color-green: #32D9C3;
$theme-color-hover:#3d78ae;
$theme-color-hover:#2268aa;
.fa, .fa-classic, .fa-regular, .fa-solid, .far, .fas {
font-family: "Font Awesome 6 Free", FontAwesome;

View File

@ -150,7 +150,7 @@
}
/* 2. 對應的檔案顏色 (轉為 iOS 半透明色調) */
.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 */
@ -159,7 +159,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;

View File

@ -7,7 +7,20 @@
//
// Member Index
// ## Gerneral styles for Index
.i-member-value{
a{
span{
color: #0a69a9!important;
}
}
}
.member-data{
a{
span{
color: #0a69a9!important;
}
}
}
.i-member-profile-item{
list-style: none;
word-break: break-all;

View File

@ -18,8 +18,7 @@
<div class="panel-body">
<ul class="i-archive-files-list" data-list="files" data-level="2">
<li>
<a href="{{file-url}}" class="i-archive-files-item" target="{{target}}" title="{{file-name}}">{{file-name}}</a>
<span class="label label-primary {{file-type}}">{{file-type}}</span>
<a href="{{file-url}}" class="i-archive-files-item" target="{{target}}" title="{{file-name}}">{{file-name}}<span class="label label-primary {{file-type}}">{{file-type}}</span></a>
</li>
</ul>
</div>

View File

@ -6,7 +6,7 @@
<li class="widget-content">
<div class="link-img-wrap{{display_image}}">
<a href="{{link_to_show}}" target="{{target}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</a>
</div>
<span data-list="statuses" data-level="1">

View File

@ -7,7 +7,7 @@
<div class="link-img-wrap{{display_image}}">
<a href="{{link_to_show}}" target="{{target}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</a>
</div>
<div class="widget-content-title">

View File

@ -6,7 +6,7 @@
<li class="widget-content widget-content-horizontal ">
<a href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">
<div class="link-img-wrap{{display_image}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</div>
</a>
<div class="widget-content-title">

View File

@ -6,7 +6,7 @@
<li class="widget-content widget-content-horizontal col-sm-6">
<a href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">
<div class="link-img-wrap{{display_image}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</div>
<div class="widget-content-title">
<a class="" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">{{title}}</a>

View File

@ -7,7 +7,7 @@
<div class="hex-border">
<a href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">
<div class="link-img-wrap{{display_image}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</div>
<a class="widget-content-title" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}" onclick="{{onclick}}">{{title}}</a>
<span data-list="statuses" data-level="1">

View File

@ -6,7 +6,7 @@
<li class="index-content">
<a class="index-content-title" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">
<div class="link-img-wrap{{display_image}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</div>
<h4>
{{title}}

View File

@ -6,7 +6,7 @@
<li class="index-content col-md-4 col-sm-4">
<a class="index-content-title" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">
<div class="link-img-wrap{{display_image}}">
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
<img src="{{img_src}}" alt="{{img_description}}">
</div>
<h4>
<span class="link-title">