1288 lines
46 KiB
JavaScript
1288 lines
46 KiB
JavaScript
;(function($, win, undefined) {
|
||
// ECMAScript 5 嚴格模式
|
||
'use strict';
|
||
|
||
//header fixed在上方
|
||
function initdata1() {
|
||
if ( $('.homebanner').length != 0) {
|
||
$('.layout-header').css('height', '');
|
||
var scrollTop = $(window).scrollTop();
|
||
var scrollBottom = $('html').height() - $(window).height() - $('.layout-header').height();
|
||
if (scrollTop>5 && scrollBottom>0) { /* 要滑動到選單的距離 */
|
||
if (parseInt($('.index-layout-content').css('margin-top'))==0){
|
||
}
|
||
$('.outdropdowns').addClass('navFixed'); /* 幫選單加上固定效果 */
|
||
} else {
|
||
if ($('.homebanner').html().trim() == "") {
|
||
$('.outdropdowns').removeClass('navFixed');
|
||
}else{
|
||
$('.outdropdowns').removeClass('navFixed'); /* 移除選單固定效果 */
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
// 初始函數: 把所有的程式碼都包在init裡面,方便在之後的jQuery ready 函數裡一次呼叫
|
||
function init() {
|
||
// 快取一些常用的變數
|
||
var doc = document;
|
||
var lang = doc.documentElement.lang;
|
||
var pageModule = doc.body.getAttribute('data-module');
|
||
var resizeTimer = -1;
|
||
|
||
// 把所有的函數都包在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;
|
||
|
||
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
|
||
// });
|
||
// }
|
||
// },
|
||
|
||
// nav: {
|
||
// 自適應使用的下拉選單
|
||
// setDropdown: function() {
|
||
// var $caret1 = $('<i class="dropdown-toggle-icon level-1 fa fa-chevron-down"></i>');
|
||
// var $caret2 = $('<i class="dropdown-toggle-icon level-2 fa fa-chevron-down"></i>');
|
||
// var $li = null;
|
||
// var $this = null;
|
||
// var cls = 'active';
|
||
// var iconDown = 'fa-chevron-down';
|
||
// var iconUp = 'fa-chevron-up';
|
||
|
||
// // 如果有第二層選單,新增對應的類別到parent元素上
|
||
// $('.nav-level-1')
|
||
// .parent('li')
|
||
// .addClass('has-dropdown level-1');
|
||
|
||
// // 檢查是否已經有dropdown-toggle-icon這個元素,才不會在resize事件中重覆新增
|
||
// if ($('.has-dropdown.level-1 > .dropdown-toggle-icon').length < 1) {
|
||
// $caret1.appendTo('.has-dropdown.level-1');
|
||
|
||
// // 如果有第三層選單,新增對應的類別到parent元素上
|
||
// $('.nav-level-2')
|
||
// .parent('li')
|
||
// .addClass('has-dropdown level-2');
|
||
// $caret2.appendTo('.has-dropdown.level-2');
|
||
// }
|
||
|
||
// // 綁定事件到第二、三層下拉選單的按鈕上
|
||
// $('.dropdown-toggle-icon.level-1, .dropdown-toggle-icon.level-2').on('vclick', function(e) {
|
||
// e.preventDefault();
|
||
// $this = $(this);
|
||
// $li = $this.parent('li');
|
||
|
||
// // 拿掉所有選項除了目前點選的選項的 active class 並把icon換成預設的
|
||
// $li
|
||
// .siblings('li')
|
||
// .removeClass(cls)
|
||
// .find('.' + iconUp)
|
||
// .removeClass(iconUp)
|
||
// .addClass(iconDown);
|
||
|
||
|
||
// // 換掉目前選項的icon
|
||
// $li
|
||
// .find('> i')
|
||
// .removeClass(iconDown)
|
||
// .addClass(iconUp);
|
||
|
||
// // 折疊已打開的選項
|
||
// if ( $li.hasClass(cls) ){
|
||
// $li.removeClass(cls);
|
||
// $this.removeClass(iconUp).addClass(iconDown);
|
||
// }
|
||
// else{
|
||
// $li.addClass(cls)
|
||
// $this.removeClass(iconDown).addClass(iconUp);
|
||
// }
|
||
// });
|
||
// },
|
||
|
||
// 移除行動版下拉選單
|
||
// removeDropdown: function() {
|
||
// var $nav = $('#main-nav');
|
||
|
||
// $nav
|
||
// .find('.dropdown-toggle-icon')
|
||
// .remove();
|
||
// $nav
|
||
// .find('.active')
|
||
// .removeClass('active');
|
||
// }
|
||
// },
|
||
|
||
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裡面
|
||
}
|
||
});
|
||
},
|
||
|
||
},
|
||
|
||
|
||
|
||
// 移除行動版下拉選單
|
||
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 = $('<span class="menu-drop"><i class="dropdown-toggle-icon level-1 fa fa-chevron-down"></i></span>');
|
||
var $caret2 = $('<span class="menu-drop"><i class="dropdown-toggle-icon level-2 fa fa-chevron-down"></i></span>');
|
||
|
||
// 如果有第二層選單,新增對應的類別到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() {
|
||
$('.navbar-toggle').click(function(e){
|
||
e.preventDefault();
|
||
$('.mobile-menu').toggleClass('active');
|
||
$('body').toggleClass('noscroll');
|
||
|
||
$('.mobile-menu .navbar-toggle').removeClass('collapsed');
|
||
// $menu.slideToggle();
|
||
$('.mobile-menu1 > ul').slideUp(500);
|
||
$('.mobile-menu1 > .menu-drop').removeClass('opened');
|
||
$('.mobile-menu2 > ul').slideUp(500);
|
||
$('.mobile-menu2 > .menu-drop').removeClass('opened');
|
||
})
|
||
|
||
$('.mobile-menu1 > .menu-drop').click(function(){
|
||
var $that = $(this);
|
||
var opencheck1 = $that.hasClass('opened');
|
||
if ( opencheck1 == 0 ) {
|
||
$('.mobile-menu1 > ul').not($that.siblings('ul')).slideUp(500);
|
||
$('.mobile-menu1 > .menu-drop').not($that).removeClass('opened');
|
||
$('.mobile-menu2 > ul').slideUp(500);
|
||
$('.mobile-menu2 > .menu-drop').removeClass('opened');
|
||
$that.siblings('ul').slideDown(500);
|
||
$that.addClass('opened');
|
||
|
||
} else if (opencheck1 == 1) {
|
||
$that.siblings('ul').slideUp(500);
|
||
$('.mobile-menu2 > ul').slideUp(500);
|
||
$('.mobile-menu2 > .menu-drop').removeClass('opened');
|
||
$that.removeClass('opened');
|
||
|
||
}
|
||
})
|
||
|
||
$('.mobile-menu2 > .menu-drop').click(function(){
|
||
var $that = $(this);
|
||
var opencheck2 = $that.hasClass('opened');
|
||
if ( opencheck2 == 0 ) {
|
||
$('.mobile-menu2 > ul').not($that.siblings('ul')).slideUp(500);
|
||
$('.mobile-menu2 > .menu-drop').not($that).removeClass('opened');
|
||
$that.siblings('ul').slideDown(500);
|
||
$that.addClass('opened');
|
||
} else if (opencheck2 == 1) {
|
||
$that.siblings('ul').slideUp(500);
|
||
$that.removeClass('opened');
|
||
}
|
||
})
|
||
}
|
||
};
|
||
|
||
// 把orbit物件加到window物件裡面並改名為ORBITFRONT來減少名稱衝突的機會
|
||
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) {
|
||
$('.navbar-toggle').click(function(e){
|
||
e.preventDefault();
|
||
$('.mobile-menu').toggleClass('active');
|
||
$('body').toggleClass('noscroll');
|
||
|
||
$('.mobile-menu .navbar-toggle').removeClass('collapsed');
|
||
// $menu.slideToggle();
|
||
$('.mobile-menu1 > ul').slideUp(500);
|
||
$('.mobile-menu1 > .menu-drop').removeClass('opened');
|
||
$('.mobile-menu2 > ul').slideUp(500);
|
||
$('.mobile-menu2 > .menu-drop').removeClass('opened');
|
||
})
|
||
|
||
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'));
|
||
$('.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() {
|
||
//刪除空的h1
|
||
$('h1').each(function() {
|
||
if ($(this).text().trim() === '') {
|
||
$(this).remove();
|
||
}
|
||
});
|
||
//
|
||
// $('.epaper-index2-container h4 a').each(function() {
|
||
// var $this = $(this);
|
||
// // 取得 a 內部的純文字內容,移除前後空白
|
||
// var textContent = $this.text().trim();
|
||
// // 檢查 a 內部是否所有子元素都是 display: none
|
||
// var hasVisibleContent = $this.children().filter(function() {
|
||
// return $(this).css('display') !== 'none';
|
||
// }).length > 0;
|
||
// // 如果 a 內部沒有純文字,且內部所有元素都是 display: none,則刪除該 a
|
||
// if (textContent === '' || !hasVisibleContent) {
|
||
// $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");
|
||
}
|
||
});
|
||
$("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('<span style="display: none;">下一張</span>');
|
||
$("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', '這是一張圖片');
|
||
}
|
||
});
|
||
$(".w-annc__img-wrap a").each(function () {
|
||
var $this = $(this);
|
||
// 確保 <a> 內沒有文字節點 (避免重複添加)
|
||
if ($this.text().trim() === "") {
|
||
$this.append('<span class="sr-only">公告圖片</span>');
|
||
}
|
||
});
|
||
$(".widget-link__widget-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">公告標題</span>');
|
||
}
|
||
});
|
||
$(".sitemenu-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">次選單</span>');
|
||
}
|
||
});
|
||
$(".annc-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">內頁公告標題</span>');
|
||
}
|
||
});
|
||
$(".event-annc-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">內頁活動公告標題</span>');
|
||
}
|
||
});
|
||
$(".show-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">內頁活動公告標題</span>');
|
||
}
|
||
});
|
||
$(".w-annc__widget-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">公告標題</span>');
|
||
}
|
||
});
|
||
$(".widget-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">網路資源標題</span>');
|
||
}
|
||
});
|
||
$(".widget-title").each(function () {
|
||
if ($(this).text().trim() === "") {
|
||
$(this).append('<span class="sr-only">網路資源標題</span>');
|
||
}
|
||
});
|
||
$('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
|
||
$('a').each(function() {
|
||
var $this = $(this);
|
||
|
||
// 如果 <a> 已經有 aria-label,則跳過
|
||
if ($this.attr('aria-label')) return;
|
||
|
||
var href = $this.attr('href');
|
||
if (!href) return; // 如果沒有 href,則跳過
|
||
|
||
var ariaLabel = "";
|
||
|
||
// 加入開啟方式
|
||
if ($this.attr('target') === '_self') {
|
||
ariaLabel += '在本視窗開啟 ';
|
||
} else if ($this.attr('target') === '_blank') {
|
||
ariaLabel += '在新視窗開啟 ';
|
||
}
|
||
|
||
// 取得 <a> 的文字內容
|
||
var linkText = $this.text().trim();
|
||
if (linkText) {
|
||
ariaLabel += linkText;
|
||
} else if ($this.children('span').length === 1) {
|
||
ariaLabel += $this.children('span').text().trim();
|
||
}
|
||
// 如果包含 <i> 圖示,標示為 icon
|
||
if ($this.find('i').length) {
|
||
ariaLabel = "這是 icon";
|
||
}
|
||
|
||
// 如果是圖片連結,標示為照片
|
||
if ($this.find('img').length) {
|
||
ariaLabel = "這是一張照片";
|
||
}
|
||
|
||
// 設定 aria-label
|
||
if (ariaLabel) {
|
||
$this.attr('aria-label', ariaLabel);
|
||
}
|
||
});
|
||
|
||
// 幫有連結目的之所有a標籤加上title
|
||
$('a').each(function() {
|
||
var $this = $(this);
|
||
var href = $this.attr('href');
|
||
if (!href) return; // 沒有 href 就跳過
|
||
// 如果 <a> 已經有 title 屬性,則不進行修改
|
||
if ($this.attr('title')) return;
|
||
var titlestr = "";
|
||
// 加入開啟方式
|
||
if ($this.attr('target') == '_self') {
|
||
titlestr += '在本視窗開啟 ';
|
||
} else if ($this.attr('target') == '_blank') {
|
||
titlestr += '在新視窗開啟 ';
|
||
}
|
||
// 決定 title 內容
|
||
var linkText = $this.text().trim();
|
||
if (linkText) {
|
||
titlestr += linkText;
|
||
} else if ($this.children('span').length == 1) {
|
||
titlestr += $this.children('span').text().trim();
|
||
}
|
||
// 如果是圖片連結,標示為照片
|
||
if ($this.find('img').length) {
|
||
titlestr = "這是一張照片";
|
||
}
|
||
// 設定 title
|
||
if (titlestr) {
|
||
$this.attr('title', titlestr);
|
||
}
|
||
});
|
||
|
||
// for(var i=0;i<$('a').length;i++){
|
||
// if($('a').eq(i).attr("href") != "" || $('a').eq(i).attr("href") != undefined ){
|
||
// var titlestr="";
|
||
// if($('a').eq(i).attr('target')=='_self')
|
||
// titlestr += '在本視窗開啟 ';
|
||
// else if($('a').eq(i).attr('target') == '_blank')
|
||
// titlestr += '在新視窗開啟 ';
|
||
// if($('a').eq(i).attr('title') == "" || $('a').eq(i).attr('title')==undefined && $('a').eq(i).html().search('</') == -1)
|
||
// titlestr += $('a').eq(i).html().trim();
|
||
// else if($('a').eq(i).attr('title') == "" || $('a').eq(i).attr('title') == undefined && $('a').eq(i).find('>span').length==1)
|
||
// titlestr += $('a').eq(i).find('>span').html().trim();
|
||
// else if($('a').eq(i).attr('title') == "" || $('a').eq(i).attr('title') == undefined){
|
||
// try{
|
||
// if($('a').eq(i).html().trim().split('>').length==2)
|
||
// titlestr += $('a').eq(i).html().trim().split('>')[1].trim();
|
||
// else if($('a').eq(i).html().trim().split('>').length==3)
|
||
// titlestr += $('a').eq(i).html().trim().split('>')[2].trim();
|
||
// }catch(e){};
|
||
// }
|
||
// else
|
||
// titlestr += $('a').eq(i).attr('title');
|
||
// if(titlestr.search('<img') != -1)
|
||
// titlestr = "這是一張照片";
|
||
// if(titlestr != "")
|
||
// $('a').eq(i).attr('title',titlestr);
|
||
// };
|
||
// };
|
||
|
||
// 刪除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('<span class="sr-only">' + titleText + '</span>');
|
||
}
|
||
});
|
||
// 刪除空的檔案室
|
||
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();
|
||
}
|
||
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',
|
||
});
|
||
};
|
||
|
||
//公告頁籤
|
||
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','');
|
||
$('.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');
|
||
});
|
||
|
||
var url = window.location.search;
|
||
if (url == "?editmode=on") {
|
||
$('.tab_content').css({'position': 'relative','display':'block'});
|
||
}
|
||
}
|
||
annc_widget_nav();
|
||
|
||
//切換語言停留在同一頁
|
||
if(window.location.pathname!="/")
|
||
$("#en").attr("href",window.location.pathname.replace("zh_tw","en"))
|
||
|
||
//檔案室 下載檔案 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();
|
||
|
||
// member show tab scroll
|
||
$('.nav-pills').scrollingTabs({
|
||
scrollToTabEdge: true,
|
||
enableSwiping: true,
|
||
leftArrowContent: [
|
||
'<div class="scrtabs-tab-scroll-arrow custom-scroll-arrow"><i class="fa fa-caret-left" aria-hidden="true"></i>',
|
||
'</div>'
|
||
].join(''),
|
||
rightArrowContent: [
|
||
'<div class="scrtabs-tab-scroll-arrow custom-scroll-arrow"><i class="fa fa-caret-right" aria-hidden="true"></i>',
|
||
'</div>'
|
||
].join('')
|
||
});
|
||
|
||
|
||
}
|
||
$(document).ready(function () {
|
||
if ($(".main-content .video_detail").length > 0) {
|
||
$('.sitemenu').css("display","none");
|
||
$('span img[alt="HD"]').parent().hide();
|
||
$('span img[alt="觀看人數"]').remove();
|
||
$(".view_info span").each(function () {
|
||
var text = $(this).text().trim(); // 取得 <span> 裡的文字,去掉前後空格
|
||
var number = text.replace(/\D/g, ""); // 只保留數字部分
|
||
if (number) {
|
||
$(this).text(`・觀看次數:${number}次`); // 更新內容格式
|
||
}
|
||
});
|
||
$(".movie_desc").before('<div class="movietitle"><h4>影片敘述</h4></div>');
|
||
$(".movie_desc").each(function () {
|
||
var decodedHtml = $("<div/>").html($(this).text()).html(); // 轉換轉義的 HTML
|
||
$(this).html(decodedHtml); // 設置為真正的 HTML
|
||
});
|
||
$(".video_group_time").each(function () {
|
||
var $this = $(this); // 當前 .video_group_time
|
||
// 找到對應的 <q>,並移動到 .video_group_time 內部
|
||
var $q = $this.closest(".imglst_desc").find(".movie_desc q");
|
||
if ($q.length) {
|
||
$this.append($q.clone()); // 將 <q> 複製並添加到 .video_group_time
|
||
$q.remove(); // 移除 .movie_desc 裡的 <q>
|
||
}
|
||
// 移動 .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_yt_box").insertBefore(".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("找不到 .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;
|
||
|
||
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);
|
||
});
|
||
// 當文件物件模型(DOM)載入後,執行init函數
|
||
$(document).ready(function() {
|
||
function adjustSlideWidth() {
|
||
var $container = $(".container");
|
||
var $list = $(".w-annc__list");
|
||
var $items = $(".w-annc__item");
|
||
|
||
var containerWidth = $container.width(); // 獲取容器寬度
|
||
var slidesVisible = parseInt($list.attr("data-cycle-carousel-visible")) || 4; // 讀取可見數量 (預設4)
|
||
var itemMargin = parseFloat($items.css("margin-left")) + parseFloat($items.css("margin-right")); // 計算 margin
|
||
|
||
// 計算 w-annc__item 的寬度 (確保總寬度不超過 .container)
|
||
var itemWidth = (containerWidth / slidesVisible) - itemMargin;
|
||
|
||
// 更新 w-annc__item 的寬度
|
||
$items.css({
|
||
"width": itemWidth + "px",
|
||
"box-sizing": "border-box"
|
||
});
|
||
}
|
||
|
||
// 初次載入時調整
|
||
adjustSlideWidth();
|
||
|
||
// 監聽視窗大小變化
|
||
$(window).resize(adjustSlideWidth);
|
||
$(window).on("load", function () {
|
||
var $carouselWrap = $(".cycle-carousel-wrap");
|
||
var $carouselList = $(".w-annc__list");
|
||
|
||
// 取得 data-cycle-carousel-visible 的數值
|
||
var slidesVisible = parseInt($carouselList.attr("data-cycle-carousel-visible")) || 4;
|
||
|
||
// 取得 .w-annc__item 的寬度
|
||
var itemWidth = $(".w-annc__item").outerWidth(true); // 包含 margin
|
||
|
||
// 計算正確的 left 位置,確保第一個 item 不會被切掉
|
||
var newLeft = -(itemWidth * Math.floor(slidesVisible / 2));
|
||
|
||
// 如果 newLeft 是負的,則修正為 0(避免完全消失)
|
||
if (newLeft < 0) newLeft = 0;
|
||
|
||
// 更新 cycle-carousel-wrap 的位置
|
||
$carouselWrap.css("left", newLeft + "px");
|
||
});
|
||
|
||
// 綁定滑動事件
|
||
$(".cycle-slideshow").swipe({
|
||
swipeLeft: function () {
|
||
$(this).cycle("next"); // 向左滑動,切換到下一張
|
||
},
|
||
swipeRight: function () {
|
||
$(this).cycle("prev"); // 向右滑動,切換到上一張
|
||
},
|
||
threshold: 50, // 滑動靈敏度(數值越小越敏感)
|
||
});
|
||
//改變日期格式
|
||
$(".video_group_time").each(function () {
|
||
var $this = $(this);
|
||
var originalText = $this.text().trim(); // 取得原始內容
|
||
// 正則表達式匹配 YYYY-MM-DD 格式的日期
|
||
var formattedText = originalText.replace(/(\d{4})-(\d{2})-(\d{2})/g, function (match, year, month, day) {
|
||
return parseInt(month, 10) + "月" + parseInt(day, 10) + "日";
|
||
});
|
||
$this.text(formattedText); // 更新內容
|
||
});
|
||
|
||
$(".video_group_time").each(function () {
|
||
var $this = $(this); // 當前 .video_group_time
|
||
var $q = $this.closest(".video_data").find(".video_desc q").clone(); // 找到對應的 q
|
||
if ($q.length) {
|
||
$this.append($q); // 只加上對應的 q
|
||
}
|
||
});
|
||
//常用到的js
|
||
// $('.').after($('.'));
|
||
// $('.').before($('.'));
|
||
// $('.').append($('.'));
|
||
// if($('.show-announcement').hasClass('show-announcement')) {
|
||
// $('.').css('', '');
|
||
// }
|
||
$(".mybooking").append('<i class="fa-solid fa-circle-user"></i>');
|
||
//內頁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'));
|
||
};
|
||
//
|
||
$(".ken-click").click(function(){
|
||
$(".searchbox").slideToggle(300);
|
||
$('.ken-click').toggleClass('ken-click2');
|
||
});
|
||
$('.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();
|
||
$(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 $("<h1>", {
|
||
class: this.className,
|
||
html: $(this).html()
|
||
});
|
||
});
|
||
$('#search'). attr('title', '另開新視窗');
|
||
$(window).scroll(function() {
|
||
var windowBottom = $(window).scrollTop() + $(window).innerHeight();
|
||
$('.hide0').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationvisible')
|
||
} else {
|
||
$(this).removeClass('animationvisible')
|
||
}
|
||
})
|
||
$('.hide1').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationvisible1')
|
||
} else {
|
||
$(this).removeClass('animationvisible1')
|
||
}
|
||
})
|
||
$('.hide2').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationvisible2')
|
||
} else {
|
||
$(this).removeClass('animationvisible2')
|
||
}
|
||
})
|
||
$('.hide3').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationvisible3')
|
||
} else {
|
||
$(this).removeClass('animationvisible3')
|
||
}
|
||
})
|
||
$('.rotate0').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationrotate0')
|
||
} else {
|
||
$(this).removeClass('animationrotate0')
|
||
}
|
||
})
|
||
$('.zoomin').each(function() {
|
||
var mid = $(this).offset().top + $(this).height()/2;
|
||
if( mid < windowBottom && mid > $(window).scrollTop()){
|
||
$(this).addClass('animationvisible5')
|
||
} else {
|
||
$(this).removeClass('animationvisible5')
|
||
}
|
||
})
|
||
})
|
||
init();
|
||
});
|
||
|
||
// // //選單
|
||
// $(document).ready(function() {
|
||
//
|
||
// //drop down menu
|
||
// $(".dropdown-toggle").hover(function() {
|
||
// $('.modules-menu-level-1').addClass('display-on');
|
||
// });
|
||
// $(".dropdown-toggle").mouseleave(function() {
|
||
// $('.modules-menu-level-1').removeClass('display-on');
|
||
// });
|
||
//
|
||
// });
|
||
// $(document).ready(function() {
|
||
//
|
||
// "use strict";
|
||
//
|
||
// $(".navbar-collapse > ul > li").hover(function(e) {
|
||
// if ($(window).width() > 943) {
|
||
// $(this).children("ul").stop(true, false).fadeToggle(150);
|
||
// e.preventDefault();
|
||
// }
|
||
// });
|
||
// });// //選單
|
||
|
||
// //選單樣式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');
|
||
});
|
||
|
||
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
||
// $(window).load(function() {
|
||
// if ($('.index-member-3').length && $(window).width() > 992) {
|
||
// ORBITFRONT.member.equalHeight('.i-member-item-inner');
|
||
// }
|
||
// });
|
||
|
||
}(jQuery, window));
|