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