diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index c4c2da3..52c8713 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2,7 +2,7 @@ // ECMAScript 5 嚴格模式 'use strict'; - //header fixed在上方 + //header fixed在上方 function initdata1() { if ( $('.homebanner').length != 0) { $('.layout-header').css('height', ''); @@ -21,1364 +21,1291 @@ } } - } + } // 初始函數: 把所有的程式碼都包在init裡面,方便在之後的jQuery ready 函數裡一次呼叫 function init() { - // 快取一些常用的變數 - var doc = document; - var lang = doc.documentElement.lang; - var pageModule = doc.body.getAttribute('data-module'); - var resizeTimer = -1; + // 快取一些常用的變數 + var doc = document; + var lang = doc.documentElement.lang; + var pageModule = doc.body.getAttribute('data-module'); + var resizeTimer = -1; - // 把所有的函數都包在orbit這個物件裡並按模組做簡單的分類 - var orbit = { + // 把所有的函數都包在orbit這個物件裡並按模組做簡單的分類 + var orbit = { - // 工具函數,裡面包含可以重覆使用的函數 - utils: { - // 字數限制函數, 因為系統預設沒有,所以使用JS來做 - // els = 元素, maxLen = 限制長度 - truncateText: function(els, maxLen) { - var els = doc.querySelectorAll(els); - var newTitle = ''; - var i = -1; - var elsLen = els.length; + // 工具函數,裡面包含可以重覆使用的函數 + utils: { + // 字數限制函數, 因為系統預設沒有,所以使用JS來做 + // els = 元素, maxLen = 限制長度 + truncateText: function(els, maxLen) { + var els = doc.querySelectorAll(els); + var newTitle = ''; + var i = -1; + var elsLen = els.length; - for (i = 0; i < elsLen; i++) { - if (els[i].firstChild !== null) { - if (els[i].firstChild.length > maxLen) { - newTitle = els[i].firstChild.textContent; - els[i].textContent = newTitle.substring(0, maxLen) + '...'; + for (i = 0; i < elsLen; i++) { + if (els[i].firstChild !== null) { + if (els[i].firstChild.length > maxLen) { + newTitle = els[i].firstChild.textContent; + els[i].textContent = newTitle.substring(0, maxLen) + '...'; + } } } } - } - }, - - // 外掛,所有的外掛都可以放到這個物件裡 - // plugins: { - // // 自適應圖片裁切,Ray的外掛 - // bullEye: function() { - // $('.bullseye').bullseye({ - // fadeEffect: false - // }); - // } - // }, - - - member: { - // 欄位相同高度,小心這個函數沒有計算到圖片高度,所以可能要搭配 jQuery load函數使用,或是之後使用更好的方式例如 CSS3 flexbox - equalHeight: function(el) { - var bigbrother = -1; - var $el = $(el); - $el.each(function(i) { - bigbrother = bigbrother > $el.eq(i).height() ? bigbrother : $el.eq(i).height(); - }); - - $el.height(bigbrother); }, - // 把沒有完成資料的表格列藏起來, 因為後台不管有沒有資料都會輸出項目,所以需要在前台藏起來… - removeEmptyRow: function() { - // index 頁面項目 - $('.i-member-profile-item .i-member-value').each(function() { - if ($(this).text().trim() === '' || $(this).text().trim() === ':') { - $(this).parent().addClass('hide'); - } - }); - - // show 頁面項目 - $('.show-member .member-data th, .show-member .member-data td').each(function() { - if ($(this).text().trim() === '') { - $(this).parent('tr').addClass('hide'); - } - }); - }, - }, - - archives: { - // 把沒有文字內容的標題藏起來,因為就算是標題裡沒有文字系統仍然會輸出,這樣會造成一些多餘的CSS margins, paddings,或許之後也可以使用 CSS3 :empty selector 處理 - // el = 要移除的元素 - removeEmptyTitle: function(el) { - var $el = $(el); - var $els = $el.children(); - - $.each($els, function(i, val) { - if ($els.eq(i).text().trim() === '') { - $els.eq(i).addClass('hide'); - } - }); - - $.each($el, function(i, val) { - if ($el.eq(i).children('.hide').length >= 2) { - $el.eq(i).addClass('hide'); - } - }); - }, - - // bootstarp panel 功能擴充,因為原本的功能不支援多個panel - extendPanel: function() { - var len = $('.i-archive .panel-title').length; - var i = -1; - if (len > 0) { - // 新增數字到要對應的panel按鈕id及href上面 - for (i = 0; i < len; i++) { - $('.panel-title:eq(' + i + ') .collapsed').attr('href', '#collapse' + i); - $('.panel-collapse:eq(' + i + ')').attr('id', 'collapse' + i); - } - } - } - }, - - adBanner: { - // 讓AD banner 的圖片可以點選,因為系統預設輸出的圖片是沒有連結的 - // els = 要可以點選的元素(需要配合有data-link這個參數及data-targe才能使用) - addLinkOnADBanner: function(els) { - $.each(els, function() { - if ($(this).data('link') !== '' && !$(this).hasClass('youtube')) { - $(this).on('click', function() { - var target = $(this).data('target'); - var link = $(this).data('link'); - - // 設定頁面打開的方式,記得要加上data-target在HTML裡面 - if (target === '_blank') { - window.open(link, target); - } else { - window.location.href = link; - } - }).addClass('cursor'); // cursor類別樣式定義在CSS裡面 - } - }); - }, - - }, + // 外掛,所有的外掛都可以放到這個物件裡 + // plugins: { + // // 自適應圖片裁切,Ray的外掛 + // bullEye: function() { + // $('.bullseye').bullseye({ + // fadeEffect: false + // }); + // } + // }, + member: { + // 欄位相同高度,小心這個函數沒有計算到圖片高度,所以可能要搭配 jQuery load函數使用,或是之後使用更好的方式例如 CSS3 flexbox + equalHeight: function(el) { + var bigbrother = -1; + var $el = $(el); + $el.each(function(i) { + bigbrother = bigbrother > $el.eq(i).height() ? bigbrother : $el.eq(i).height(); + }); - // 移除行動版下拉選單 - removeDropdown: function() { - var $nav = $('#main-nav'); - - $nav - .find('.menu-drop') - .remove(); - $nav - .find('.opened') - .removeClass('opened'); - }, - // 網站次選單設定,如果次選單有第三層就新增下拉選單的圖示及加上bootstrap class - // els = 選單元素 - sitemenuDropdown: function(els) { - var els = doc.querySelectorAll('.sitemenu-list.level-2'); - var len = els.length; - var i = -1; - var caret = null; - - for (i = 0; i < len; i++) { - if (els[i].children.length) { - caret = doc.createElement('span'); - caret.className = 'sitemenu-dropdown-toggle fa fa-caret-down'; - caret.setAttribute('data-toggle', 'dropdown'); - - els[i].parentNode.insertBefore(caret, els[i]); - els[i].className += ' dropdown-menu'; - } - } - }, - - // 回到頁面最頂端,動態產生DOM - // txt = 按鈕的文字, speed = 捲動時的速度 - goBackTop: function(txt, speed) { - var top = document.createElement('div'); - top.className = 'go-back-top no-print'; - top.textContent = txt || 'top'; - doc.body.appendChild(top); - - // 判斷是否顯示按鈕 - $(window).scroll(function() { - if ($(this).scrollTop() !== 0) { - $('.go-back-top').fadeIn(); - } else { - $('.go-back-top').fadeOut(); - } - }); - - - - - // 捲動效果 - $('.go-back-top').on('click', function() { - $('body, html').animate({ - scrollTop: 0 - }, speed || 300); - return false; - }); - }, - - // Multi-column layout, passing ID or class string as parameters and a - // Bootstrap col class for full width, eg: col-md-12 - setColumn: function(leftCol, rightCol, columnCls) { - var $leftCol = $(leftCol); - var $rightCol = $(rightCol); - var columnCls = columnCls || 'col-sm-12'; - - if ($leftCol.length && $rightCol.length) { - $.each([$leftCol, $rightCol], function() { - if ($(this).is(':empty')) { - $(this) - .addClass('empty-column') - .siblings() - .removeClass(function(index, css) { - return (css.match(/(^|\s)col-\S+/g) || []).join(' '); - }) - .addClass(columnCls); - } - }); - } - }, - - MobileMenu: function() { - var $menu = $('[data-menu-level="0"]'); - - $menu.find('ul[data-menu-level="1"]').parent().addClass('mobile-menu1'); - $menu.find('ul[data-menu-level="2"]').parent().addClass('mobile-menu2'); - - var $caret1 = $(''); - var $caret2 = $(''); - - // 如果有第二層選單,新增對應的類別到parent元素上 - $('.nav-level-1') - .parent('li') - .addClass('has-dropdown level-1'); - - // 檢查是否已經有dropdown-toggle-icon這個元素,才不會在resize事件中重覆新增 - if ($('.has-dropdown.level-1 .menu-drop').length < 1) { - $('.mobile-menu1').append($caret1); - - - // 如果有第三層選單,新增對應的類別到parent元素上 - $('.nav-level-2') - .parent('li') - .addClass('has-dropdown level-2'); - $caret2.appendTo('.has-dropdown.level-2'); - } - }, - - 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); - } - }); - - $('.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來減少名稱衝突的機會 - win.ORBITFRONT = orbit; - - // 在switch裡測試頁面模組後執行對應的函數 - switch (pageModule) { - case 'home': - break; - case 'member': - orbit.member.removeEmptyRow(); - $('.index-member-3 .member-data-title-email').empty(); - break; - case 'archive': - orbit.archives.removeEmptyTitle('.i-archive__category-item'); - orbit.archives.extendPanel(); - break; - case 'gallery': - orbit.utils.truncateText('.show-description', 15); - break; - default: - break; - } - - // 在所有的頁面(包含首頁)執行下面這幾個函數 - initdata1(); - orbit.sitemenuDropdown(); - orbit.goBackTop('top', 800); - // orbit.plugins.bullEye(); - orbit.setColumn('.left-column', '.right-column'); - - // 自適應網頁使用,當網頁載入時,如果視窗寬度小於769,就執行orbit.nav.setDropdown函數 - if ($(window).width() < 769) { - // orbit.nav.setDropdown(); - orbit.MobileMenu(); - $('.mobile-menu').append($('.modules-menu')); - $('.header-buttom').appendTo($('.modules-menu')); - orbit.ClickMenuHandler(); - } - - // 自適應網頁使用,當使用者改變瀏覽器寬度時呼叫orbit.nav.setDropdown函數 - $(window).resize(function() { - if ($(window).width() < 769) { - - if (resizeTimer) clearTimeout(resizeTimer); - resizeTimer = setTimeout(function() { - // if ( $('.modules-menu i').length == 0 ) { - // orbit.MobileMenu(); - // } - if( $('.mobile-menu .modules-menu').length == 0 ) { - $('.mobile-menu').append($('.modules-menu')); - $('.header-buttom').appendTo($('.modules-menu')); - orbit.MobileMenu(); - orbit.ClickMenuHandler(); - // $('.navbar-toggle').bind('click', orbit.ClickMenuHandler); - // $('.navbar-toggle').bind(orbit.ClickMenuHandler()); - } - },500 )} else { - resizeTimer = setTimeout(function(){ - if( $('.mobile-menu .modules-menu').length > 0 ) { - $('.layout-header .outdropdowns .dropdowns').append($('.modules-menu')); - $('.dropdowns').append($('.header-buttom')); - } - orbit.removeDropdown(); - }, 500); - } - }); - // if($(window).width()<769){ - // $('.header-buttom').appendTo($('.modules-menu')); - // }else{ - // $('.header-buttom').appendTo($('.dropdowns')); - // } - function forFreeGo() { - //表單legend - $("fieldset").each(function () { - const $fieldset = $(this); - const hasLegend = $fieldset.children("legend").length > 0; - - if (!hasLegend) { - // 嘗試抓最上層的群組標題,例如 "Apply" - const headingText = $fieldset.find(".form-group:first").text().trim() || "表單填寫"; - - // 插入 legend 為第一個元素 - $fieldset.prepend(`${headingText}`); - } - }); - - // 處理「上一頁」按鈕 - $(".cmdBackward").each(function () { - $(this) - .attr("title", "上一頁") - .attr("aria-label", "上一頁"); - - if ($(this).find(".sr-only").length === 0) { - $(this).append('上一頁'); - } - - $(this).find("i").attr("aria-hidden", "true"); - $(this).find(".icon").attr("aria-hidden", "true"); - }); - - // 處理「下一頁」按鈕 - $(".cmdForward").each(function () { - $(this) - .attr("title", "下一頁") - .attr("aria-label", "下一頁"); - - if ($(this).find(".sr-only").length === 0) { - $(this).append('下一頁'); - } - - $(this).find("i").attr("aria-hidden", "true"); - $(this).find(".icon").attr("aria-hidden", "true"); - }); - - $('.pagination li.active a').attr('aria-current', 'page'); - - $('path').each(function () { - $(this) - .attr('aria-hidden', 'true') - .attr('focusable', 'false') - .attr('tabindex', '-1'); - }); - - $('.controlplay a[role="radio"]').on('click', function () { - // 取消所有的 aria-checked 並還原文字 - $('.controlplay a[role="radio"]').attr('aria-checked', 'false'); - $('.controlplay a[role="radio"] span').each(function () { - var text = $(this).text().replace('(已選取)', ''); - $(this).text(text); - }); - - // 設定目前被點擊的按鈕為已選取 - $(this).attr('aria-checked', 'true'); - var selectedText = $(this).text().trim(); - $(this).find('span').text(selectedText + '(已選取)'); - }); - // 遍历所有的 .s-annc__tag-wrap 元素 - $('.s-annc__tag-wrap').each(function() { - // 遍历 .s-annc__tag-wrap 下的每个 a 元素 - $(this).find('a').each(function() { - // 如果 .s-annc__tag 元素为空或没有内容 - if ($(this).find('.s-annc__tag').is(':empty')) { - // 移除该 a 元素 - $(this).remove(); - } - }); - }); - - $('.w-ba-banner__caption li button').each(function (index) { - const $slide = $('.w-ba-banner__slide').eq(index); - const title = $slide.attr('data-cycle-title')?.trim(); - - if (title) { - const fullText = title + '的pager'; - $(this).attr('aria-label', fullText); - $(this).attr('title', fullText); - } - }); - // 當 focus 到 menu link 時,顯示對應 ul - $('.sitemenu-item > a').on('focus', function () { - $(this).siblings('ul').addClass('show'); - }); - - // 當 focus 離開最後一個子選單 link 時,移除 .show - $('.sitemenu-item').each(function () { - const $submenuLinks = $(this).find('ul a'); - - if ($submenuLinks.length > 0) { - $submenuLinks.last().on('blur', function () { - // 當最後一個子項 blur 時關閉 ul - $(this).closest('ul').removeClass('show'); - }); - } else { - // 若沒有子項,當主選單項 blur 也隱藏 - $(this).find('> a').on('blur', function () { - $(this).siblings('ul').removeClass('show'); - }); - } - }); - if (document.documentElement.lang === 'zh_tw') { - document.documentElement.lang = 'zh-Hant'; - } - //tab鍵按下 - $(document).on('keydown', function(e) { - if (e.key === "Tab" || e.keyCode === 9) { - $('.header-nav, .dropdowns').css('display', 'block'); - } - }); - - //li被hover - function handleHover() { - if ($(window).width() > 769) { - $('li').off('mouseenter mouseleave').hover( - function() { - $(this).children('ul').addClass('show'); + $el.height(bigbrother); }, - function() { - $(this).children('ul').removeClass('show'); - } - ); - } else { - $('li').off('mouseenter mouseleave'); // 移除 hover 事件 - } - } - // 先執行一次 - handleHover(); - - // 監聽視窗大小變化 - $(window).on('resize', function() { - handleHover(); - }); - //刪除空的h1 - $('h1').each(function() { - if ($(this).text().trim() === '') { - $(this).remove(); - } - }); - //refresh_btn加上aria-label - $('#refresh_btn').each(function() { - var $this = $(this); - - // 如果 button 尚未有 aria-label,則新增 - if (!$this.attr('aria-label')) { - $this.attr('aria-label', '重新整理'); - } - }); - //無障礙會員表格刪除沒有顯示的th - $('.i-member-tr-head').each(function() { - if ($(this).css('display') === 'none') { - $(this).remove(); - } - }); - //無障礙公告a是空的 - $('.w-annc__subtitle').each(function () { - var $this = $(this); - var $link = $this.find('a'); - - // 檢查 a 是否存在,且去除空白後是否為空字串 - if ($link.length && $link.text().trim() === '') { - $this.remove(); // 移除外層 .w-annc__subtitle - } - }); - //無障礙單位轉換 - $("[style*='font-size']").each(function() { - var fontSize = $(this).css("font-size"); - if (fontSize.includes("px")) { - var pxValue = parseFloat(fontSize); // 取得數值 - var emValue = pxValue / 16; // 假設 1em = 16px - $(this).css("font-size", emValue + "em"); - } - }); - $("[style*='font-size']").each(function() { - var fontSize = $(this).css("font-size"); - if (fontSize.includes("pt")) { - var ptValue = parseFloat(fontSize); // 取得數值 - var emValue = ptValue / 12; // 1em = 12pt(一般轉換標準) - $(this).css("font-size", emValue + "em"); - } - }); - $("[style*='font-size']").each(function() { - var styleAttr = $(this).attr("style"); // 取得原始 style 屬性字串 - var match = styleAttr.match(/font-size\s*:\s*(\d+(?:\.\d+)?)pt/i); - if (match) { - var ptValue = parseFloat(match[1]); - var emValue = ptValue / 12; - // 替換 style 屬性字串中的 pt 為 em - var newStyle = styleAttr.replace(/font-size\s*:\s*\d+(?:\.\d+)?pt/i, `font-size: ${emValue}em`); - $(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"); - } - }); + // 把沒有完成資料的表格列藏起來, 因為後台不管有沒有資料都會輸出項目,所以需要在前台藏起來… + removeEmptyRow: function() { + // index 頁面項目 + $('.i-member-profile-item .i-member-value').each(function() { + if ($(this).text().trim() === '' || $(this).text().trim() === ':') { + $(this).parent().addClass('hide'); + } }); - }); - $(".banner-pager button").addClass('banner-pagerbtn'); - $(".banner-pager button").attr("type","button"); - $(".banner-pager button").append('下一張'); - $("button").attr("role", "button"); - $("select").attr("title","選擇類別"); - $(".jarallax-video-audio").attr("role", "button"); - $('button').each(function() { - var $this = $(this); - if (!$this.attr('title') || $this.attr('title').trim() === '') { - $this.attr('title', '按鈕'); + + // show 頁面項目 + $('.show-member .member-data th, .show-member .member-data td').each(function() { + if ($(this).text().trim() === '') { + $(this).parent('tr').addClass('hide'); + } + }); + }, + }, + + archives: { + // 把沒有文字內容的標題藏起來,因為就算是標題裡沒有文字系統仍然會輸出,這樣會造成一些多餘的CSS margins, paddings,或許之後也可以使用 CSS3 :empty selector 處理 + // el = 要移除的元素 + removeEmptyTitle: function(el) { + var $el = $(el); + var $els = $el.children(); + + $.each($els, function(i, val) { + if ($els.eq(i).text().trim() === '') { + $els.eq(i).addClass('hide'); + } + }); + + $.each($el, function(i, val) { + if ($el.eq(i).children('.hide').length >= 2) { + $el.eq(i).addClass('hide'); + } + }); + }, + + // bootstarp panel 功能擴充,因為原本的功能不支援多個panel + extendPanel: function() { + var len = $('.i-archive .panel-title').length; + var i = -1; + if (len > 0) { + // 新增數字到要對應的panel按鈕id及href上面 + for (i = 0; i < len; i++) { + $('.panel-title:eq(' + i + ') .collapsed').attr('href', '#collapse' + i); + $('.panel-collapse:eq(' + i + ')').attr('id', 'collapse' + i); + } + } } - }); - $('img').each(function() { - var $this = $(this); - if (!$this.attr('alt') || $this.attr('alt').trim() === '') { - $this.attr('alt', '這是一張圖片'); + }, + + adBanner: { + // 讓AD banner 的圖片可以點選,因為系統預設輸出的圖片是沒有連結的 + // els = 要可以點選的元素(需要配合有data-link這個參數及data-targe才能使用) + addLinkOnADBanner: function(els) { + $.each(els, function() { + if ($(this).data('link') !== '' && !$(this).hasClass('youtube')) { + $(this).on('click', function() { + var target = $(this).data('target'); + var link = $(this).data('link'); + + // 設定頁面打開的方式,記得要加上data-target在HTML裡面 + if (target === '_blank') { + window.open(link, target); + } else { + window.location.href = link; + } + }).addClass('cursor'); // cursor類別樣式定義在CSS裡面 + } + }); + }, + + }, + + + + // 移除行動版下拉選單 + removeDropdown: function() { + var $nav = $('#main-nav'); + + $nav + .find('.menu-drop') + .remove(); + $nav + .find('.opened') + .removeClass('opened'); + }, + // 網站次選單設定,如果次選單有第三層就新增下拉選單的圖示及加上bootstrap class + // els = 選單元素 + sitemenuDropdown: function(els) { + var els = doc.querySelectorAll('.sitemenu-list.level-2'); + var len = els.length; + var i = -1; + var caret = null; + + for (i = 0; i < len; i++) { + if (els[i].children.length) { + caret = doc.createElement('span'); + caret.className = 'sitemenu-dropdown-toggle fa fa-caret-down'; + caret.setAttribute('data-toggle', 'dropdown'); + + els[i].parentNode.insertBefore(caret, els[i]); + els[i].className += ' dropdown-menu'; + } } - }); - $('img').each(function() { - var $this = $(this); - if (!$this.attr('title') || $this.attr('title').trim() === '') { - $this.attr('title', '這是一張圖片'); - } - }); - $('img').each(function() { - var $this = $(this); - - // 檢查 img 的 alt 屬性是否為 "裝飾圖片" - if ($this.attr('alt') === "裝飾圖片" || $this.attr('title') === "裝飾圖片") { - // 設定 alt 為空字串 - $this.attr('alt', ''); - - // 移除 title 屬性 - $this.removeAttr('title'); + }, + + // 回到頁面最頂端,動態產生DOM + // txt = 按鈕的文字, speed = 捲動時的速度 + goBackTop: function(txt, speed) { + var top = document.createElement('div'); + top.className = 'go-back-top no-print'; + top.textContent = txt || 'top'; + doc.body.appendChild(top); + + // 判斷是否顯示按鈕 + $(window).scroll(function() { + if ($(this).scrollTop() !== 0) { + $('.go-back-top').fadeIn(); + } else { + $('.go-back-top').fadeOut(); } }); - $(".w-annc__img-wrap a").each(function () { - var $this = $(this); - // 確保 內沒有文字節點 (避免重複添加) - if ($this.text().trim() === "") { - $this.append('公告圖片'); - } - }); - $(".widget-link__widget-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('公告標題'); - } + + + + + // 捲動效果 + $('.go-back-top').on('click', function() { + $('body, html').animate({ + scrollTop: 0 + }, speed || 300); + return false; }); - $(".sitemenu-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('次選單'); - } - }); - $(".annc-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('內頁公告標題'); + }, + + // Multi-column layout, passing ID or class string as parameters and a + // Bootstrap col class for full width, eg: col-md-12 + setColumn: function(leftCol, rightCol, columnCls) { + var $leftCol = $(leftCol); + var $rightCol = $(rightCol); + var columnCls = columnCls || 'col-sm-12'; + + if ($leftCol.length && $rightCol.length) { + $.each([$leftCol, $rightCol], function() { + if ($(this).is(':empty')) { + $(this) + .addClass('empty-column') + .siblings() + .removeClass(function(index, css) { + return (css.match(/(^|\s)col-\S+/g) || []).join(' '); + }) + .addClass(columnCls); + } + }); } - }); - $(".event-annc-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('內頁活動公告標題'); - } - }); - $(".show-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('內頁活動公告標題'); - } - }); - $(".w-annc__widget-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('公告標題'); - } - }); - $(".widget-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('網路資源標題'); - } - }); - $(".widget-title").each(function () { - if ($(this).text().trim() === "") { - $(this).append('網路資源標題'); - } - }); - $('input').each(function() { - var $this = $(this); - if (!$this.attr('title') || $this.attr('title').trim() === '') { - $this.attr('title', '網內搜尋'); - } - }); - $('.rucaptcha-image').each(function() { - var $button = $(this).next('button'); // 取得緊接在 .rucaptcha-image 之後的 button - if ($button.length && !$button.attr('aria-label')) { - $button.attr('aria-label', '播放驗證碼語音'); - } - }); - //有連結目的之所有a標籤加上aria-label和title - $('a').each(function () { - var $a = $(this); - var href = $a.attr('href'); - if (!href) return; + }, - var hasSrOnly = $a.find('.sr-only').length > 0; + MobileMenu: function() { + var $menu = $('[data-menu-level="0"]'); - // 若有 .sr-only,移除 aria-label 和 title 避免重複朗讀 - if (hasSrOnly) { - $a.removeAttr('aria-label'); - $a.removeAttr('title'); - return; // 有 .sr-only 就不做其他處理 - } + $menu.find('ul[data-menu-level="1"]').parent().addClass('mobile-menu1'); + $menu.find('ul[data-menu-level="2"]').parent().addClass('mobile-menu2'); - // ----- aria-label 邏輯 ----- - if (!$a.attr('aria-label')) { - let ariaLabel = ''; + var $caret1 = $(''); + var $caret2 = $(''); - // 加入開啟方式 - if ($a.attr('target') === '_blank') { - ariaLabel += '在新視窗開啟 '; - } else if ($a.attr('target') === '_self') { - ariaLabel += '在本視窗開啟 '; - } + // 如果有第二層選單,新增對應的類別到parent元素上 + $('.nav-level-1') + .parent('li') + .addClass('has-dropdown level-1'); - // 如果包含圖片且有圖片 title - if ($a.find('img').length) { - const imgTitle = $a.find('img').attr('title'); - if (imgTitle) ariaLabel = imgTitle; - } else { - const text = $a.text().trim(); - if (text) { - ariaLabel += text; - } else if ($a.children('span').length === 1) { - ariaLabel += $a.children('span').text().trim(); - } - } + // 檢查是否已經有dropdown-toggle-icon這個元素,才不會在resize事件中重覆新增 + if ($('.has-dropdown.level-1 .menu-drop').length < 1) { + $('.mobile-menu1').append($caret1); - if (ariaLabel) { - $a.attr('aria-label', ariaLabel); - } - } - // ----- title 邏輯 ----- - if (!$a.attr('title')) { - let titleStr = ''; + // 如果有第三層選單,新增對應的類別到parent元素上 + $('.nav-level-2') + .parent('li') + .addClass('has-dropdown level-2'); + $caret2.appendTo('.has-dropdown.level-2'); + } + }, - if ($a.attr('target') === '_blank') { - titleStr += '在新視窗開啟 '; - } else if ($a.attr('target') === '_self') { - titleStr += '在本視窗開啟 '; - } + ClickMenuHandler: function() { + // 處理主選單切換(漢堡 icon) + $(document).on('click', '.navbar-toggle', function (e) { + e.preventDefault(); - if ($a.find('img').length) { - titleStr = '這是一張照片'; - } else { - const text = $a.text().trim(); - if (text) { - titleStr += text; - } else if ($a.children('span').length === 1) { - titleStr += $a.children('span').text().trim(); - } - } - - if (titleStr) { - $a.attr('title', titleStr); - } - } - }); - $('a').each(function () { - const $link = $(this); - const linkText = $link.text().trim(); - - $link.find('img').each(function () { - const $img = $(this); - const altText = $img.attr('alt')?.trim(); - - // 如果圖片 alt 是空的,就略過(已符合) - if (altText === '') return; - - // 如果圖片 alt 等於文字內容,就將 alt 清空,避免重複 - if (altText === linkText) { - $img.attr('alt', ''); - } - }); + // 確保 .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')); + } }); - // 刪除banner-slide的空連結和空連結目標 - for(var i=0;i<$('.w-ba-banner__slide a').length;i++){ - if($('.w-ba-banner__slide a').eq(i).attr('href')=="") - $('.w-ba-banner__slide a').eq(i).removeAttr('href'); - if($('.w-ba-banner__slide a').eq(i).attr('target') == "") - $('.w-ba-banner__slide a').eq(i).removeAttr('target'); - }; - // 幫無標題之iframe加上title - for(var i=0;i<$('iframe').length;i++) - if($('iframe').eq(i).attr('title')=="" || $('iframe').eq(i).attr('title')== undefined ){ - if($('iframe').eq(i).attr('src').search('facebook') != -1 ) - $('iframe').eq(i).attr('title','facebook'); - else if($('iframe').eq(i).attr('src').search('google') != -1 ) - $('iframe').eq(i).attr('title','google'); - else if($('iframe').eq(i).attr('src').search('youtube') != -1 ) - $('iframe').eq(i).attr('title','youtube'); - else if($('iframe').eq(i).attr('src').search('twitframe') != -1 ) - $('iframe').eq(i).attr('title','twitter'); - else - $('iframe').eq(i).attr('title','unknown'); - }; - //button是空的就加上內容 - $('button').each(function() { - var $this = $(this); - var titleText = $this.attr('title') || ''; + $('.mobile-menu').toggleClass('active'); + $('body').toggleClass('noscroll'); + $('.mobile-menu .navbar-toggle').removeClass('collapsed'); - // 檢查 button 是否是空的(沒有可見文字或子元素) - if ($this.text().trim() === '' && !$this.children().length && titleText) { - // 新增隱藏的 span,內容為 title - $this.append('' + titleText + ''); + // 關閉所有下拉選單 + $('.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); + } + }); + + $('.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來減少名稱衝突的機會 + win.ORBITFRONT = orbit; + + // 在switch裡測試頁面模組後執行對應的函數 + switch (pageModule) { + case 'home': + break; + case 'member': + orbit.member.removeEmptyRow(); + $('.index-member-3 .member-data-title-email').empty(); + break; + case 'archive': + orbit.archives.removeEmptyTitle('.i-archive__category-item'); + orbit.archives.extendPanel(); + break; + case 'gallery': + orbit.utils.truncateText('.show-description', 15); + break; + default: + break; } - }); - // 刪除空的檔案室 - var archievelen = $('dd a.i-archive-files-item').length; - for(i=archievelen-1;i>=0;i--) - if($('dd a.i-archive-files-item').eq(i).html().trim()=="") - $('dd a.i-archive-files-item').eq(i).parent('dd').remove(); - // 刪除具有空連結欄位的橫列 - for(var i = 0;i < $('*[data-list] tr td a').length ; i++) - if($('*[data-list] tr td a').eq(i).html().trim()=="") - $('*[data-list] tr td a').eq(i).parent('td').parent('tr').remove(); - // tab按鍵選到menu,會顯示下層的menu(為了符合無障礙) - $('.nav-level-0>li>a').focus(function(e) { - e.stopPropagation(); - $(this).parent().focus(); - if ($(this).parent().find('.nav-level-1').hasClass('show')) { + + // 在所有的頁面(包含首頁)執行下面這幾個函數 + initdata1(); + orbit.sitemenuDropdown(); + orbit.goBackTop('top', 800); + // orbit.plugins.bullEye(); + orbit.setColumn('.left-column', '.right-column'); + + // 自適應網頁使用,當網頁載入時,如果視窗寬度小於769,就執行orbit.nav.setDropdown函數 + if ($(window).width() < 769) { + // orbit.nav.setDropdown(); + orbit.MobileMenu(); + $('.mobile-menu').append($('.modules-menu')); + $('.header-buttom').appendTo($('.modules-menu')); + orbit.ClickMenuHandler(); + } + + // 自適應網頁使用,當使用者改變瀏覽器寬度時呼叫orbit.nav.setDropdown函數 + $(window).resize(function() { + if ($(window).width() < 769) { + + if (resizeTimer) clearTimeout(resizeTimer); + resizeTimer = setTimeout(function() { + // if ( $('.modules-menu i').length == 0 ) { + // orbit.MobileMenu(); + // } + if( $('.mobile-menu .modules-menu').length == 0 ) { + $('.mobile-menu').append($('.modules-menu')); + $('.header-buttom').appendTo($('.modules-menu')); + orbit.MobileMenu(); + orbit.ClickMenuHandler(); + // $('.navbar-toggle').bind('click', orbit.ClickMenuHandler); + // $('.navbar-toggle').bind(orbit.ClickMenuHandler()); + } + },500 )} else { + resizeTimer = setTimeout(function(){ + if( $('.mobile-menu .modules-menu').length > 0 ) { + $('.layout-header .outdropdowns .dropdowns').append($('.modules-menu')); + $('.dropdowns').append($('.header-buttom')); + } + orbit.removeDropdown(); + }, 500); + } + }); + // if($(window).width()<769){ + // $('.header-buttom').appendTo($('.modules-menu')); + // }else{ + // $('.header-buttom').appendTo($('.dropdowns')); + // } + function forFreeGo() { + //表單legend + $("fieldset").each(function () { + const $fieldset = $(this); + const hasLegend = $fieldset.children("legend").length > 0; + + if (!hasLegend) { + // 嘗試抓最上層的群組標題,例如 "Apply" + const headingText = $fieldset.find(".form-group:first").text().trim() || "表單填寫"; + + // 插入 legend 為第一個元素 + $fieldset.prepend(`${headingText}`); + } + }); + + // 處理「上一頁」按鈕 + $(".cmdBackward").each(function () { + $(this) + .attr("title", "上一頁") + .attr("aria-label", "上一頁"); + + if ($(this).find(".sr-only").length === 0) { + $(this).append('上一頁'); + } + + $(this).find("i").attr("aria-hidden", "true"); + $(this).find(".icon").attr("aria-hidden", "true"); + }); + + // 處理「下一頁」按鈕 + $(".cmdForward").each(function () { + $(this) + .attr("title", "下一頁") + .attr("aria-label", "下一頁"); + + if ($(this).find(".sr-only").length === 0) { + $(this).append('下一頁'); + } + + $(this).find("i").attr("aria-hidden", "true"); + $(this).find(".icon").attr("aria-hidden", "true"); + }); + + $('.pagination li.active a').attr('aria-current', 'page'); + + $('path').each(function () { + $(this) + .attr('aria-hidden', 'true') + .attr('focusable', 'false') + .attr('tabindex', '-1'); + }); + + $('.controlplay a[role="radio"]').on('click', function () { + // 取消所有的 aria-checked 並還原文字 + $('.controlplay a[role="radio"]').attr('aria-checked', 'false'); + $('.controlplay a[role="radio"] span').each(function () { + var text = $(this).text().replace('(已選取)', ''); + $(this).text(text); + }); + + // 設定目前被點擊的按鈕為已選取 + $(this).attr('aria-checked', 'true'); + var selectedText = $(this).text().trim(); + $(this).find('span').text(selectedText + '(已選取)'); + }); + // 遍历所有的 .s-annc__tag-wrap 元素 + $('.s-annc__tag-wrap').each(function() { + // 遍历 .s-annc__tag-wrap 下的每个 a 元素 + $(this).find('a').each(function() { + // 如果 .s-annc__tag 元素为空或没有内容 + if ($(this).find('.s-annc__tag').is(':empty')) { + // 移除该 a 元素 + $(this).remove(); + } + }); + }); + + $('.w-ba-banner__caption li button').each(function (index) { + const $slide = $('.w-ba-banner__slide').eq(index); + const title = $slide.attr('data-cycle-title')?.trim(); + + if (title) { + const fullText = title + '的pager'; + $(this).attr('aria-label', fullText); + $(this).attr('title', fullText); + } + }); + // 當 focus 到 menu link 時,顯示對應 ul + $('.sitemenu-item > a').on('focus', function () { + $(this).siblings('ul').addClass('show'); + }); + + // 當 focus 離開最後一個子選單 link 時,移除 .show + $('.sitemenu-item').each(function () { + const $submenuLinks = $(this).find('ul a'); + + if ($submenuLinks.length > 0) { + $submenuLinks.last().on('blur', function () { + // 當最後一個子項 blur 時關閉 ul + $(this).closest('ul').removeClass('show'); + }); } else { - $('.nav-level-1').removeClass('show'); - $(this).parent().find('.nav-level-1').addClass('show'); + // 若沒有子項,當主選單項 blur 也隱藏 + $(this).find('> a').on('blur', function () { + $(this).siblings('ul').removeClass('show'); + }); + } + }); + if (document.documentElement.lang === 'zh_tw') { + document.documentElement.lang = 'zh-Hant'; + } + //tab鍵按下 + $(document).on('keydown', function(e) { + if (e.key === "Tab" || e.keyCode === 9) { + $('.header-nav, .dropdowns').css('display', 'block'); + } + }); + + //li被hover + function handleHover() { + if ($(window).width() > 769) { + $('li').off('mouseenter mouseleave').hover( + function() { + $(this).children('ul').addClass('show'); + }, + function() { + $(this).children('ul').removeClass('show'); + } + ); + } else { + $('li').off('mouseenter mouseleave'); // 移除 hover 事件 + } + } + + // 先執行一次 + handleHover(); + + // 監聽視窗大小變化 + $(window).on('resize', function() { + handleHover(); + }); + //刪除空的h1 + $('h1').each(function() { + if ($(this).text().trim() === '') { + $(this).remove(); + } + }); + //refresh_btn加上aria-label + $('#refresh_btn').each(function() { + var $this = $(this); + + // 如果 button 尚未有 aria-label,則新增 + if (!$this.attr('aria-label')) { + $this.attr('aria-label', '重新整理'); + } + }); + //無障礙會員表格刪除沒有顯示的th + $('.i-member-tr-head').each(function() { + if ($(this).css('display') === 'none') { + $(this).remove(); + } + }); + //無障礙公告a是空的 + $('.w-annc__subtitle').each(function () { + var $this = $(this); + var $link = $this.find('a'); + + // 檢查 a 是否存在,且去除空白後是否為空字串 + if ($link.length && $link.text().trim() === '') { + $this.remove(); // 移除外層 .w-annc__subtitle + } + }); + //無障礙單位轉換 + $("[style*='font-size']").each(function() { + var fontSize = $(this).css("font-size"); + if (fontSize.includes("px")) { + var pxValue = parseFloat(fontSize); // 取得數值 + var emValue = pxValue / 16; // 假設 1em = 16px + $(this).css("font-size", emValue + "em"); + } + }); + $("[style*='font-size']").each(function() { + var fontSize = $(this).css("font-size"); + if (fontSize.includes("pt")) { + var ptValue = parseFloat(fontSize); // 取得數值 + var emValue = ptValue / 12; // 1em = 12pt(一般轉換標準) + $(this).css("font-size", emValue + "em"); + } + }); + $("[style*='font-size']").each(function() { + var styleAttr = $(this).attr("style"); // 取得原始 style 屬性字串 + var match = styleAttr.match(/font-size\s*:\s*(\d+(?:\.\d+)?)pt/i); + if (match) { + var ptValue = parseFloat(match[1]); + var emValue = ptValue / 12; + // 替換 style 屬性字串中的 pt 為 em + var newStyle = styleAttr.replace(/font-size\s*:\s*\d+(?:\.\d+)?pt/i, `font-size: ${emValue}em`); + $(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"); + } + }); + }); + }); + $(".banner-pager button").addClass('banner-pagerbtn'); + $(".banner-pager button").attr("type","button"); + $(".banner-pager button").append('下一張'); + $("button").attr("role", "button"); + $("select").attr("title","選擇類別"); + $(".jarallax-video-audio").attr("role", "button"); + $('button').each(function() { + var $this = $(this); + if (!$this.attr('title') || $this.attr('title').trim() === '') { + $this.attr('title', '按鈕'); + } + }); + $('img').each(function() { + var $this = $(this); + if (!$this.attr('alt') || $this.attr('alt').trim() === '') { + $this.attr('alt', '這是一張圖片'); + } + }); + $('img').each(function() { + var $this = $(this); + if (!$this.attr('title') || $this.attr('title').trim() === '') { + $this.attr('title', '這是一張圖片'); + } + }); + $('img').each(function() { + var $this = $(this); + + // 檢查 img 的 alt 屬性是否為 "裝飾圖片" + if ($this.attr('alt') === "裝飾圖片" || $this.attr('title') === "裝飾圖片") { + // 設定 alt 為空字串 + $this.attr('alt', ''); + + // 移除 title 屬性 + $this.removeAttr('title'); + } + }); + $(".w-annc__img-wrap a").each(function () { + var $this = $(this); + // 確保 內沒有文字節點 (避免重複添加) + if ($this.text().trim() === "") { + $this.append('公告圖片'); + } + }); + $(".widget-link__widget-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('公告標題'); + } + }); + $(".sitemenu-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('次選單'); + } + }); + $(".annc-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('內頁公告標題'); + } + }); + $(".event-annc-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('內頁活動公告標題'); + } + }); + $(".show-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('內頁活動公告標題'); + } + }); + $(".w-annc__widget-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('公告標題'); + } + }); + $(".widget-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('網路資源標題'); + } + }); + $(".widget-title").each(function () { + if ($(this).text().trim() === "") { + $(this).append('網路資源標題'); + } + }); + $('input').each(function() { + var $this = $(this); + if (!$this.attr('title') || $this.attr('title').trim() === '') { + $this.attr('title', '網內搜尋'); + } + }); + $('.rucaptcha-image').each(function() { + var $button = $(this).next('button'); // 取得緊接在 .rucaptcha-image 之後的 button + if ($button.length && !$button.attr('aria-label')) { + $button.attr('aria-label', '播放驗證碼語音'); + } + }); + //有連結目的之所有a標籤加上aria-label和title + $('a').each(function () { + var $a = $(this); + var href = $a.attr('href'); + if (!href) return; + + var hasSrOnly = $a.find('.sr-only').length > 0; + + // 若有 .sr-only,移除 aria-label 和 title 避免重複朗讀 + if (hasSrOnly) { + $a.removeAttr('aria-label'); + $a.removeAttr('title'); + return; // 有 .sr-only 就不做其他處理 + } + + // ----- aria-label 邏輯 ----- + if (!$a.attr('aria-label')) { + let ariaLabel = ''; + + // 加入開啟方式 + if ($a.attr('target') === '_blank') { + ariaLabel += '在新視窗開啟 '; + } else if ($a.attr('target') === '_self') { + ariaLabel += '在本視窗開啟 '; + } + + // 如果包含圖片且有圖片 title + if ($a.find('img').length) { + const imgTitle = $a.find('img').attr('title'); + if (imgTitle) ariaLabel = imgTitle; + } else { + const text = $a.text().trim(); + if (text) { + ariaLabel += text; + } else if ($a.children('span').length === 1) { + ariaLabel += $a.children('span').text().trim(); + } + } + + if (ariaLabel) { + $a.attr('aria-label', ariaLabel); + } + } + + // ----- title 邏輯 ----- + if (!$a.attr('title')) { + let titleStr = ''; + + if ($a.attr('target') === '_blank') { + titleStr += '在新視窗開啟 '; + } else if ($a.attr('target') === '_self') { + titleStr += '在本視窗開啟 '; + } + + if ($a.find('img').length) { + titleStr = '這是一張照片'; + } else { + const text = $a.text().trim(); + if (text) { + titleStr += text; + } else if ($a.children('span').length === 1) { + titleStr += $a.children('span').text().trim(); + } + } + + if (titleStr) { + $a.attr('title', titleStr); + } + } + }); + $('a').each(function () { + const $link = $(this); + const linkText = $link.text().trim(); + + $link.find('img').each(function () { + const $img = $(this); + const altText = $img.attr('alt')?.trim(); + + // 如果圖片 alt 是空的,就略過(已符合) + if (altText === '') return; + + // 如果圖片 alt 等於文字內容,就將 alt 清空,避免重複 + if (altText === linkText) { + $img.attr('alt', ''); + } + }); + }); + + // 刪除banner-slide的空連結和空連結目標 + for(var i=0;i<$('.w-ba-banner__slide a').length;i++){ + if($('.w-ba-banner__slide a').eq(i).attr('href')=="") + $('.w-ba-banner__slide a').eq(i).removeAttr('href'); + if($('.w-ba-banner__slide a').eq(i).attr('target') == "") + $('.w-ba-banner__slide a').eq(i).removeAttr('target'); + }; + // 幫無標題之iframe加上title + for(var i=0;i<$('iframe').length;i++) + if($('iframe').eq(i).attr('title')=="" || $('iframe').eq(i).attr('title')== undefined ){ + if($('iframe').eq(i).attr('src').search('facebook') != -1 ) + $('iframe').eq(i).attr('title','facebook'); + else if($('iframe').eq(i).attr('src').search('google') != -1 ) + $('iframe').eq(i).attr('title','google'); + else if($('iframe').eq(i).attr('src').search('youtube') != -1 ) + $('iframe').eq(i).attr('title','youtube'); + else if($('iframe').eq(i).attr('src').search('twitframe') != -1 ) + $('iframe').eq(i).attr('title','twitter'); + else + $('iframe').eq(i).attr('title','unknown'); + }; + //button是空的就加上內容 + $('button').each(function() { + var $this = $(this); + var titleText = $this.attr('title') || ''; + + // 檢查 button 是否是空的(沒有可見文字或子元素) + if ($this.text().trim() === '' && !$this.children().length && titleText) { + // 新增隱藏的 span,內容為 title + $this.append('' + titleText + ''); } }); - $('.nav-level-1>li>a').focus(function(e) { - e.stopPropagation(); - if ($(this).parent().find('.nav-level-2').hasClass('show')) { - }else{ - $('.nav-level-2').removeClass('show'); - $(this).parent().find('.nav-level-2').addClass('show'); + // 刪除空的檔案室 + var archievelen = $('dd a.i-archive-files-item').length; + for(i=archievelen-1;i>=0;i--) + if($('dd a.i-archive-files-item').eq(i).html().trim()=="") + $('dd a.i-archive-files-item').eq(i).parent('dd').remove(); + // 刪除具有空連結欄位的橫列 + for(var i = 0;i < $('*[data-list] tr td a').length ; i++) + if($('*[data-list] tr td a').eq(i).html().trim()=="") + $('*[data-list] tr td a').eq(i).parent('td').parent('tr').remove(); + // tab按鍵選到menu,會顯示下層的menu(為了符合無障礙) + $('.nav-level-0>li>a').focus(function(e) { + e.stopPropagation(); + $(this).parent().focus(); + if ($(this).parent().find('.nav-level-1').hasClass('show')) { + } else { + $('.nav-level-1').removeClass('show'); + $(this).parent().find('.nav-level-1').addClass('show'); + } + }); + $('.nav-level-1>li>a').focus(function(e) { + e.stopPropagation(); + if ($(this).parent().find('.nav-level-2').hasClass('show')) { + }else{ + $('.nav-level-2').removeClass('show'); + $(this).parent().find('.nav-level-2').addClass('show'); + } + }); + $('show').parent('li').focus(); } - }); - $('show').parent('li').focus(); - } - forFreeGo(); + forFreeGo(); - //header banner setting - if ( location.href.search('editmode=on') != -1 ) { - $('.header-banner').css('z-index','2'); - } else { - $('.header-banner').css({ - 'position': 'relative', - 'top': '0', - 'z-index': '-2', - }); - }; + //header banner setting + if ( location.href.search('editmode=on') != -1 ) { + $('.header-banner').css('z-index','2'); + } else { + $('.header-banner').css({ + 'position': 'relative', + 'top': '0', + 'z-index': '-2', + }); + }; -//公告頁籤 - function annc_widget_nav() { - $('.tab_nav').nextAll().addClass('tab_content'); - $('.tab_content').css("display","none"); - $('.tab_content').eq(0).css('display', 'block'); - - var num = $('.tab_nav li').length; - $('.tab_content').eq(num).css('display', 'block'); - $('.tab_content').eq(num).nextAll().css('display', 'block'); - - $('.tab_nav li').off('click').on('click',function() { - $('.tab_nav li').removeClass('active'); - $(this).addClass('active'); - var fa = $(this).index(); - - $('.tab_content').attr('style',''); + //公告頁籤 + function annc_widget_nav() { + $('.tab_nav').nextAll().addClass('tab_content'); $('.tab_content').css("display","none"); - $('.tab_content').eq(fa).css('display','block'); + $('.tab_content').eq(0).css('display', 'block'); + var num = $('.tab_nav li').length; $('.tab_content').eq(num).css('display', 'block'); $('.tab_content').eq(num).nextAll().css('display', 'block'); -}); - var url = window.location.search; - if (url == "?editmode=on") { - $('.tab_content').css({'position': 'relative','display':'block'}); -} -} - annc_widget_nav(); + $('.tab_nav li').off('click').on('click',function() { + $('.tab_nav li').removeClass('active'); + $(this).addClass('active'); + var fa = $(this).index(); -//切換語言停留在同一頁 -if(window.location.pathname!="/") -$("#en").attr("href",window.location.pathname.replace("zh_tw","en")) + $('.tab_content').attr('style',''); + $('.tab_content').css("display","none"); + $('.tab_content').eq(fa).css('display','block'); + var num = $('.tab_nav li').length; + $('.tab_content').eq(num).css('display', 'block'); + $('.tab_content').eq(num).nextAll().css('display', 'block'); + }); -//檔案室 下載檔案 hover 彈出備註訊息 -$('[data-toggle="tooltip"]').tooltip() + var url = window.location.search; + if (url == "?editmode=on") { + $('.tab_content').css({'position': 'relative','display':'block'}); + } + } + annc_widget_nav(); -//下載檔案格式dot pdf分色 -$(".i-archive .label.label-primary").each(function() { - var downloadType = $(this).text(); - $(this).addClass(downloadType); -}) + //切換語言停留在同一頁 + if(window.location.pathname!="/") + $("#en").attr("href",window.location.pathname.replace("zh_tw","en")) -//檔案室模組 Widget 手風琴 -function extendPanelWidget() { - var len = $('.panel-title').length; - var i = -1; - if (len > 0) { - // 新增數字到要對應的panel按鈕id及href上面 - for (i = 0; i < len; i++) { - $('.panel-title:eq(' + i + ') .collapsed').attr('href', '#collapse' + i); - $('.panel-collapse:eq(' + i + ')').attr('id', 'collapse' + i); + //檔案室 下載檔案 hover 彈出備註訊息 + $('[data-toggle="tooltip"]').tooltip() + + //下載檔案格式dot pdf分色 + $(".i-archive .label.label-primary").each(function() { + var downloadType = $(this).text(); + $(this).addClass(downloadType); + }) + + //檔案室模組 Widget 手風琴 + function extendPanelWidget() { + var len = $('.panel-title').length; + var i = -1; + if (len > 0) { + // 新增數字到要對應的panel按鈕id及href上面 + for (i = 0; i < len; i++) { + $('.panel-title:eq(' + i + ') .collapsed').attr('href', '#collapse' + i); + $('.panel-collapse:eq(' + i + ')').attr('id', 'collapse' + i); + } } } -} -extendPanelWidget(); + extendPanelWidget(); -// member show tab scroll - $('.nav-pills').scrollingTabs({ - scrollToTabEdge: true, - enableSwiping: true, - leftArrowContent: [ - '
', - '
' - ].join(''), - rightArrowContent: [ - '
', - '
' - ].join('') + // member show tab scroll + $('.nav-pills').scrollingTabs({ + scrollToTabEdge: true, + enableSwiping: true, + leftArrowContent: [ + '
', + '
' + ].join(''), + rightArrowContent: [ + '
', + '
' + ].join('') + }); + + + } + + $(document).ready(function () { + // 處理所有 .fnav-item 裡的
+ $(".fnav-item a").each(function () { + const $a = $(this); + + // 如果內部已經有 .sr-only,就略過 + if ($a.find(".sr-only").length > 0) return; + + // 嘗試從 title 擷取語意文字 + let label = $a.attr("title") || ""; + + // 如果還是空字串,再嘗試用 i 的 title + if (!label.trim()) { + const iconTitle = $a.find("i").attr("title"); + if (iconTitle) label = iconTitle; + } + + // 如果真的都沒有語意,預設一個 generic label(也可加入 warning log) + if (!label.trim()) { + label = "操作按鈕"; + } + + // 加上 title 和 aria-label + $a.attr("title", label).attr("aria-label", label); + + // 加上 sr-only 輔助文字 + $a.append(`${label}`); + + // 確保 icon 不被閱讀器讀取 + $a.find("i").attr("aria-hidden", "true"); + $a.find(".icon").attr("aria-hidden", "true"); + }); }); - -} - -$(document).ready(function () { - // 處理所有 .fnav-item 裡的 - $(".fnav-item a").each(function () { - const $a = $(this); - - // 如果內部已經有 .sr-only,就略過 - if ($a.find(".sr-only").length > 0) return; - - // 嘗試從 title 擷取語意文字 - let label = $a.attr("title") || ""; - - // 如果還是空字串,再嘗試用 i 的 title - if (!label.trim()) { - const iconTitle = $a.find("i").attr("title"); - if (iconTitle) label = iconTitle; - } - - // 如果真的都沒有語意,預設一個 generic label(也可加入 warning log) - if (!label.trim()) { - label = "操作按鈕"; - } - - // 加上 title 和 aria-label - $a.attr("title", label).attr("aria-label", label); - - // 加上 sr-only 輔助文字 - $a.append(`${label}`); - - // 確保 icon 不被閱讀器讀取 - $a.find("i").attr("aria-hidden", "true"); - $a.find(".icon").attr("aria-hidden", "true"); - }); -}); - -//video js -$(document).ready(function () { - if ($(".main-content .video_detail").length > 0) { - $('.videopagenone').css("display","none"); - $('.videopage').css('display', 'block'); - $('.sitemenu').css("display","none"); - $('span img[alt="HD"]').parent().hide(); - $('span img[alt="觀看人數"]').remove(); - $(".video_detail .view_info span").each(function () { - var text = $(this).text().trim(); // 取得 裡的文字,去掉前後空格 - var number = text.replace(/\D/g, ""); // 只保留數字部分 - if (number) { - $(this).text(`・觀看次數:${number}次`); // 更新內容格式 - } - }); - $(".movie_desc").before('

單元介紹

'); - $(".movie_desc").each(function () { - var decodedHtml = $("
").html($(this).text()).html(); // 轉換轉義的 HTML - $(this).html(decodedHtml); // 設置為真正的 HTML - }); - $(".video_group_time").each(function () { - var $this = $(this); - // 找到對應的 ,並移動到 .video_group_time 內部 - var $q = $this.closest(".imglst_desc").find(".movie_desc q"); - if ($q.length) { - $this.append($q.clone()); // 將 複製並添加到 .video_group_time - $q.remove(); // 移除 .movie_desc 裡的 - } - // 移動 .view_info 到 .video_group_time 的內部 - $this.append($this.siblings(".view_info")); - // 取得內容並移除 "SystemAdmin | " 前綴 - var text = $this.text().trim(); - var newText = text.replace(/^.*\|\s*/, ""); // 移除 "SystemAdmin | " - $this.text(newText); // 更新內容 - $(this).insertBefore($(this).closest(".imglst_desc").siblings("h3")); - }); - - $(".main-content").css({ - "max-width": "920px", - "margin": "auto" - }); - $(".video_box_wrap").css("padding-bottom", "56%"); - $(".video_detail .video_yt_box").insertBefore(".video_detail .video_group_time"); - - }; - function getYouTubeThumbnail() { - var $ytThumb = $(".ytp-cued-thumbnail-overlay-image"); - if ($ytThumb.length) { - var imageUrl = $ytThumb.css("background-image"); - // 檢查背景圖格式:url("https://...") - var urlMatch = imageUrl.match(/url\(["']?(.*?)["']?\)/); - var extractedUrl = urlMatch ? urlMatch[1] : null; - if (extractedUrl) { - // console.log("成功獲取縮圖:", extractedUrl); - $(".background").css("background-image", `url("${extractedUrl}")`); + //video js + $(document).ready(function () { + if ($(".main-content .video_detail").length > 0) { + $('.videopagenone').css("display","none"); + $('.videopage').css('display', 'block'); + $('.sitemenu').css("display","none"); + $('span img[alt="HD"]').parent().hide(); + $('span img[alt="觀看人數"]').remove(); + $(".video_detail .view_info span").each(function () { + var text = $(this).text().trim(); // 取得 裡的文字,去掉前後空格 + var number = text.replace(/\D/g, ""); // 只保留數字部分 + if (number) { + $(this).text(`・觀看次數:${number}次`); // 更新內容格式 + } + }); + $(".movie_desc").before('

影片內容

'); + $(".movie_desc").each(function () { + var decodedHtml = $("
").html($(this).text()).html(); // 轉換轉義的 HTML + $(this).html(decodedHtml); // 設置為真正的 HTML + }); + $(".video_group_time").each(function () { + var $this = $(this); + // 找到對應的 ,並移動到 .video_group_time 內部 + var $q = $this.closest(".imglst_desc").find(".movie_desc q"); + if ($q.length) { + $this.append($q.clone()); // 將 複製並添加到 .video_group_time + $q.remove(); // 移除 .movie_desc 裡的 + } + // 移動 .view_info 到 .video_group_time 的內部 + $this.append($this.siblings(".view_info")); + // 取得內容並移除 "SystemAdmin | " 前綴 + var text = $this.text().trim(); + var newText = text.replace(/^.*\|\s*/, ""); // 移除 "SystemAdmin | " + $this.text(newText); // 更新內容 + $(this).insertBefore($(this).closest(".imglst_desc").siblings("h3")); + }); + + $(".main-content").css({ + "max-width": "920px", + "margin": "auto" + }); + $(".video_box_wrap").css("padding-bottom", "56%"); + $(".video_detail .video_yt_box").insertBefore(".video_detail .video_group_time"); + + }; + function getYouTubeThumbnail() { + var $ytThumb = $(".ytp-cued-thumbnail-overlay-image"); + if ($ytThumb.length) { + var imageUrl = $ytThumb.css("background-image"); + // 檢查背景圖格式:url("https://...") + var urlMatch = imageUrl.match(/url\(["']?(.*?)["']?\)/); + var extractedUrl = urlMatch ? urlMatch[1] : null; + if (extractedUrl) { + // console.log("成功獲取縮圖:", extractedUrl); + $(".background").css("background-image", `url("${extractedUrl}")`); + } else { + // console.log("背景圖格式不對,改用影片 ID 生成縮圖"); + setThumbnailFromVideoId(); + } } else { - // console.log("背景圖格式不對,改用影片 ID 生成縮圖"); + // console.log("找不到 .ytp-cued-thumbnail-overlay-image,改用影片 ID 生成縮圖"); setThumbnailFromVideoId(); } - } else { - // console.log("找不到 .ytp-cued-thumbnail-overlay-image,改用影片 ID 生成縮圖"); - setThumbnailFromVideoId(); } - } - function setThumbnailFromVideoId() { - var $iframe = $("iframe[src*='youtube.com/embed']"); - if ($iframe.length) { - var src = $iframe.attr("src"); - var videoIdMatch = src.match(/youtube\.com\/embed\/([^?]+)/); - var videoId = videoIdMatch ? videoIdMatch[1] : null; + function setThumbnailFromVideoId() { + var $iframe = $("iframe[src*='youtube.com/embed']"); + if ($iframe.length) { + var src = $iframe.attr("src"); + var videoIdMatch = src.match(/youtube\.com\/embed\/([^?]+)/); + var videoId = videoIdMatch ? videoIdMatch[1] : null; - if (videoId) { - var fallbackImageUrl = `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`; - // console.log("透過影片 ID 取得縮圖:", fallbackImageUrl); - $(".background").css("background-image", `url("${fallbackImageUrl}")`); - } - } - } - // 嘗試多次加載 - var interval = setInterval(function () { - if ($(".ytp-cued-thumbnail-overlay-image").length || $("iframe[src*='youtube.com/embed']").length) { - getYouTubeThumbnail(); - clearInterval(interval); - } - }, 1000); - //改變日期格式 - $(".video_group_time").each(function () { - var $this = $(this); - var originalText = $this.text().trim(); - // 把 YYYY-MM-DD 轉換成 M月D日 - var formattedText = originalText.replace(/(\d{4})-(\d{2})-(\d{2})/g, function (match, year, month, day) { - return parseInt(month, 10) + "月" + parseInt(day, 10) + "日"; - }); - // 找到對應的 ,並複製 - var $q = $this.closest(".video_data").find(".video_desc q").clone(); - // 更新內容並加上 - $this.html(formattedText).append($q); - }); - -}); - -$(document).ready(function () { - $('.rucaptcha-image').removeAttr('onload'); - - // 檢查是否已插入過 - if (!$('#captcha_audio').length) { - const audioButton = $(` - - `); - - const audio = $(''); - - $('.rucaptcha-image').after(audioButton, audio); - } -}); - -//萬用表格searchbtn2 -$(document).ready(function () { - $('.searchbtn2').click(function (event) { - event.preventDefault(); // 防止預設行為 - $(".searchbox").slideToggle(300, function () { - updateAriaExpanded(); - }); - $(this).closest('.ken-click').toggleClass('ken-click2'); - }); - - let triggeredByFocus = false; - - function updateAriaExpanded() { - const isVisible = $(".searchbox").is(":visible"); - $(".searchbtn2").attr("aria-expanded", isVisible ? "true" : "false"); - } - - // 預設 aria-expanded 為 false - $(".searchbtn2").attr("aria-expanded", "false"); -}); - //強制保持全站search展開 -$(document).ready(function () { - - //search移位 - function moveSearchIfWide() { - if ($('.input-search').is(':focus')) return; - - if ($(window).width() > 769) { - // 如果已經在正確位置就不動 - if (!$('.modules-menu-level-0 .searchclass').length) { - $('.searchclass').appendTo('.header-nav'); - } - } else { - if (!$('.navbar-header .searchclass').length) { - $('.navbar-brand').after($('.searchclass')); - } - } - } - - $(document).ready(moveSearchIfWide); - $(window).on('resize', moveSearchIfWide); - - const $searchBox = $('.search-box'); - const $input = $searchBox.find('.input-search'); - const $btn = $('.btn-search'); - - // 點擊 btn 時:若未展開則展開,展開後才可送出 - $btn.on('click', function (e) { - if (!$searchBox.hasClass('searching')) { - e.preventDefault(); // 第一次點擊不送出 - // 延遲讓 Android 不會立即 blur - setTimeout(() => { - $searchBox.addClass('searching'); - $input[0].focus(); // 用 DOM 方式較穩 - }, 100); - } else if (!$input.val().trim()) { - // 沒有輸入值 → 不送出,focus 回去 - e.preventDefault(); - $input[0].focus(); - } - // 有輸入值就正常送出 - }); - - // 點外面收起(無字才收) - $(document).on('click touchstart', function (e) { - if ( - !$searchBox.is(e.target) && - $searchBox.has(e.target).length === 0 && - !$input.val().trim() - ) { - $searchBox.removeClass('searching'); - } - }); - - // focus 時延遲加 .searching,避免 Android 被打斷 - $input.on('focus', function () { - setTimeout(() => { - $searchBox.addClass('searching'); - }, 50); - }); - - // blur 時延遲移除 .searching,避免太早發生 - $input.on('blur', function () { - setTimeout(() => { - if (!$input.val().trim()) { - $searchBox.removeClass('searching'); - } - }, 150); - }); - }); -// 當文件物件模型(DOM)載入後,執行init函數 -$(document).ready(function() { - //常用到的js - // $('.').after($('.')); - // $('.').before($('.')); - // $('.').append($('.')); - // if($('.show-announcement').hasClass('show-announcement')) { - // $('.').css('', ''); - // } - $('a').each(function () { - const $a = $(this); - - // 有圖示或圖片就不刪 - if ($a.find('i, img').length > 0) return; - - // 沒有任何實際文字內容(去除空白) - const hasVisibleText = $a.text().trim().length > 0; - - // 進一步判斷 span 內部是否完全為空 - const allChildrenEmpty = $a.children().length > 0 && $a.children().toArray().every(child => { - return $(child).text().trim().length === 0; - }); - - // 如果沒有文字內容且子元素全為空,則移除 - if (!hasVisibleText && allChildrenEmpty) { - $a.remove(); - } - }); - $('.i-member-pic-wrap a').removeAttr('target'); - function markCheckStatusButton() { - $('.ask-question').each(function () { - var $prev = $(this).prev(); // 取得前一個元素 - - // 如果前一個元素是 且 class 包含 "btn" - if ($prev.is('a') && $prev.hasClass('btn')) { - $prev.addClass('CheckStatus'); // 加上 class - } - }); - }; - markCheckStatusButton(); - - - // 綁定滑動事件 - $(".cycle-slideshow").swipe({ - swipeLeft: function () { - $(this).cycle("next"); - }, - swipeRight: function () { - $(this).cycle("prev"); - }, - threshold: 50, // 滑動靈敏度(數值越小越敏感) - }); - - $('#check_history_form input[type="submit"][value="Check History"]').addClass('CheckHistory'); - $(".mybooking").append(''); - //內頁dattpp移位 - $('.i-annc__page-title').after($('.sitemenu-wrap2')); - $('.i-archive-title').after($('.sitemenu-wrap2')); - $('.page-module-title').after($('.sitemenu-wrap2')); - $('.box-social-share').before($('.sitemenu-wrap3')); - $('.box-social-share').before($('.sitemenu-wrap3')); - $('.box-social-share').before($('.sitemenu-wrap3')); - $(".member-data2-tr").before($(".show-member .table-striped > tbody > tr:nth-of-type(4)")); - $(".nav-pills").before($(".show-member .table-striped > tbody > tr:last-child")); - - //檔案室手風琴 - $('.panel-title>.collapsed').click(function(){ - $(this).find('.fa').toggleClass("fa-chevron-down"); - $(this).find('.fa').toggleClass("fa-chevron-up"); - }); - - //背景widget設定 - if ( location.href.search('editmode=on') != -1 ) { - $('.background').css('z-index','2'); - $('.background').css('position','relative'); - } else { - $('.background').css('z-index','-1'); - $('.background').css('position','fixed'); - }; - //公告類別顏色 - // $(".w-annc .w-annc__category-wrap").each(function() { - // var SaveCategory = $(this).find(".w-annc__category").text(); - // $(this).addClass(SaveCategory); - // }) - // $(".w-annc__item ").each(function() { - // var SaveCategory2 = $(this).find(".w-annc__category").text(); - // $(this).addClass(SaveCategory2); - // }) - $(".i-annc__item .i-annc__category-wrap").each(function() { - var SaveCategory = $(this).find(".i-annc__category").text(); - $(this).addClass(SaveCategory); - }) - $(".i-annc__item ").each(function() { - var SaveCategory2 = $(this).find(".i-annc__category").text(); - $(this).addClass(SaveCategory2); - }) - - //預約 - if ($(window).width() > 821) { - $('.form-horizontal').append($('.cancelbooking')); - $(".hire-ken-click").click(function(){ - // $(".searchbox").slideToggle(300); - $('.form-horizontal').toggleClass('hire-ken-click2'); - $('.col-lg-5').toggleClass('shadowblock'); - $(".cancelbooking").click(function(){ - $('.form-horizontal').removeClass('hire-ken-click2'); - $('.col-lg-5').removeClass('shadowblock'); - }); - }); - } - //navrwd移到選單 - if ($(window).width() <769) { - $('.modules-menu-level-0').after($('.header-nav')); - }else{ - $('.outdropdowns').before($('.header-nav')); - }; - $('.sitemenu-vertical .sitemenu-dropdown-toggle').click(function(){ - $('.sitemenu-vertical .dropdown-menu').slideToggle(); - $(".sitemenu-vertical .sitemenu-dropdown-toggle").toggleClass("fa-caret-down"); - $(".sitemenu-vertical .sitemenu-dropdown-toggle").toggleClass("fa-caret-up"); - }); - //頁尾選單開合 - $('.btn-fatfooter').click(function(){ - $('.fatfooter').slideToggle(); - $(".btn-fatfooter .fa-chevron-down").toggleClass("rotate"); - }); - - $(".menu-toggle").on('click', function() { - $(this).toggleClass("on"); - $('.menu-section').toggleClass("on"); - $("nav ul").toggleClass('hidden'); - }); - $('.morebken').click(function(){ - $('.list-unstyled>li:nth-child(n+5)').slideToggle(); - $(".morebken .fa-chevron-down").toggleClass("rotate"); - $(".openmorebken").toggleClass("closemorebken"); - }); - //RWD 自動縮放headerbannner - function headerH() { - if ($(window).width() < 769) { - const navH = $('.layout-header .navbar-header').outerHeight(); - $('.header-banner').css('height', navH ); - } - } - headerH(); - //downIcon - $(".downIcon").click(function () { - var move_to_target = function (stop) { - var theTop; - if (stop) { - // $(".kenjohn").addClass('navFixed'); - if ($('.layout-content2.topcontent').length != 0 && $('.layout-content2.topcontent').offset().top < 400) { - $('.layout-content2').css('margin-top', $('.kenjohn').height() - $('#orbit-bar').height()); + if (videoId) { + var fallbackImageUrl = `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`; + // console.log("透過影片 ID 取得縮圖:", fallbackImageUrl); + $(".background").css("background-image", `url("${fallbackImageUrl}")`); } - if (parseInt($('.layout-content2').css('margin-top') == 0)) { - theTop = $('.layout-content2.topcontent').offset().top - $(".kenjohn").position().top - 95; - } else { - theTop = $('.layout-content2.topcontent').offset().top - $(".kenjohn").position().top - $(".kenjohn").height() - 95; + } + } + // 嘗試多次加載 + var interval = setInterval(function () { + if ($(".ytp-cued-thumbnail-overlay-image").length || $("iframe[src*='youtube.com/embed']").length) { + getYouTubeThumbnail(); + clearInterval(interval); + } + }, 1000); + //改變日期格式 + $(".video_group_time").each(function () { + var $this = $(this); + var originalText = $this.text().trim(); + // 把 YYYY-MM-DD 轉換成 M月D日 + var formattedText = originalText.replace(/(\d{4})-(\d{2})-(\d{2})/g, function (match, year, month, day) { + return parseInt(month, 10) + "月" + parseInt(day, 10) + "日"; + }); + // 找到對應的 ,並複製 + var $q = $this.closest(".video_data").find(".video_desc q").clone(); + // 更新內容並加上 + $this.html(formattedText).append($q); + }); + + }); + //rucaptcha-image + $(document).ready(function () { + $('.rucaptcha-image').removeAttr('onload'); + + // 檢查是否已插入過 + if (!$('#captcha_audio').length) { + const audioButton = $(` + + `); + + const audio = $(''); + + $('.rucaptcha-image').after(audioButton, audio); + } + }); + + //萬用表格searchbtn2 + $(document).ready(function () { + $('.searchbtn2').click(function (event) { + event.preventDefault(); // 防止預設行為 + $(".searchbox").slideToggle(300, function () { + updateAriaExpanded(); + }); + $(this).closest('.ken-click').toggleClass('ken-click2'); + }); + + let triggeredByFocus = false; + + function updateAriaExpanded() { + const isVisible = $(".searchbox").is(":visible"); + $(".searchbtn2").attr("aria-expanded", isVisible ? "true" : "false"); + } + + // 預設 aria-expanded 為 false + $(".searchbtn2").attr("aria-expanded", "false"); + }); + //強制保持全站search展開 + $(document).ready(function () { + + //search移位 + function moveSearchIfWide() { + if ($('.input-search').is(':focus')) return; + + if ($(window).width() > 769) { + // 如果已經在正確位置就不動 + if (!$('.modules-menu-level-0 .searchclass').length) { + $('.searchclass').appendTo('.header-nav'); } } else { - theTop = 5; + if (!$('.navbar-header .searchclass').length) { + $('.navbar-brand').after($('.searchclass')); + } } - // console.log(theTop); - $("html, body").animate({ - scrollTop: theTop - }, { - duration: 400, easing: "swing", complete: function () { - // console.log('finish'); - if (!stop) { - move_to_target(true); - } + } + + $(document).ready(moveSearchIfWide); + $(window).on('resize', moveSearchIfWide); + + const $searchBox = $('.search-box'); + const $input = $searchBox.find('.input-search'); + const $btn = $('.btn-search'); + + // 點擊 btn 時:若未展開則展開,展開後才可送出 + $btn.on('click', function (e) { + if (!$searchBox.hasClass('searching')) { + e.preventDefault(); // 第一次點擊不送出 + // 延遲讓 Android 不會立即 blur + setTimeout(() => { + $searchBox.addClass('searching'); + $input[0].focus(); // 用 DOM 方式較穩 + }, 100); + } else if (!$input.val().trim()) { + // 沒有輸入值 → 不送出,focus 回去 + e.preventDefault(); + $input[0].focus(); + } + // 有輸入值就正常送出 + }); + + // 點外面收起(無字才收) + $(document).on('click touchstart', function (e) { + if ( + !$searchBox.is(e.target) && + $searchBox.has(e.target).length === 0 && + !$input.val().trim() + ) { + $searchBox.removeClass('searching'); + } + }); + + // focus 時延遲加 .searching,避免 Android 被打斷 + $input.on('focus', function () { + setTimeout(() => { + $searchBox.addClass('searching'); + }, 50); + }); + + // blur 時延遲移除 .searching,避免太早發生 + $input.on('blur', function () { + setTimeout(() => { + if (!$input.val().trim()) { + $searchBox.removeClass('searching'); + } + }, 150); + }); + }); + // 當文件物件模型(DOM)載入後,執行init函數 + $(document).ready(function() { + //常用到的js + // $('.').after($('.')); + // $('.').before($('.')); + // $('.').append($('.')); + // if($('.show-announcement').hasClass('show-announcement')) { + // $('.').css('', ''); + // } + + if($('.s-annc').length){ + $(".carousel_images h4").remove(); + $('.carousel_images').addClass('carousel_images2'); + $(".carousel_images .w-ba-banner").next("div").find(".button-mid").remove(); + $(".s-annc__post-wrap").next("hr").remove(); + // $(".carousel_images").insertAfter(".s-annc__meta-wrap"); + $('.breadcrumb-wrap').css('display', 'block'); + // $(".main-content").css({ + // "max-width": "920px", + // "margin": "auto" + // }); + } + $('.s-annc__tag-wrap ').after($('.s-annc__post-orbithashtags')); + $('a').each(function () { + const $a = $(this); + + // 有圖示或圖片就不刪 + if ($a.find('i, img').length > 0) return; + + // 沒有任何實際文字內容(去除空白) + const hasVisibleText = $a.text().trim().length > 0; + + // 進一步判斷 span 內部是否完全為空 + const allChildrenEmpty = $a.children().length > 0 && $a.children().toArray().every(child => { + return $(child).text().trim().length === 0; + }); + + // 如果沒有文字內容且子元素全為空,則移除 + if (!hasVisibleText && allChildrenEmpty) { + $a.remove(); + } + }); + $('.i-member-pic-wrap a').removeAttr('target'); + function markCheckStatusButton() { + $('.ask-question').each(function () { + var $prev = $(this).prev(); // 取得前一個元素 + + // 如果前一個元素是 且 class 包含 "btn" + if ($prev.is('a') && $prev.hasClass('btn')) { + $prev.addClass('CheckStatus'); // 加上 class } }); - } - move_to_target(false); - return false; + }; + markCheckStatusButton(); + + + // 綁定滑動事件 + $(".cycle-slideshow").swipe({ + swipeLeft: function () { + $(this).cycle("next"); + }, + swipeRight: function () { + $(this).cycle("prev"); + }, + threshold: 50, // 滑動靈敏度(數值越小越敏感) }); - $(window).resize(function() { - if ($(window).width() <769) { - $('.modules-menu-level-0').after($('.header-nav')); - }else{ - $('.outdropdowns').before($('.header-nav')); + $('#check_history_form input[type="submit"][value="Check History"]').addClass('CheckHistory'); + $(".mybooking").append(''); + //內頁dattpp移位 + $('.i-annc__page-title').after($('.sitemenu-wrap2')); + $('.i-archive-title').after($('.sitemenu-wrap2')); + $('.page-module-title').after($('.sitemenu-wrap2')); + $('.box-social-share').before($('.sitemenu-wrap3')); + $('.box-social-share').before($('.sitemenu-wrap3')); + $('.box-social-share').before($('.sitemenu-wrap3')); + $(".member-data2-tr").before($(".show-member .table-striped > tbody > tr:nth-of-type(4)")); + $(".nav-pills").before($(".show-member .table-striped > tbody > tr:last-child")); + + //檔案室手風琴 + $('.panel-title>.collapsed').click(function(){ + $(this).find('.fa').toggleClass("fa-chevron-down"); + $(this).find('.fa').toggleClass("fa-chevron-up"); + }); + + //背景widget設定 + if ( location.href.search('editmode=on') != -1 ) { + $('.background').css('z-index','2'); + $('.background').css('position','relative'); + } else { + $('.background').css('z-index','-1'); + $('.background').css('position','fixed'); }; + //公告類別顏色 + // $(".w-annc .w-annc__category-wrap").each(function() { + // var SaveCategory = $(this).find(".w-annc__category").text(); + // $(this).addClass(SaveCategory); + // }) + // $(".w-annc__item ").each(function() { + // var SaveCategory2 = $(this).find(".w-annc__category").text(); + // $(this).addClass(SaveCategory2); + // }) + $(".i-annc__item .i-annc__category-wrap").each(function() { + var SaveCategory = $(this).find(".i-annc__category").text(); + $(this).addClass(SaveCategory); + }) + $(".i-annc__item ").each(function() { + var SaveCategory2 = $(this).find(".i-annc__category").text(); + $(this).addClass(SaveCategory2); + }) + //預約 if ($(window).width() > 821) { $('.form-horizontal').append($('.cancelbooking')); $(".hire-ken-click").click(function(){ @@ -1391,201 +1318,319 @@ $(document).ready(function() { }); }); } - headerH(); - }) - $(window).scroll(function() { - initdata1(); - }); - // $(window).scroll(function() { - // if ($(this).scrollTop() > 100) { /* 要滑動到選單的距離 */ - // $('.outdropdowns').addClass('navFixed'); /* 幫選單加上固定效果 */ - // } else { - // $('.outdropdowns').removeClass('navFixed'); /* 移除選單固定效果 */ - // } - // }); - // $('.navbar-brand h2').replaceWith(function() { - // return $("

", { - // class: this.className, - // html: $(this).html() - // }); - // }); - $('#search'). attr('title', '另開新視窗'); - $(window).scroll(function () { - var windowTop = $(window).scrollTop(); - var windowBottom = windowTop + $(window).innerHeight(); + //navrwd移到選單 + if ($(window).width() <769) { + $('.modules-menu-level-0').after($('.header-nav')); + }else{ + $('.outdropdowns').before($('.header-nav')); + }; + $('.sitemenu-vertical .sitemenu-dropdown-toggle').click(function(){ + $('.sitemenu-vertical .dropdown-menu').slideToggle(); + $(".sitemenu-vertical .sitemenu-dropdown-toggle").toggleClass("fa-caret-down"); + $(".sitemenu-vertical .sitemenu-dropdown-toggle").toggleClass("fa-caret-up"); + }); + //頁尾選單開合 + $('.btn-fatfooter').click(function(){ + $('.fatfooter').slideToggle(); + $(".btn-fatfooter .fa-chevron-down").toggleClass("rotate"); + }); - function handleAnimationOnce(selector, animationClass, offsetRatio = 0.5) { - $(selector).each(function () { - var elementTop = $(this).offset().top; - var elementHeight = $(this).height(); - var triggerPoint = elementTop + elementHeight * offsetRatio; - - if ( - triggerPoint >= windowTop && - triggerPoint <= windowBottom && - !$(this).hasClass(animationClass) - ) { - $(this).addClass(animationClass); + $(".menu-toggle").on('click', function() { + $(this).toggleClass("on"); + $('.menu-section').toggleClass("on"); + $("nav ul").toggleClass('hidden'); + }); + $('.morebken').click(function(){ + $('.list-unstyled>li:nth-child(n+5)').slideToggle(); + $(".morebken .fa-chevron-down").toggleClass("rotate"); + $(".openmorebken").toggleClass("closemorebken"); + }); + //RWD 自動縮放headerbannner + function headerH() { + if ($(window).width() < 769) { + const navH = $('.layout-header .navbar-header').outerHeight(); + $('.header-banner').css('height', navH ); + } + } + headerH(); + //downIcon + $(".downIcon").click(function () { + var move_to_target = function (stop) { + var theTop; + if (stop) { + // $(".kenjohn").addClass('navFixed'); + if ($('.layout-content2.topcontent').length != 0 && $('.layout-content2.topcontent').offset().top < 400) { + $('.layout-content2').css('margin-top', $('.kenjohn').height() - $('#orbit-bar').height()); + } + if (parseInt($('.layout-content2').css('margin-top') == 0)) { + theTop = $('.layout-content2.topcontent').offset().top - $(".kenjohn").position().top - 95; + } else { + theTop = $('.layout-content2.topcontent').offset().top - $(".kenjohn").position().top - $(".kenjohn").height() - 95; + } + } else { + theTop = 5; } + // console.log(theTop); + $("html, body").animate({ + scrollTop: theTop + }, { + duration: 400, easing: "swing", complete: function () { + // console.log('finish'); + if (!stop) { + move_to_target(true); + } + } + }); + } + move_to_target(false); + return false; + }); + $(window).resize(function() { + if ($(window).width() <769) { + + $('.modules-menu-level-0').after($('.header-nav')); + }else{ + $('.outdropdowns').before($('.header-nav')); + }; + + if ($(window).width() > 821) { + $('.form-horizontal').append($('.cancelbooking')); + $(".hire-ken-click").click(function(){ + // $(".searchbox").slideToggle(300); + $('.form-horizontal').toggleClass('hire-ken-click2'); + $('.col-lg-5').toggleClass('shadowblock'); + $(".cancelbooking").click(function(){ + $('.form-horizontal').removeClass('hire-ken-click2'); + $('.col-lg-5').removeClass('shadowblock'); + }); + }); + } + headerH(); + }) + $(window).scroll(function() { + initdata1(); + }); + // $(window).scroll(function() { + // if ($(this).scrollTop() > 100) { /* 要滑動到選單的距離 */ + // $('.outdropdowns').addClass('navFixed'); /* 幫選單加上固定效果 */ + // } else { + // $('.outdropdowns').removeClass('navFixed'); /* 移除選單固定效果 */ + // } + // }); + // $('.navbar-brand h2').replaceWith(function() { + // return $("

", { + // class: this.className, + // html: $(this).html() + // }); + // }); + $('#search'). attr('title', '另開新視窗'); + $(window).scroll(function () { + var windowTop = $(window).scrollTop(); + var windowBottom = windowTop + $(window).innerHeight(); + + function handleAnimationOnce(selector, animationClass, offsetRatio = 0.5) { + $(selector).each(function () { + var elementTop = $(this).offset().top; + var elementHeight = $(this).height(); + var triggerPoint = elementTop + elementHeight * offsetRatio; + + if ( + triggerPoint >= windowTop && + triggerPoint <= windowBottom && + !$(this).hasClass(animationClass) + ) { + $(this).addClass(animationClass); + } + }); + } + + handleAnimationOnce('.hide0', 'animationvisible', 0.1); + handleAnimationOnce('.hide1', 'animationvisible1', 0.5); + handleAnimationOnce('.hide2', 'animationvisible2', 0.5); + handleAnimationOnce('.hide3', 'animationvisible3', 0.5); + handleAnimationOnce('.rotate0', 'animationrotate0', 0.5); + handleAnimationOnce('.zoomin', 'animationvisible5', 0.5); + }); + + init(); + }); + + //orbitbar無障礙js + $(document).ready(function() { + const isEnglish = document.documentElement.lang === 'en'; + + if (isEnglish) { + $('.navbar-toggle').attr({ + title: 'menu', + 'aria-label': 'menu' + }); + $('label[for="open-orbit-nav"]').attr({ + title: 'Site search and language menu', + 'aria-label': 'Site search and language menu' + }); + $('.mobile-button').attr({ + title: 'Language menu', + 'aria-label': 'Language menu' + }); + } else { + $('label[for="open-orbit-nav"]').attr({ + title: '全站収尋及語言切換選單', + 'aria-label': '全站収尋及語言切換選單' + }); + $('.mobile-button').attr({ + title: '語言切換選單', + 'aria-label': '語言切換選單' }); } + - handleAnimationOnce('.hide0', 'animationvisible', 0.1); - handleAnimationOnce('.hide1', 'animationvisible1', 0.5); - handleAnimationOnce('.hide2', 'animationvisible2', 0.5); - handleAnimationOnce('.hide3', 'animationvisible3', 0.5); - handleAnimationOnce('.rotate0', 'animationrotate0', 0.5); - handleAnimationOnce('.zoomin', 'animationvisible5', 0.5); + $('label[for="open-orbit-login"]').removeAttr('tabindex'); + $('#orbit-bar').find('li').each(function() { + var $li = $(this); + + // 如果
  • 中没有 元素,则为
  • 设置 tabindex="0" + if ($li.children('a').length === 0) { + $li.attr('tabindex', '0'); + } else { + // 如果
  • 中有 元素,则确保 有 tabindex="0" + $li.find('a').attr('tabindex', '0'); + + // 确保
  • 不影响焦点管理,移除
  • 的 tabindex + $li.removeAttr('tabindex'); + + // 如果
  • 被聚焦,自动跳转到 元素 + $li.on('focus', function() { + $(this).find('a').focus(); + }); + } }); - - init(); -}); - -//orbitbar無障礙js -$(document).ready(function() { - const isEnglish = document.documentElement.lang === 'en'; - - if (isEnglish) { - $('.navbar-toggle').attr({ - title: 'menu', - 'aria-label': 'menu' - }); - $('label[for="open-orbit-nav"]').attr({ - title: 'Site search and language menu', - 'aria-label': 'Site search and language menu' - }); - $('.mobile-button').attr({ - title: 'Language menu', - 'aria-label': 'Language menu' - }); - } else { - $('label[for="open-orbit-nav"]').attr({ - title: '全站収尋及語言切換選單', - 'aria-label': '全站収尋及語言切換選單' - }); - $('.mobile-button').attr({ - title: '語言切換選單', - 'aria-label': '語言切換選單' - }); + $('label[for="open-orbit-nav"]').attr('tabindex', '0'); + // 当屏幕宽度小于 768px 时,将 .orbit-bar-search-sign-language 移动到
  • 中没有 元素,则为
  • 设置 tabindex="0" - if ($li.children('a').length === 0) { - $li.attr('tabindex', '0'); - } else { - // 如果
  • 中有 元素,则确保 有 tabindex="0" - $li.find('a').attr('tabindex', '0'); - - // 确保
  • 不影响焦点管理,移除
  • 的 tabindex - $li.removeAttr('tabindex'); - - // 如果
  • 被聚焦,自动跳转到 元素 - $li.on('focus', function() { - $(this).find('a').focus(); - }); - } - }); - $('label[for="open-orbit-nav"]').attr('tabindex', '0'); - // 当屏幕宽度小于 768px 时,将 .orbit-bar-search-sign-language 移动到 替換成它裡面的內容 }); -}); -// //選單樣式2 -// $(document).ready(function() { -// "use strict"; -// $(".menu > ul > li").hover(function(e) { -// if ($(window).width() > 943) { -// $(this).children("ul").stop(true, false).fadeToggle(150); -// e.preventDefault(); -// } -// }); -// $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); -// }); -// $(document).resize(function() { -// $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); -// if ($(window).width() < 769){ -// $('.modules-menu-level-1').css('left','') -// } -// }); + $('.member-data-value-3 a').each(function () { + $(this).replaceWith($(this).contents()); // 把替換成它裡面的內容 + }); + $('.member-data-value-3 a').has('i').each(function() { + $(this).replaceWith($(this).contents()); + }); + $('.member-data-value-2 a').has('i').each(function() { + $(this).replaceWith($(this).contents()); + }); + }); + + // //選單樣式2 + // $(document).ready(function() { + // "use strict"; + // $(".menu > ul > li").hover(function(e) { + // if ($(window).width() > 943) { + // $(this).children("ul").stop(true, false).fadeToggle(150); + // e.preventDefault(); + // } + // }); + // $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); + // }); + // $(document).resize(function() { + // $('.modules-menu-level-1').css('left','-'+$('.outdropdowns .dropdowns').offset().left+'px'); + // if ($(window).width() < 769){ + // $('.modules-menu-level-1').css('left','') + // } + // }); $(window).load(function(){ $("iframe[src*='google']").attr('title','googleOauth'); diff --git a/assets/stylesheets/template/base/_unity.scss b/assets/stylesheets/template/base/_unity.scss index 9d436d4..ce9d706 100644 --- a/assets/stylesheets/template/base/_unity.scss +++ b/assets/stylesheets/template/base/_unity.scss @@ -18,13 +18,14 @@ } } } -.page-home{ + .unity-title { span{ width: 100%; display: flex; justify-content: center; align-items: center; + flex-wrap: wrap; &:before{ background: url(/assets/titleicon.png) no-repeat left center; display: block; @@ -39,7 +40,7 @@ } } } -} + // Title .unity-title { line-height: 1.5; diff --git a/assets/stylesheets/template/layout/header.scss b/assets/stylesheets/template/layout/header.scss index 28f5154..75fbaf1 100644 --- a/assets/stylesheets/template/layout/header.scss +++ b/assets/stylesheets/template/layout/header.scss @@ -56,7 +56,7 @@ } .header-banner { overflow: hidden; } .header-nav { - padding:1em 0 0 0; + padding:0; font-family: $main-font; text-transform:uppercase; display: flex; @@ -157,10 +157,10 @@ height: 60px; } @media(max-width: $screen-xs){ - height: 45px !important; + height: 45px; } @media(max-width: 820px)and(min-width:$screen-xs ){ - height: 45px!important; + height: 45px; } } } diff --git a/assets/stylesheets/template/modules/ad_banner.scss b/assets/stylesheets/template/modules/ad_banner.scss index a7800c7..f3dcd6d 100644 --- a/assets/stylesheets/template/modules/ad_banner.scss +++ b/assets/stylesheets/template/modules/ad_banner.scss @@ -8,6 +8,28 @@ // Widget // ## gerenral styles +ul.button-mid{ + .prev-button{ + height: 2em !important; + width: 2em !important; + font-size: 1em !important; + line-height: 2rem !important; + border-radius: 1em; + &:hover { + background: rgba(0,0,0,0.1); + } + } + .next-button{ + height: 2em !important; + width: 2em !important; + font-size: 1em !important; + line-height: 2rem !important; + border-radius: 1em; + &:hover { + background: rgba(0,0,0,0.1); + } + } +} ul.button-mid{ margin:0; z-index: 201; @@ -69,7 +91,7 @@ iframe{ @include list-reset; position: absolute; bottom: 0.5rem!important; - z-index: 1000; + z-index: 100; text-align:center; width: 100%; li { @@ -234,7 +256,7 @@ ul.button-mid{ .banner-pager { right: 1em; top: -2em; - z-index: 102; + z-index: 100; display: none; } .button-mid{ @@ -306,7 +328,7 @@ ul.button-mid{ padding: 3.5em 5em; background-image: linear-gradient(180deg, transparent 0, #00000066 40%, #000); position: absolute; - z-index: 999; + z-index: 99; color: #fff; } .w-ba-banner__caption { @@ -357,7 +379,7 @@ ul.button-mid{ .banner-pager { right: 1em; top: -2em; - z-index: 102; + z-index: 100; display: none; } } @@ -400,9 +422,7 @@ ul.button-mid{ .ba-banner-widget-5 { margin: 1em 0; .slide-img { - @media(min-width:769px){ padding: 0; - } } .slide-content { z-index: 200; diff --git a/assets/stylesheets/template/modules/announcement.scss b/assets/stylesheets/template/modules/announcement.scss index 3df9986..4d5d061 100644 --- a/assets/stylesheets/template/modules/announcement.scss +++ b/assets/stylesheets/template/modules/announcement.scss @@ -53,11 +53,17 @@ .w-annc__table{ background-color: #fff; .w-annc__th{ - border-bottom: 0.125em solid #ddd; + // border-bottom: 0.125em solid #ddd; } tr{ @media(max-width: $screen-xs){ - margin-bottom: 10px; + margin-bottom: 10px; + display: flex; + flex-wrap: wrap; + width: 100%; + td{ + width: 100%; + } } } } @@ -294,9 +300,6 @@ .w-annc__list > .w-annc__item:nth-child(3n+1) { clear: both; } - .w-annc__entry-title { - height: 2.5em; - } .w-annc__img-wrap { height: 14.5em; margin:0; @@ -908,7 +911,6 @@ font-family: $main-font; font-weight: bold; } - .w-annc__widget-title { float: left; } .w-annc__more { margin-top: 1.5em; display: none; @@ -2066,6 +2068,9 @@ } //widget 15 .widget-announcement-15 { + .w-annc__entry-title{ + height: 2.5em; + } .cycle-carousel-wrap{ display: flex; align-items: baseline; @@ -2479,7 +2484,6 @@ .i-annc__item { list-style: none; overflow: hidden; - border-bottom: 1px solid #bbb; padding: 1em 0; // box-shadow: #0000004d 0 0 4px; // background: #fff; @@ -2518,7 +2522,7 @@ } } tr{ - border: 0.0625em solid #ddd!important; + // border: 0.0625em solid #ddd!important; } td { font-size: 1rem; @@ -2599,7 +2603,9 @@ table.dataTable.dtr-inline.collapsed>tbody>tr>td:first-child:before, table.dataT table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, table.dataTable.dtr-inline.collapsed>tbody>tr.parent>th:first-child:before { background-color: $theme-gray !important; } - +.i-annc__table{ + border: 0.0625em solid #ddd !important; +} .i-annc__table .child span.dtr-data li { padding: 0 0.5em; } @@ -2756,11 +2762,13 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl clear: both; } - + .i-annc__content-wrap{ + margin: 0.5em; + } .i-annc__img-wrap { overflow: hidden; height: 13.5em; - margin: 1em 0.5em; + margin: 0.5em; img { @media (max-width:767px) { transform: scale(1) !important; @@ -2880,7 +2888,7 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl // Index-13 .index-announcement-13 { thead{ - border-bottom: 0.125em solid #ddd; + } .child{ li{ @@ -2904,7 +2912,7 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl // Index-14 .index-announcement-14 { thead{ - border-bottom: 0.125em solid #ddd; + // border-bottom: 0.125em solid #ddd; } .child{ li{ @@ -2980,8 +2988,12 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl // Index-17 .index-announcement-17 { @media(max-width: $screen-xs){ + .i-annc__table{ + border: 0 !important; + } tr{ margin-bottom: 10px; + border: 0.0625em solid #ddd !important; } th{ width: 100%; @@ -3205,7 +3217,8 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl border-radius: 4px; behavior: url("/assets/ie_support/PIE2/PIE.htc"); -webkit-border-radius: 4px; - -moz-border-radius: 4px + -moz-border-radius: 4px; + z-index: 100; } .VivaTimeline dl dd { @@ -3464,6 +3477,7 @@ table.dataTable.dtr-inline.collapsed>tbody>tr.parent>td:first-child:before, tabl border-radius: 10px; transition: all 0.3s; width: calc( 100%/5 - 1.5em); + margin-bottom: 1em; &:hover{ box-shadow: 2px 2px 7px 2px rgba(0, 0, 0, 0.5); transform: translateY(-5px); diff --git a/assets/stylesheets/template/modules/archives.scss b/assets/stylesheets/template/modules/archives.scss index 8f823f5..501260a 100644 --- a/assets/stylesheets/template/modules/archives.scss +++ b/assets/stylesheets/template/modules/archives.scss @@ -7,6 +7,11 @@ // // Widget // ## gerenral styles +.i-archive__list{ + .date-thead{ + min-width: 4em; + } +} .i-archive{ tr{ border: 0.0625em solid #ddd!important; diff --git a/assets/stylesheets/template/modules/event_news.scss b/assets/stylesheets/template/modules/event_news.scss index 6e02aa0..c30b4c3 100644 --- a/assets/stylesheets/template/modules/event_news.scss +++ b/assets/stylesheets/template/modules/event_news.scss @@ -1,6 +1,12 @@ @charset "utf-8"; @import "../initial"; +[data-list="event_news_links"]{ + padding: 0; + li{ + list-style: none; + } +} .w-annc__list{ clear: both; } @@ -431,7 +437,6 @@ @media(max-width: $screen-xs){ tr{ margin-bottom: 10px; - // border: 0.125em solid #ddd !important; } th{ width: 100%; @@ -586,7 +591,8 @@ .index-eventnews-11 { .i-annc__item{ - width: 100% + width: 100%; + border-bottom: 0.0625em solid #ddd; } .child{ li{ @@ -608,29 +614,19 @@ // Index-12 .index-eventnews-12 { .i-annc__item{ - width: 100% + width: 100%; + border-bottom: 0.0625em solid #ddd; } .child{ li{ list-style: none; } } - @media(max-width: $screen-xs){ - .i-annc__th--date{ - width:50%!important; - } - .i-annc__th--title{ - width:50%!important; - } - } - table tr{ - flex-wrap: unset!important; - } } // Index-13 .index-eventnews-13 { thead{ - border-bottom: 0.125em solid #ddd; + } .child{ li{ @@ -654,7 +650,7 @@ // Index-14 .index-eventnews-14 { thead{ - border-bottom: 0.125em solid #ddd; + } .child{ li{ @@ -747,7 +743,7 @@ @media(max-width: $screen-xs){ tr{ margin-bottom: 10px; - // border: 0.125em solid #ddd !important; + } th{ width: 100%; @@ -781,7 +777,7 @@ @media(max-width: $screen-xs){ tr{ margin-bottom: 10px; - // border: 0.125em solid #ddd !important; + } th{ width: 100%; @@ -1181,4 +1177,32 @@ } .widget-event-news-calendar-2.w-calendar .w-calendar-title{ background:$theme-color-second; -} \ No newline at end of file +} + + + .carousel_images_slide{ + transform: scale(0.8); + width: 10em; + margin: auto!important; + display: flex; + justify-content: center; + } + .carousel_img-wrap{ + width: 25px; + height: 25px; + border-radius: 2em; + overflow: hidden; + -webkit-filter: grayscale(100%); + filter: grayscale(100%); + backdrop-filter: saturate(180%) blur(20px); + img{ + border-radius: 1em; + overflow: hidden; + } + } + .carousel_images_slide{ + margin-top: 1em !important; + } + .carousel_img_item{ + display: block!important; + } diff --git a/assets/stylesheets/template/modules/hashtag.scss b/assets/stylesheets/template/modules/hashtag.scss new file mode 100644 index 0000000..cfdd4c8 --- /dev/null +++ b/assets/stylesheets/template/modules/hashtag.scss @@ -0,0 +1,25 @@ +@charset "utf-8"; + +@import "../initial"; + + + +p.s-annc__post-orbithashtags{ + clear: both; +} +a.orbit-hash-tag { + list-style: none; + background: #e0edff; + color: #0a84ff; + margin-right: 0.5em; + border-radius: 0.5em; + padding: 0.2em 0.5em; + margin-bottom: 0.5em; + display: inline-block; + &:hover{ + background: #0a84ff; + transform: translatey(-2px); + transition: transform 0.4s; + color: #fff; + } +} \ No newline at end of file diff --git a/assets/stylesheets/template/modules/member.scss b/assets/stylesheets/template/modules/member.scss index 25c7f06..4937ab1 100644 --- a/assets/stylesheets/template/modules/member.scss +++ b/assets/stylesheets/template/modules/member.scss @@ -471,6 +471,13 @@ // Show page .show-member { font-family: $sub-font; + .memberul{ + padding: 0; + li{ + margin-bottom: 0.5em; + list-style: none; + } + } th, td { font-size: 0.938em; @@ -526,3 +533,8 @@ .member-data { width: 100%; } } } +.show-member{ + .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ + border: 0; + } +} \ No newline at end of file diff --git a/assets/stylesheets/template/modules/universal-table.scss b/assets/stylesheets/template/modules/universal-table.scss index f648323..0df16c3 100644 --- a/assets/stylesheets/template/modules/universal-table.scss +++ b/assets/stylesheets/template/modules/universal-table.scss @@ -1,6 +1,7 @@ @charset "utf-8"; @import "../initial"; + .universal-table-index tbody{ width:100% ; } @@ -104,6 +105,7 @@ @media(max-width: $screen-xs){ margin-top: 0.5em; right:0; + top:-4em; } .searchbtn2, .universal-btn { line-height: 2em; @@ -166,7 +168,6 @@ display: flex; flex-wrap: wrap; padding: 0; - margin-top: 3em; } .row > div { @@ -329,3 +330,41 @@ } } } +@media (max-width: 768px) { + #hashtag-wordcloud { + width: 800px!important; + height: 500px!important; + } + + /* 讓外層容器可以左右滑動 */ + #hashtag-wordcloud-wrapper { + overflow-x: auto; + width: 100%; + } +} +#hashtag-wordcloud{ + margin-top: 1.5em; + position: relative; + margin:1.5em auto; + width: 80%; + height:400px; + overflow: hidden; + a{ + border-radius: 0.5em; + padding: 0.2em; + &:hover{ + -webkit-transform: translateY(-6px); + -ms-transform: translateY(-6px); + transform: translateY(-6px); + box-shadow: 0 12px 24px #0000004d, 0 10px 10px #00000033; + -webkit-box-shadow: 0 12px 24px #0000004d, 0 10px 10px #00000033; + -webkit-transition: all .3s ease; + -moz-transition: all .3s ease; + -ms-transition: all .3s ease; + -o-transition: all .3s ease; + transition: all .3s ease; + filter: brightness(0.4) saturate(1.3); + transform: scale(1.1); + } + } +} \ No newline at end of file diff --git a/assets/stylesheets/template/modules/video.scss b/assets/stylesheets/template/modules/video.scss index b697e7c..dcf46e8 100644 --- a/assets/stylesheets/template/modules/video.scss +++ b/assets/stylesheets/template/modules/video.scss @@ -963,4 +963,7 @@ background-color: #1515154d; } } -} \ No newline at end of file +} +// .wordcloud-link{ +// font-size: 1.2em; +// } \ No newline at end of file diff --git a/assets/stylesheets/template/template.scss b/assets/stylesheets/template/template.scss index 41588f6..c2ac8f8 100644 --- a/assets/stylesheets/template/template.scss +++ b/assets/stylesheets/template/template.scss @@ -118,6 +118,7 @@ ul.tab_nav { flex-wrap: wrap; justify-content: center; font-family: $main-font; + width: 100%; li { list-style: none; diff --git a/assets/stylesheets/template/widget/sitemenu.scss b/assets/stylesheets/template/widget/sitemenu.scss index d0325c2..bfb9f68 100644 --- a/assets/stylesheets/template/widget/sitemenu.scss +++ b/assets/stylesheets/template/widget/sitemenu.scss @@ -5,10 +5,15 @@ z-index: 1; position: relative; } +.sitemenu-title{ + @extend .unity-title; +} .sitemenu-wrap{ // padding-right: 0.9375em!important; // padding-left: 0.9375em!important; margin-bottom: 1em; + z-index: 1; + position: relative; } .sitemenu-item{ list-style: none; diff --git a/home/page.html.erb b/home/page.html.erb index 7b3c941..2aa153f 100644 --- a/home/page.html.erb +++ b/home/page.html.erb @@ -19,7 +19,7 @@
    diff --git a/modules/announcement/_annc_widget15.html.erb b/modules/announcement/_annc_widget15.html.erb index b0b0939..8135e52 100644 --- a/modules/announcement/_annc_widget15.html.erb +++ b/modules/announcement/_annc_widget15.html.erb @@ -53,7 +53,7 @@
  • - +