update
This commit is contained in:
parent
ec417d0bed
commit
ce50cb345f
|
|
@ -1118,56 +1118,59 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// E. 重新計算標題 (關鍵邏輯:若 hasOriginalTitle 為真,則不進入此區塊)
|
// E. 重新計算標題 (關鍵邏輯:若 hasOriginalTitle 為真,則不進入此區塊)
|
||||||
if (!hasOriginalTitle) {
|
if (!hasOriginalTitle) {
|
||||||
if (linkText === "" && $img.length > 0) {
|
if (linkText === "" && $img.length > 0) {
|
||||||
var rawAlt = ($img.attr('alt') || '').trim();
|
var rawAlt = ($img.attr('alt') || '').trim();
|
||||||
var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', ''];
|
var forbidden = ['這是一張圖片', '圖片', 'image', 'photo', '圖', ''];
|
||||||
var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; })
|
var imgAlt = forbidden.some(function(txt) { return rawAlt.toLowerCase() === txt; })
|
||||||
? ($a.attr('aria-label') || i18n.link) : rawAlt;
|
? ($a.attr('aria-label') || i18n.link) : rawAlt;
|
||||||
|
|
||||||
var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : '';
|
var fileInfo = fileExt ? '[' + fileExt.toUpperCase() + '] ' : '';
|
||||||
$a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim());
|
$a.attr('title', (fileInfo + imgAlt + " " + windowTask).trim());
|
||||||
$img.attr('alt', imgAlt);
|
$img.attr('alt', imgAlt);
|
||||||
}
|
}
|
||||||
else if (linkText !== "") {
|
else if (linkText !== "") {
|
||||||
if (fileExt !== "" || hasBadSymbol || currentTitle === "" || currentTitle.includes('/uploads/')) {
|
if (fileExt !== "" || hasBadSymbol || currentTitle === "" || currentTitle.includes('/uploads/')) {
|
||||||
if (fileExt !== "") {
|
if (fileExt !== "") {
|
||||||
$a.attr('title', linkText + " ." + fileExt + " " + windowTask);
|
$a.attr('title', linkText + " ." + fileExt + " " + windowTask);
|
||||||
} else {
|
} else {
|
||||||
$a.attr('title', windowTask);
|
$a.attr('title', windowTask);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ✅ 符合 HM1240404E:title 不應與連結文字或圖片 alt 重複
|
// ✅ 符合 HM1240404E:title 不應與連結文字或圖片 alt 重複
|
||||||
if (hasOriginalTitle && currentTitle !== "") {
|
if (hasOriginalTitle && currentTitle !== "") {
|
||||||
var titleWithoutWindow = currentTitle
|
var titleWithoutWindow = currentTitle
|
||||||
.replace('(在本視窗開啟)', '')
|
.replace('(在本視窗開啟)', '')
|
||||||
.replace('(在新視窗開啟)', '')
|
.replace('(在新視窗開啟)', '')
|
||||||
.replace('Open in this window', '')
|
.replace('Open in this window', '')
|
||||||
.replace('Open in new window', '')
|
.replace('Open in new window', '')
|
||||||
.replace('另開新視窗前往', '')
|
.replace('另開新視窗前往', '')
|
||||||
.replace('另開新視窗', '')
|
.replace('另開新視窗', '')
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
// ✅ title 去掉開窗字串後,若與連結文字或圖片原始 alt 相同,則只保留開窗提示
|
// ✅ title 去掉開窗字串後,若與連結文字或圖片原始 alt 相同,則只保留開窗提示
|
||||||
if (
|
// ✅ 新增:若 linkText 包含副檔名且 title 也是同樣檔名,也只保留開窗提示
|
||||||
(titleWithoutWindow === linkText && linkText !== i18n.link) ||
|
if (
|
||||||
(imgAltOriginal !== '' && titleWithoutWindow === imgAltOriginal)
|
(titleWithoutWindow === linkText && linkText !== i18n.link) ||
|
||||||
) {
|
(imgAltOriginal !== '' && titleWithoutWindow === imgAltOriginal) ||
|
||||||
$a.attr('title', windowTask);
|
(fileExt !== '' && linkText.toLowerCase().endsWith('.' + fileExt) && titleWithoutWindow === linkText)
|
||||||
}
|
) {
|
||||||
|
$a.attr('title', windowTask);
|
||||||
// ✅ 最終清理:若 title 出現空括號 () 則移除並補上正確開窗提示
|
return; // ✅ 加上 return,避免繼續執行後面的清理邏輯造成二次污染
|
||||||
var finalTitle = ($a.attr('title') || '').trim();
|
|
||||||
if (finalTitle.includes('()')) {
|
|
||||||
finalTitle = finalTitle.replace(/\(\)/g, '').trim();
|
|
||||||
$a.attr('title', finalTitle + ' ' + windowTask);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ 最終清理:若 title 出現空括號 () 則移除並補上正確開窗提示
|
||||||
|
var finalTitle = ($a.attr('title') || '').trim();
|
||||||
|
if (finalTitle.includes('()')) {
|
||||||
|
finalTitle = finalTitle.replace(/\(\)/g, '').trim();
|
||||||
|
$a.attr('title', finalTitle + ' ' + windowTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// F. 最終清理:移除冗餘 label,避免螢幕閱讀器唸兩次
|
// F. 最終清理:移除冗餘 label,避免螢幕閱讀器唸兩次
|
||||||
$a.removeAttr('aria-label');
|
$a.removeAttr('aria-label');
|
||||||
});
|
});
|
||||||
|
|
@ -3323,6 +3326,41 @@ setTimeout(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
|
function fixSearchButtonA11y() {
|
||||||
|
var pageLang = $('html').attr('lang') || 'zh-Hant-TW';
|
||||||
|
var isEn = pageLang.toLowerCase().startsWith('en');
|
||||||
|
|
||||||
|
var label = isEn ? 'Submit site search' : '送出網內搜尋';
|
||||||
|
|
||||||
|
// 找搜尋表單內的送出按鈕
|
||||||
|
$('.search-container button[type="submit"], .search-box button[type="submit"], #search button[type="submit"]').each(function () {
|
||||||
|
var $btn = $(this);
|
||||||
|
|
||||||
|
// 修正 title
|
||||||
|
if (!$btn.attr('title') || $btn.attr('title').trim() === '按鈕' || $btn.attr('title').trim() === 'button') {
|
||||||
|
$btn.attr('title', label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修正 sr-only / visually-hidden span 文字
|
||||||
|
var $srSpan = $btn.find('.sr-only, .visually-hidden');
|
||||||
|
if ($srSpan.length) {
|
||||||
|
if ($srSpan.text().trim() === '按鈕' || $srSpan.text().trim() === 'button' || $srSpan.text().trim() === '') {
|
||||||
|
$srSpan.text(label);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 沒有 sr-only span 就補一個
|
||||||
|
$btn.find('i, svg').attr('aria-hidden', 'true');
|
||||||
|
$btn.append('<span class="sr-only">' + label + '</span>');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除 role="button"(button 本身已是 button)
|
||||||
|
$btn.removeAttr('role');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
setTimeout(fixSearchButtonA11y, 500);
|
||||||
|
});
|
||||||
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
||||||
// $(window).load(function() {
|
// $(window).load(function() {
|
||||||
// if ($('.index-member-3').length && $(window).width() > 992) {
|
// if ($('.index-member-3').length && $(window).width() > 992) {
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
label[for="open-orbit-login"] {
|
// label[for="open-orbit-login"] {
|
||||||
@media(max-width:768px){
|
// @media(max-width:768px){
|
||||||
display: none!important;
|
// display: none!important;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
[accesskey="U"],[accesskey="W"]{
|
// [accesskey="U"],[accesskey="W"]{
|
||||||
@media(max-width:768px){
|
// @media(max-width:768px){
|
||||||
color: #666!important;
|
// color: #666!important;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.orbit-bar-inner{
|
.orbit-bar-inner{
|
||||||
[accesskey="U"]{
|
[accesskey="U"]{
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
outline: 0.3125em auto -webkit-focus-ring-color !important;
|
outline: 0.3125em auto -webkit-focus-ring-color !important;
|
||||||
}
|
}
|
||||||
.layout-header {
|
.layout-header {
|
||||||
|
background-image:linear-gradient(180deg, transparent 0, #000000ba 30%, #000000fa);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ a.voice-player {
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
color: #ff6300;
|
color: #ff6300;
|
||||||
}
|
}
|
||||||
|
.btn-info{
|
||||||
|
background-color: #007da3;
|
||||||
|
border-color: #007da3;
|
||||||
|
}
|
||||||
.universal-th-text{
|
.universal-th-text{
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<div class="link-img-wrap{{display_image}}">
|
<div class="link-img-wrap{{display_image}}">
|
||||||
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
<img src="{{img_src}}" alt="{{img_description}}" title="{{img_description}}">
|
||||||
</div>
|
</div>
|
||||||
<a class="widget-content-title" href="{{link_to_show}}" target="{{target}}" title="{{title_text}}">{{title}}</a>
|
<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">
|
<span data-list="statuses" data-level="1">
|
||||||
<span class="label status {{status-class}}">{{status}}</span>
|
<span class="label status {{status-class}}">{{status}}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue