,並移動到 .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 移动到