diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 6dde40a..84fdae8 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -1,66 +1,66 @@ ;(function($, win, undefined) { // ECMAScript 5 嚴格模式 'use strict'; - $(function() { - var $signLanguageBox = $('.orbit-bar-search-sign-language'); - var $headerNav = $('.header-nav'); - var $target = $('.header-nav [accesskey="U"], .header-nav [accesskey="W"]'); + // $(function() { + // var $signLanguageBox = $('.orbit-bar-search-sign-language'); + // var $headerNav = $('.header-nav'); + // var $target = $('.header-nav [accesskey="U"], .header-nav [accesskey="W"]'); - // 移除 color: inherit !important - $target.each(function() { - $(this)[0].style.removeProperty('color'); - }); + // // 移除 color: inherit !important + // $target.each(function() { + // $(this)[0].style.removeProperty('color'); + // }); - function handleNavMove() { - var windowWidth = window.innerWidth; + // function handleNavMove() { + // var windowWidth = window.innerWidth; - if (windowWidth > 768) { - if ($signLanguageBox.length && $signLanguageBox.find('[accesskey="U"], [accesskey="W"]').length === 0) { - $signLanguageBox.prepend($target); - } - } else { - if ($headerNav.length && $headerNav.find('[accesskey="U"], [accesskey="W"]').length === 0) { - $headerNav.append($target); - } - } - } + // if (windowWidth > 768) { + // if ($signLanguageBox.length && $signLanguageBox.find('[accesskey="U"], [accesskey="W"]').length === 0) { + // $signLanguageBox.prepend($target); + // } + // } else { + // if ($headerNav.length && $headerNav.find('[accesskey="U"], [accesskey="W"]').length === 0) { + // $headerNav.append($target); + // } + // } + // } - handleNavMove(); + // handleNavMove(); - $(window).on('resize', function() { - handleNavMove(); - }); - }); - //blockquote移動 - $(function() { - // 1. 定義變數,減少重複選取 DOM 的效能消耗 - var $signLanguageBox = $('.orbit-bar-search-sign-language'); - var $headerNav = $('.header-nav'); - var $target = $('.header-nav blockquote'); + // $(window).on('resize', function() { + // handleNavMove(); + // }); + // }); + // //blockquote移動 + // $(function() { + // // 1. 定義變數,減少重複選取 DOM 的效能消耗 + // var $signLanguageBox = $('.orbit-bar-search-sign-language'); + // var $headerNav = $('.header-nav'); + // var $target = $('.header-nav blockquote'); - function handleNavMove() { - var windowWidth = window.innerWidth; + // function handleNavMove() { + // var windowWidth = window.innerWidth; - if (windowWidth > 768) { - if ($signLanguageBox.length && $signLanguageBox.find('blockquote').length === 0) { - $signLanguageBox.prepend($target); - } - } else { - if ($headerNav.length && $headerNav.find('blockquote').length === 0) { - $headerNav.append($target); // 或者用 .prepend() 取決於你要放的位置 - } - } - } + // if (windowWidth > 768) { + // if ($signLanguageBox.length && $signLanguageBox.find('blockquote').length === 0) { + // $signLanguageBox.prepend($target); + // } + // } else { + // if ($headerNav.length && $headerNav.find('blockquote').length === 0) { + // $headerNav.append($target); // 或者用 .prepend() 取決於你要放的位置 + // } + // } + // } - // 初始執行一次 - handleNavMove(); + // // 初始執行一次 + // handleNavMove(); - // 監聽視窗縮放 - $(window).on('resize', function() { - // 加上防抖 (Debounce) 可以讓效能更好,但若要即時反應可直接執行 - handleNavMove(); - }); - }); + // // 監聽視窗縮放 + // $(window).on('resize', function() { + // // 加上防抖 (Debounce) 可以讓效能更好,但若要即時反應可直接執行 + // handleNavMove(); + // }); + // }); //header fixed在上方 $(function(){ function initdata1(){ @@ -2292,6 +2292,7 @@ $(function() { // if($('.show-announcement').hasClass('show-announcement')) { // $('.').css('', ''); // } + $('.header-nav').append($('[accesskey="W"]')); $(function() { var $headerNav = $('.header-nav'); $headerNav.contents().each(function() { @@ -3098,10 +3099,10 @@ $(document).ready(function() { fixVideoPosterAlt(); }); //網站導覽換icon -// $(document).ready(function() { -// $('a[href="/zh_tw/sitemap"]').html(''); -// $('a[href="/en/sitemap"]').html('') -// }); +$(document).ready(function() { + $('a[href="/zh_tw/sitemap"]').html(''); + $('a[href="/en/sitemap"]').html('') +}); //#tdstylesp表格樣式 $(function () { $('#tdstylesp').each(function () { @@ -3784,6 +3785,33 @@ $(document).ready(function() { } }); +//中英切換紐 class用lang-switch +$(function() { + $('.lang-switch').on('click', function(e) { + e.preventDefault(); + var lang = document.documentElement.lang; + var path = window.location.pathname; + var newUrl; + + if (lang === 'en') { + // 英文 → 中文 + if (path === '/' || path === '') { + newUrl = '/?locale=zh_tw'; + } else { + newUrl = path.replace(/^\/en/, '/zh_tw'); + } + } else { + // 中文 → 英文 + if (path === '/' || path === '') { + newUrl = '/?locale=en'; + } else { + newUrl = path.replace(/^\/zh_tw/, '/en'); + } + } + + window.location.href = newUrl; + }); +}); }(jQuery, window)); diff --git a/assets/stylesheets/template/layout/content.scss b/assets/stylesheets/template/layout/content.scss index 99a8a83..b39dfbf 100644 --- a/assets/stylesheets/template/layout/content.scss +++ b/assets/stylesheets/template/layout/content.scss @@ -67,9 +67,6 @@ .navbar-header{ // float: none!important; } -} -.layout-content-box{ - } .topcontent{ z-index: 3; @@ -102,6 +99,7 @@ } .layout-content { position: relative; + min-height: 70.5em; .container { @extend .response-container; } diff --git a/modules/ad_banner/_ad_banner_widget3.html.erb b/modules/ad_banner/_ad_banner_widget3.html.erb index f195723..790d858 100644 --- a/modules/ad_banner/_ad_banner_widget3.html.erb +++ b/modules/ad_banner/_ad_banner_widget3.html.erb @@ -79,3 +79,17 @@ }); }); + \ No newline at end of file