diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 8fe60cf..cd3d6eb 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -291,9 +291,19 @@ // 無障礙:聚焦第一個互動元素 if ($('.mobile-menu').hasClass('active')) { - setTimeout(function () { - $('.modules-menu').find('input, button, select, textarea, a').first().focus(); - }, 100); + var $target = $($('.navbar-toggle').first().attr('data-bs-target')); + + if ($target.length) { + // 有 Bootstrap collapse → 等展開動畫完成再 focus + $target.one('shown.bs.collapse', function() { + $('.modules-menu').find('input, button, select, textarea, a').filter(':visible').first().focus(); + }); + } else { + // 無 Bootstrap collapse → 直接 setTimeout + setTimeout(function() { + $('.modules-menu').find('input, button, select, textarea, a').filter(':visible').first().focus(); + }, 100); + } } }); @@ -2414,7 +2424,63 @@ $(document).ready(function() { init(); }); +//post +$(document).ready(function () { + setTimeout(function () { + $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { + $(this).attr('title', '分享至 X 在新視窗開啟'); + }); + }, 1500); +}); +$(function() { + function bindIframeFocus() { + var $iframe = $('.twitter-share-button'); + if ($iframe.length === 0) return; + $iframe.each(function() { + var $wrap = $(this).closest('.tw-share-button'); + + // 讓外層可以被 tab 到並顯示焦點框 + $wrap.attr('tabindex', '-1'); + + $(window).on('blur.twitterFocus', function() { + setTimeout(function() { + if (document.activeElement && + $(document.activeElement).hasClass('twitter-share-button')) { + $wrap.css({ + 'outline': '3px solid #005fcc', + 'outline-offset': '2px', + 'border-radius': '2px' + }); + } + }, 100); + }); + + $(window).on('focus.twitterFocus', function() { + $wrap.css({ + 'outline': '', + 'outline-offset': '' + }); + }); + }); + } + + // 用 MutationObserver 等 iframe 被 Twitter script 插入後才綁定 + var observer = new MutationObserver(function(mutations) { + if ($('.twitter-share-button').length > 0) { + bindIframeFocus(); + observer.disconnect(); // 綁定成功後停止監聽 + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true + }); + + // 保險:2秒後強制執行一次 + setTimeout(bindIframeFocus, 1000); +}); //orbitbar無障礙js $(document).ready(function() { const isEnglish = document.documentElement.lang === 'en'; @@ -3022,6 +3088,9 @@ $(function() { var target = document.getElementById('gallery-theater-stage'); if (!target) return; + // 頁面載入時若已存在 #gallery-theater-stage,則還原 z-index + $('.verticalhome').css('z-index', 'auto'); + var observer = new MutationObserver(function() { var display = target.style.display; if (display === 'block') { @@ -3161,5 +3230,34 @@ $(document).ready(function () { fixSearchInputA11y(); }, 500); }); +//a無障礙空連結 +function removeHiddenContentLinks() { + // 若網址含有 editmode=on 則不執行 + if (window.location.href.indexOf('editmode=on') !== -1) return; + $('a').each(function () { + var $link = $(this); + + // 若連結本身是 display:none,直接移除 + if ($link.css('display') === 'none') { + $link.remove(); + return; + } + + // 若連結內有子元素,且全部都是 display:none + var $children = $link.children(); + if ($children.length > 0) { + var allHidden = $children.toArray().every(function (child) { + return $(child).css('display') === 'none'; + }); + if (allHidden) { + $link.remove(); + } + } + }); +} + +$(document).ready(function () { + setTimeout(removeHiddenContentLinks, 500); +}); }(jQuery, window)); diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index 9807367..50cd302 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -2,12 +2,60 @@ @import "../initial"; @import "variables"; +.fa-classic, .fa-regular, .fa-solid, .far, .fas ,.fa{ + font-family: var(--fa-style-family, "FontAwesome")!important; +} #orbit-bar .orbit-bar-inner > label:focus, #orbit-bar .orbit-bar-inner > label.focus{ .orbit-bar-search-sign-language{ display: block } } +#orbit-bar .orbit-bar-menu .orbit-bar-logo{ + cursor: unset!important; +} +.login-btn:focus { + outline: 0.3125em auto -webkit-focus-ring-color !important; + transition: all 0.2s ease-in-out!important; +} +.orbit-bar-inner{ + li.active { + @media(min-width:768px){ + padding: 0 !important; + } + } +} +label[for="open-orbit-login"] { + @media(max-width:768px){ + display: none!important; + } +} +[accesskey="U"],[accesskey="W"]{ + @media(max-width:768px){ + color: #666!important; + } +} +.orbit-bar-inner{ + [accesskey="U"]{ + height: 40px; + display: inline-block!important; + line-height: 40px; + float: left; + @media(min-width:769px){ + color: #fff!important; + } + } + [accesskey="W"]{ + height: 40px; + display: inline-block!important; + line-height: 40px; + float: left; + color: #fff!important; + @media(min-width:769px){ + color: #fff!important; + } + } +} .orbit-bar-search-sign-language{ @media(max-width:767px){ position: absolute !important; @@ -19,12 +67,12 @@ } body #orbit-bar .orbit-bar-search-sign-language #search input[type="search"]{ &:hover{ - outline: 3px solid $theme-color-third; + outline: 3px solid $theme-color-second; background-color: #e6f0ff; border-radius: 4px; } &:focus{ - outline: 3px solid $theme-color-third; + outline: 3px solid $theme-color-second; background-color: #e6f0ff; border-radius: 4px; } diff --git a/home/footer.html.erb b/home/footer.html.erb index 847e745..9cfe4dd 100644 --- a/home/footer.html.erb +++ b/home/footer.html.erb @@ -2,7 +2,6 @@ diff --git a/modules/ad_banner/_ad_banner_widget0.html.erb b/modules/ad_banner/_ad_banner_widget0.html.erb index 47ca813..9ba89ce 100644 --- a/modules/ad_banner/_ad_banner_widget0.html.erb +++ b/modules/ad_banner/_ad_banner_widget0.html.erb @@ -76,6 +76,14 @@ $caption.after($controlplay); }, 500); + + $('.ba-banner-widget-0 .w-ad-banner__slide a') + .on('focus', function() { + $('.ba-banner-widget-0 img').css('position', 'relative'); + }) + .on('blur', function() { + $('.ba-banner-widget-0 img').css('position', ''); + }); }); diff --git a/modules/custom_gallery/custom_gallery_index2.html.erb b/modules/custom_gallery/custom_gallery_index2.html.erb index dceb6f4..02b6e61 100644 --- a/modules/custom_gallery/custom_gallery_index2.html.erb +++ b/modules/custom_gallery/custom_gallery_index2.html.erb @@ -6,7 +6,7 @@
- {{alt_title}} + {{album-name}}

