From 526f18d01b8253f1d3a10187d21d4fd9436df842 Mon Sep 17 00:00:00 2001 From: ken Date: Thu, 25 Jun 2026 14:13:15 +0800 Subject: [PATCH] js --- assets/javascripts/app.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/assets/javascripts/app.js b/assets/javascripts/app.js index 4a61d30..c4ba891 100644 --- a/assets/javascripts/app.js +++ b/assets/javascripts/app.js @@ -2922,6 +2922,34 @@ $(function() { $('#goog-gt-votingInputTrgText').attr('title', '翻譯文字'); $('#goog-gt-votingInputVote').attr('title', '評分'); }, 1000); +}); +function removeHiddenContentLinks() { + $('a').each(function () { + var $link = $(this); + + // 取得連結內所有子元素 + var $children = $link.children(); + + // 若連結本身是 display:none,直接移除 + if ($link.css('display') === 'none') { + $link.remove(); + return; + } + + // 若連結內有子元素,且全部都是 display:none + if ($children.length > 0) { + var allHidden = $children.toArray().every(function (child) { + return $(child).css('display') === 'none'; + }); + if (allHidden) { + $link.remove(); + } + } + }); +} + +$(document).ready(function () { + setTimeout(removeHiddenContentLinks, 500); }); // 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105 // $(window).load(function() {