From 6c4e0407c5ff79fba03731b78e6f4a4ba4b56d4f Mon Sep 17 00:00:00 2001 From: ken Date: Thu, 3 Sep 2026 14:01:52 +0800 Subject: [PATCH] js --- assets/javascripts/app.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 2746536..20be936 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2,6 +2,36 @@ // 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"]'); + + // 移除 color: inherit !important + $target.each(function() { + $(this)[0].style.removeProperty('color'); + }); + + 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); + } + } + } + + handleNavMove(); + + $(window).on('resize', function() { + handleNavMove(); + }); + }); + $(function() { var $target = $('.header-nav [accesskey="U"], .header-nav [accesskey="W"]'); // 移除 color: inherit !important