This commit is contained in:
ken 2026-04-10 19:11:57 +08:00
parent 2d9352f79f
commit 7ae3e05c24
1 changed files with 17 additions and 17 deletions

View File

@ -961,9 +961,9 @@ $(function() {
} }
// 符合規範:圖文並存時,圖片 alt 應為空值 // 符合規範:圖文並存時,圖片 alt 應為空值
if ($img.length > 0) { // if ($img.length > 0) {
$img.attr('alt', ''); // $img.attr('alt', '');
} // }
} }
// 5. 最終清理 // 5. 最終清理
@ -980,22 +980,22 @@ $(function() {
setTimeout(fixAccessibilityAll, 500); setTimeout(fixAccessibilityAll, 500);
}); });
if (location.href.search('editmode=on') === -1) { // if (location.href.search('editmode=on') === -1) {
// 1. 處理圖片 alt 重複問題 (保持原邏輯但優化) // // 1. 處理圖片 alt 重複問題 (保持原邏輯但優化)
$('a').has('img').each(function () { // $('a').has('img').each(function () {
const $link = $(this); // const $link = $(this);
const linkText = $link.text().trim(); // const linkText = $link.text().trim();
$link.find('img').each(function () { // $link.find('img').each(function () {
const $img = $(this); // const $img = $(this);
const altText = $img.attr('alt')?.trim(); // const altText = $img.attr('alt')?.trim();
if (altText && altText === linkText) { // if (altText && altText === linkText) {
$img.attr('alt', ''); // $img.attr('alt', '');
} // }
}); // });
}); // });
} // }
$(function() { $(function() {
function smartFixIcons() { function smartFixIcons() {
$('i').each(function() { $('i').each(function() {