diff --git a/modules/custom_gallery/custom_gallery_index4.html.erb b/modules/custom_gallery/custom_gallery_index4.html.erb index 8e69c37..a937910 100644 --- a/modules/custom_gallery/custom_gallery_index4.html.erb +++ b/modules/custom_gallery/custom_gallery_index4.html.erb @@ -6,7 +6,7 @@
- {{alt_title}} + {{album-name}}

diff --git a/modules/gallery/_gallery_widget2.html.erb b/modules/gallery/_gallery_widget2.html.erb index f53fce3..290bc3b 100644 --- a/modules/gallery/_gallery_widget2.html.erb +++ b/modules/gallery/_gallery_widget2.html.erb @@ -10,7 +10,7 @@ {{thumb-large-src}} 1024w, {{thumb-src}} 768w" src="{{thumb-src}}" - alt="{{alt_title}}" + alt="{{album-name}}" > diff --git a/modules/gallery/gallery_index2.html.erb b/modules/gallery/gallery_index2.html.erb index 2131dcb..1a3bade 100644 --- a/modules/gallery/gallery_index2.html.erb +++ b/modules/gallery/gallery_index2.html.erb @@ -5,14 +5,14 @@
- +
- {{alt_title}} + {{album-name}}

- {{album-name}} + {{album-name}}

{{album-description}}
diff --git a/modules/gallery/gallery_index3.html.erb b/modules/gallery/gallery_index3.html.erb index 89126ca..7694082 100644 --- a/modules/gallery/gallery_index3.html.erb +++ b/modules/gallery/gallery_index3.html.erb @@ -4,7 +4,7 @@

- +
diff --git a/modules/gallery/gallery_index4.html.erb b/modules/gallery/gallery_index4.html.erb index 7a70ddd..13c7853 100644 --- a/modules/gallery/gallery_index4.html.erb +++ b/modules/gallery/gallery_index4.html.erb @@ -5,14 +5,14 @@
- +
- {{alt_title}} + {{album-name}}
diff --git a/modules/gallery/gallery_index5.html.erb b/modules/gallery/gallery_index5.html.erb index 0847325..a3d556e 100644 --- a/modules/gallery/gallery_index5.html.erb +++ b/modules/gallery/gallery_index5.html.erb @@ -8,11 +8,11 @@
- + {{alt_title}} diff --git a/modules/gallery/gallery_index6.html.erb b/modules/gallery/gallery_index6.html.erb index 19c9cc0..a6664bc 100644 --- a/modules/gallery/gallery_index6.html.erb +++ b/modules/gallery/gallery_index6.html.erb @@ -6,14 +6,14 @@