From 4c27badde7cf61d24ffa92e111fd26e818c6a1b9 Mon Sep 17 00:00:00 2001 From: ken Date: Thu, 30 Jul 2026 15:36:16 +0800 Subject: [PATCH] update --- assets/javascripts/app.js | 211 ++++++++++++------ assets/stylesheets/template/base/_global.scss | 5 +- .../template/base/_go_back_top.scss | 3 +- .../stylesheets/template/layout/content.scss | 5 + .../template/modules/ad_banner.scss | 8 +- .../template/modules/announcement.scss | 11 +- .../template/modules/archives.scss | 24 +- assets/stylesheets/template/modules/menu.scss | 2 +- assets/stylesheets/template/template.scss | 4 +- modules/ad_banner/_ad_banner_widget2.html.erb | 4 +- .../custom_gallery_index1.html.erb | 2 +- .../custom_gallery_index3.html.erb | 2 +- modules/gallery/gallery_index1.html.erb | 7 +- modules/gallery/gallery_index2.html.erb | 4 +- modules/gallery/gallery_index3.html.erb | 6 +- modules/gallery/gallery_index4.html.erb | 4 +- modules/gallery/gallery_index5.html.erb | 4 +- modules/gallery/gallery_index6.html.erb | 6 +- .../web_resource/_web_res_widget9.html.erb | 2 +- 19 files changed, 194 insertions(+), 120 deletions(-) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 315267a..a17f50e 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -321,69 +321,80 @@ } }, - ClickMenuHandler: function() { - // 處理主選單切換(漢堡 icon) - $(document).on('click', '.navbar-toggle', function (e) { - e.preventDefault(); + ClickMenuHandler: function() { + // 處理主選單切換(漢堡 icon) + $(document).on('click', '.navbar-toggle', function (e) { + e.preventDefault(); - // 確保 .navbar-toggle 放到 .modules-menu 後面 - $('.mobile-menu').each(function () { - var $menu = $(this); - if ($menu.find('.modules-menu').length && !$menu.find('.modules-menu + .navbar-toggle').length) { - $menu.find('.modules-menu').after($menu.find('.navbar-toggle')); - } - }); - - $('.mobile-menu').toggleClass('active'); - $('body').toggleClass('noscroll'); - $('.mobile-menu .navbar-toggle').removeClass('collapsed'); - - // 關閉所有下拉選單 - $('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500); - $('.mobile-menu1 > .menu-drop, .mobile-menu2 > .menu-drop').removeClass('opened'); - - // 無障礙:聚焦第一個互動元素 - if ($('.mobile-menu').hasClass('active')) { - setTimeout(function () { - $('.modules-menu').find('input, button, select, textarea, a').first().focus(); - }, 100); + // 確保 .navbar-toggle 放到 .modules-menu 後面 + $('.mobile-menu').each(function () { + var $menu = $(this); + if ($menu.find('.modules-menu').length && !$menu.find('.modules-menu + .navbar-toggle').length) { + $menu.find('.modules-menu').after($menu.find('.navbar-toggle')); } }); - $('.mobile-menu1 > .menu-drop').click(function(){ - var $that = $(this); - var opencheck1 = $that.hasClass('opened'); - if ( opencheck1 == 0 ) { - $('.mobile-menu1 > ul').not($that.siblings('ul')).slideUp(500); - $('.mobile-menu1 > .menu-drop').not($that).removeClass('opened'); - $('.mobile-menu2 > ul').slideUp(500); - $('.mobile-menu2 > .menu-drop').removeClass('opened'); - $that.siblings('ul').slideDown(500); - $that.addClass('opened'); + $('.mobile-menu').toggleClass('active'); + $('body').toggleClass('noscroll'); + $('.mobile-menu .navbar-toggle').removeClass('collapsed'); - } else if (opencheck1 == 1) { - $that.siblings('ul').slideUp(500); - $('.mobile-menu2 > ul').slideUp(500); - $('.mobile-menu2 > .menu-drop').removeClass('opened'); - $that.removeClass('opened'); + // 關閉所有下拉選單 + $('.mobile-menu1 > ul, .mobile-menu2 > ul').slideUp(500); + $('.mobile-menu1 > .menu-drop, .mobile-menu2 > .menu-drop').removeClass('opened'); - } - }) + // 無障礙:聚焦第一個互動元素 + if ($('.mobile-menu').hasClass('active')) { + setTimeout(function () { + $('.modules-menu').find('input, button, select, textarea, a').first().focus(); + }, 100); + } + }); + // ✅ Tab 鍵跳過 .navbar-toggle 時,觸發與點擊相同的收合邏輯 + $(document).on('focusout', '.mobile-menu', function(e) { + setTimeout(function() { + var $newFocus = $(document.activeElement); + // 焦點已離開 .mobile-menu 且選單是展開狀態 + if ($('.mobile-menu').hasClass('active') && $newFocus.closest('.mobile-menu').length === 0) { + // ✅ 直接 trigger click,與按下 .navbar-toggle 執行完全相同的動作 + $('.navbar-toggle').first().trigger('click'); + } + }, 50); + }); - $('.mobile-menu2 > .menu-drop').click(function(){ - var $that = $(this); - var opencheck2 = $that.hasClass('opened'); - if ( opencheck2 == 0 ) { - $('.mobile-menu2 > ul').not($that.siblings('ul')).slideUp(500); - $('.mobile-menu2 > .menu-drop').not($that).removeClass('opened'); - $that.siblings('ul').slideDown(500); - $that.addClass('opened'); - } else if (opencheck2 == 1) { - $that.siblings('ul').slideUp(500); - $that.removeClass('opened'); - } - }) - } + $('.mobile-menu1 > .menu-drop').click(function(){ + var $that = $(this); + var opencheck1 = $that.hasClass('opened'); + if ( opencheck1 == 0 ) { + $('.mobile-menu1 > ul').not($that.siblings('ul')).slideUp(500); + $('.mobile-menu1 > .menu-drop').not($that).removeClass('opened'); + $('.mobile-menu2 > ul').slideUp(500); + $('.mobile-menu2 > .menu-drop').removeClass('opened'); + $that.siblings('ul').slideDown(500); + $that.addClass('opened'); + + } else if (opencheck1 == 1) { + $that.siblings('ul').slideUp(500); + $('.mobile-menu2 > ul').slideUp(500); + $('.mobile-menu2 > .menu-drop').removeClass('opened'); + $that.removeClass('opened'); + + } + }) + + $('.mobile-menu2 > .menu-drop').click(function(){ + var $that = $(this); + var opencheck2 = $that.hasClass('opened'); + if ( opencheck2 == 0 ) { + $('.mobile-menu2 > ul').not($that.siblings('ul')).slideUp(500); + $('.mobile-menu2 > .menu-drop').not($that).removeClass('opened'); + $that.siblings('ul').slideDown(500); + $that.addClass('opened'); + } else if (opencheck2 == 1) { + $that.siblings('ul').slideUp(500); + $that.removeClass('opened'); + } + }) + } }; // 把orbit物件加到window物件裡面並改名為ORBITFRONT來減少名稱衝突的機會 @@ -648,7 +659,7 @@ } }); if (document.documentElement.lang === 'zh_tw') { - document.documentElement.lang = 'zh-Hant'; + document.documentElement.lang = 'zh-Hant-TW'; } //tab鍵按下 $(document).on('keydown', function(e) { @@ -761,20 +772,20 @@ $(this).attr("style", newStyle); } }); - //表格scope - $("table").each(function() { - $(this).find("tr").each(function(rowIndex) { - $(this).find("th").each(function(colIndex) { - if (rowIndex === 0) { - // 第一列的 th,適用於該欄 - $(this).attr("scope", "col"); - } else if (colIndex === 0) { - // 其他列的第一個 th,適用於該行 - $(this).attr("scope", "row"); - } - }); - }); - }); + // //表格scope + // $("table").each(function() { + // $(this).find("tr").each(function(rowIndex) { + // $(this).find("th").each(function(colIndex) { + // if (rowIndex === 0) { + // // 第一列的 th,適用於該欄 + // $(this).attr("scope", "col"); + // } else if (colIndex === 0) { + // // 其他列的第一個 th,適用於該行 + // $(this).attr("scope", "row"); + // } + // }); + // }); + // }); $(".banner-pager button").addClass('banner-pagerbtn'); $(".banner-pager button").attr("type","button"); $(".banner-pager button").append('下一張'); @@ -970,7 +981,7 @@ $(function() { var urlParams = new URLSearchParams(window.location.search); var isEditMode = urlParams.get('editmode') === 'on'; - var pageLang = $('html').attr('lang') || 'zh-Hant'; + var pageLang = $('html').attr('lang') || 'zh-Hant-TW'; var isEn = pageLang.toLowerCase().startsWith('en'); var i18n = { @@ -1059,8 +1070,7 @@ $(function() { currentTitle.includes('Open in new window') || currentTitle.includes('/uploads/'); - // 修正後:只有在沒有原始 title 時才清空 - if (!hasOriginalTitle && (currentTitle.startsWith('/') || currentTitle.includes('?'))) { + if (currentTitle.startsWith('/') || currentTitle.includes('?')) { currentTitle = ""; } @@ -2871,6 +2881,7 @@ $(document).ready(function () { } }); }); +//post $(document).ready(function () { setTimeout(function () { $('iframe.twitter-share-button, iframe.twitter-tweet-button').each(function () { @@ -2878,6 +2889,55 @@ $(document).ready(function () { }); }, 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); +}); //orbitbarlogo無障礙 $(function() { var $logo = $('.orbit-bar-logo'); @@ -2923,6 +2983,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') { diff --git a/assets/stylesheets/template/base/_global.scss b/assets/stylesheets/template/base/_global.scss index fc0ee2d..e9dc0d5 100644 --- a/assets/stylesheets/template/base/_global.scss +++ b/assets/stylesheets/template/base/_global.scss @@ -4,13 +4,16 @@ @import "variables"; .fa-classic, .fa-regular, .fa-solid, .far, .fas ,.fa{ - font-family: var(--fa-style-family, "FontAwesome"); + font-family: "FontAwesome"; } #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; diff --git a/assets/stylesheets/template/base/_go_back_top.scss b/assets/stylesheets/template/base/_go_back_top.scss index 9536005..b34df26 100644 --- a/assets/stylesheets/template/base/_go_back_top.scss +++ b/assets/stylesheets/template/base/_go_back_top.scss @@ -15,9 +15,8 @@ font-size: 0.750em; border-radius: 0.125em; z-index: 1050; - opacity: .8; &:hover { - background:#cc0066; + background:#6e0037; } } diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 5aa6e3c..8c94ecf 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -1,6 +1,11 @@ @charset "utf-8"; @import "../initial"; +.line-it-button{ + .label{ + color: #333!important; + } +} .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9{ @media(max-width: $screen-xs){ padding: 0; diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index e85c5a2..9a79bed 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -30,9 +30,11 @@ ul.button-mid{ } } } -ul.button-mid{ - margin:0; - z-index: 201; +.button-mid { + position: absolute; + width: 100%; + height: 0; + top: 50%; } .banner-pager .active-slide button{ background: $theme-color-second!important; diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 397b7c2..81b221f 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -2611,12 +2611,6 @@ .i-annc__entry-title { margin-bottom: 0; margin-top: 0; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; - // clear: both; } .i-annc__title { @@ -2624,6 +2618,11 @@ color: $theme-color-main; text-decoration: none; @extend .i-title; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + text-overflow: ellipsis; + overflow: hidden; &:hover { color: $theme-color-second; } diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index d080a4e..c28b72b 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -144,18 +144,18 @@ .i-archive-title { @extend .unity-title; } -.link { background-color: #1368d4 !important; } /* 對比 4.6:1 */ -.txt { background-color: #3a8a40 !important; } /* 對比 4.6:1 */ -.xlsx { background-color: #9e3050 !important; } /* 對比 4.6:1 */ -.pdf { background-color: #2a7d36 !important; } /* 對比 4.6:1 */ -.docx { background-color: #5e46a0 !important; } /* 對比 4.6:1 */ -.doc { background-color: #1368d4 !important; } /* 對比 4.6:1 */ -.pptx { background-color: #3d4aa0 !important; } /* 對比 4.6:1 */ -.jpg { background-color: #8f3333 !important; } /* 對比 4.6:1 */ -.zip { background-color: #8a6400 !important; } /* 對比 4.6:1 */ -.rar { background-color: #9e5000 !important; } /* 對比 4.6:1 */ -.xls { background-color: #3a8a40 !important; } /* 對比 4.6:1 */ -.odt { background-color: #767676 !important; } /* 對比 4.6:1 */ +.link { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.txt { background-color: #3a8a40 !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 */ +.doc { background-color: #1368d4 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.pptx { background-color: #3d4aa0 !important; margin-left: 0.5em; } /* 對比 4.6:1 */ +.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 */ +.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; } diff --git a/assets/stylesheets/template/modules/menu.scss b/assets/stylesheets/template/modules/menu.scss index 44ac645..0a008e2 100644 --- a/assets/stylesheets/template/modules/menu.scss +++ b/assets/stylesheets/template/modules/menu.scss @@ -333,7 +333,7 @@ &:hover { & > a { - color: $theme-color-second; + color: #ff0f87; background: transparent; box-shadow:none; &:after{ diff --git a/assets/stylesheets/template/template.scss b/assets/stylesheets/template/template.scss index 9be1d7e..96491c2 100644 --- a/assets/stylesheets/template/template.scss +++ b/assets/stylesheets/template/template.scss @@ -135,7 +135,7 @@ ul.tab_nav { font-weight: normal; padding: 2px 40px !important; float: none; - color: #fff; + color: #333; width: 275px; height: 45px; background: url(/assets/btn_title_02@2x.png) no-repeat; @@ -176,7 +176,7 @@ ul.tab_nav { border: none; background: url(/assets/btn_title_01@2x.png) no-repeat; background-size: 275px 46px; - color: #fff; + color: #333; &:before, &:after{ width:100%; diff --git a/modules/ad_banner/_ad_banner_widget2.html.erb b/modules/ad_banner/_ad_banner_widget2.html.erb index e7c9f79..70ef492 100644 --- a/modules/ad_banner/_ad_banner_widget2.html.erb +++ b/modules/ad_banner/_ad_banner_widget2.html.erb @@ -29,7 +29,9 @@ - +