From cee1d9356c5ffb01edf9e8af1cfc59b7eb44b300 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 00:54:45 +0800 Subject: [PATCH 01/19] Update home.md --- docs/home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/home.md b/docs/home.md index 015a9105da3..da5d10877df 100644 --- a/docs/home.md +++ b/docs/home.md @@ -1,5 +1,5 @@ --- -icon: creative +icon: creative fix title: JavaGuide(Java学习&面试指南) --- From ce7035cda6315e643660becc986581468f1effce Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 00:58:19 +0800 Subject: [PATCH 02/19] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000000..7e16d266789 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +doc.liuyq.co \ No newline at end of file From e9512225104e1c2c38ddc3d5f2c36e850732c76b Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 00:58:47 +0800 Subject: [PATCH 03/19] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000000..7e16d266789 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +doc.liuyq.co \ No newline at end of file From fad139371130b9dbc00d78653dd965518750d43d Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 01:19:20 +0800 Subject: [PATCH 04/19] Delete CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 7e16d266789..00000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -doc.liuyq.co \ No newline at end of file From c75bb4e4f088204fef86ed26853d7fd54a350ab0 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 01:23:58 +0800 Subject: [PATCH 05/19] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000000..7e16d266789 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +doc.liuyq.co \ No newline at end of file From 562a2436620b558cbdd99d8dccdc6078d0b5432e Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 01:25:27 +0800 Subject: [PATCH 06/19] Update index.html --- index.html | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 95ccb1581bd..6a12b3743b1 100755 --- a/index.html +++ b/index.html @@ -15,7 +15,8 @@

JavaGuide

AltStyle によって変換されたページ (->オリジナル) /

+ + + + + From 1f3242b12c70c19eed88e0e35edbebcd38002a99 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 01:44:07 +0800 Subject: [PATCH 10/19] Update index.html --- index.html | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index a7231c935e5..a5254fff84d 100755 --- a/index.html +++ b/index.html @@ -13,32 +13,24 @@ - - - - + From 8a0370aa30170bc53c2a6eb89de83b94fd98c2c7 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 01:47:06 +0800 Subject: [PATCH 11/19] Update index.html --- index.html | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index a5254fff84d..1965d7f2179 100755 --- a/index.html +++ b/index.html @@ -8,29 +8,30 @@ -
正在加载 Docsify...
+
页面正在努力加载中...
- - From 1bcb025b031572d20ecb1eb3b9c2d5992ffac9bb Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 16:36:41 +0800 Subject: [PATCH 12/19] Update index.html --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 1965d7f2179..3aebca205d0 100755 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Docsify 最小化测试 - +
页面正在努力加载中...
@@ -32,6 +32,6 @@ console.log('[MINIMAL TEST A] window.$docsify 对象已定义完毕:', window.$docsify); - + From 34c98e612f562a2cdc3b6a2ffa802ddd48522c59 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 16:48:40 +0800 Subject: [PATCH 13/19] Update index.html --- index.html | 177 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 147 insertions(+), 30 deletions(-) diff --git a/index.html b/index.html index 3aebca205d0..2e9ae02baae 100755 --- a/index.html +++ b/index.html @@ -1,37 +1,154 @@ - - - - Docsify 最小化测试 + + + + JavaGuide - - - - -
页面正在努力加载中...
+ + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + From bff3e58f7cd69b715eec4991f3c0f5dcec32baeb Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 16:53:19 +0800 Subject: [PATCH 14/19] Update index.html --- index.html | 147 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 113 insertions(+), 34 deletions(-) diff --git a/index.html b/index.html index 2e9ae02baae..0de2fe84f15 100755 --- a/index.html +++ b/index.html @@ -11,6 +11,46 @@ /> + + @@ -68,57 +108,96 @@ // =========== Plugins Configuration =========== plugins: [ - // Existing EditOnGithubPlugin + // 1. Existing EditOnGithubPlugin EditOnGithubPlugin.create( "https://github.com/Snailclimb/JavaGuide/blob/master/" ), - // --- Plugin for Image Hotlink Protection (from previous request) --- + // 3. New Plugin to Add referrerpolicy="no-referrer" and Implement Collapsible Sidebar function (hook) { - const targetOrigin = 'https://oss.javaguide.cn/'; - const antiHotlinkParamKeyVal = 'x-oss-process=style/javaguide'; // <-- Adjust this parameter as needed - + // This part adds referrerpolicy="no-referrer" to all img tags hook.afterEach(function (html, next) { - const imgRegex = new RegExp(`]*src="(https?:\\/\\/oss\\.javaguide\\.cn\\/[^"]*)"[^>]*>`, 'gi'); - - let modifiedHtml = html.replace(imgRegex, function(match, srcUrl) { - if (srcUrl.includes(antiHotlinkParamKeyVal)) { + const imgTagRegex = /]*>/gi; + let modifiedHtml = html.replace(imgTagRegex, function(match) { + if (match.toLowerCase().includes('referrerpolicy=')) { return match; } - const separator = srcUrl.includes('?') ? '&' : '?'; - const newSrcUrl = srcUrl + separator + antiHotlinkParamKeyVal; - return match.replace(srcUrl, newSrcUrl); + return match.replace(/>$/, ' referrerpolicy="no-referrer">'); }); - // Note: This plugin now adds referrerpolicy as well. You could combine - // the logic here, or keep it separate in the next plugin. - // Keeping it separate for clarity in demonstrating the new requirement. - next(modifiedHtml); }); - }, - // --- End Plugin for Image Hotlink Protection --- - - // --- New Plugin to Add referrerpolicy="no-referrer" to ALL Images --- - function (hook) { - hook.afterEach(function (html, next) { - // Regex to find all img tags globally and case-insensitively - const imgTagRegex = /]*>/gi; - let modifiedHtml = html.replace(imgTagRegex, function(match) { - // Check if referrerpolicy attribute is already present (case-insensitive) - if (match.toLowerCase().includes('referrerpolicy=')) { - return match; // Attribute already exists, return original match + // This part implements the collapsible sidebar logic + // Use doneEach or ready hook to ensure sidebar DOM is available + hook.doneEach(function() { // Or hook.ready(function() { ... }); + const sidebar = document.querySelector('.sidebar'); + if (!sidebar) return; // Exit if sidebar element is not found + + // Find all LIs that contain a direct child UL (these are the parent items with nested menus) + // Use querySelector(':scope> ul') for checking direct children. + // Fallback for older browsers that don't support :scope (though uncommon now) + const allLIs = sidebar.querySelectorAll('.sidebar-nav li'); + const collapsibleItems = []; + allLIs.forEach(li => { + // Check if this LI contains a UL as a direct child + if (li.querySelector(':scope> ul')) { + collapsibleItems.push(li); + } + }); + + // Process each potential collapsible item + collapsibleItems.forEach(li => { + li.classList.add('collapsible'); // Mark it with a class + + // Find the direct link within this collapsible LI + const link = li.querySelector(':scope> a'); // Direct child link + if (link) { + // Add click listener to the link + link.addEventListener('click', function(event) { + // Toggle the 'expanded' class on the parent LI (li is available via closure) + li.classList.toggle('expanded'); + + // --- IMPORTANT --- + // Decide if clicking this link should *also* navigate to the page it links to. + // - If this link represents a *category* title that doesn't have its own page, + // and clicking it should *only* toggle the submenu: + // event.preventDefault(); + // - If this link represents a *page* (e.g., an index page for the category), + // and clicking it should *both* toggle the submenu *and* navigate: + // Remove event.preventDefault(); // (Current state in the code) + // --- End IMPORTANT --- + + // event.preventDefault(); // Uncomment this line if clicking should only toggle collapse + + // Stop event from bubbling up, preventing potential interference + event.stopPropagation(); + }); } - // Add the attribute right before the closing '>' - // This replaces the last '>' with the attribute and '>' - return match.replace(/>$/, ' referrerpolicy="no-referrer">'); + // Note: Adding click listener to the LI itself might be another approach, + // but clicking the link within the LI is usually the intended interaction point. + // Adding it to the link also allows using the link's default behavior if needed. }); - next(modifiedHtml); + // --- Handle initial expansion of the active path --- + // Find the currently active link in the sidebar + const activeLink = sidebar.querySelector('.sidebar-nav .active'); + if (activeLink) { + // Start from the LI containing the active link + let currentElement = activeLink.parentElement; + // Traverse up the DOM tree towards the sidebar root + while (currentElement && currentElement !== sidebar) { + // If the current element is an LI AND it has the 'collapsible' class + if (currentElement.tagName === 'LI' && currentElement.classList.contains('collapsible')) { + currentElement.classList.add('expanded'); // Expand this parent collapsible LI + } + // Move up to the next parent element + currentElement = currentElement.parentElement; + } + } + // --- End initial expansion logic --- }); } - // --- End New Plugin --- - + // --- End Collapsible Sidebar Plugin --- ], // =========================================== }; From 7252fae00a578656e8811ec59fac5c01d0e52a94 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 16:57:34 +0800 Subject: [PATCH 15/19] Update index.html --- index.html | 155 +++++++++++++++++++++++------------------------------ 1 file changed, 67 insertions(+), 88 deletions(-) diff --git a/index.html b/index.html index 0de2fe84f15..10e18c22950 100755 --- a/index.html +++ b/index.html @@ -11,44 +11,37 @@ /> - + @@ -63,7 +56,7 @@ - + - + - - + - - - - - - - - - - From 8e0540e53150801785fd2922809bfc0f826b3588 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 17:04:56 +0800 Subject: [PATCH 16/19] Update index.html --- index.html | 169 +++++++++-------------------------------------------- 1 file changed, 28 insertions(+), 141 deletions(-) diff --git a/index.html b/index.html index 10e18c22950..d418b76f8f7 100755 --- a/index.html +++ b/index.html @@ -11,52 +11,13 @@ /> - - - + - + - + - + + + + --> + + + + - - From 2e0c4bca0db7bddac555e578a3ea9ee0016d7154 Mon Sep 17 00:00:00 2001 From: shnulaa Date: 2025年5月12日 17:08:31 +0800 Subject: [PATCH 17/19] Update README.md --- README.md | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/README.md b/README.md index c86501d0598..e55b152d5f8 100755 --- a/README.md +++ b/README.md @@ -1,27 +1,3 @@ -推荐你通过在线阅读网站进行阅读,体验更好,速度更快!地址:[javaguide.cn](https://javaguide.cn/)。 - -[](https://javaguide.cn/about-the-author/zhishixingqiu-two-years.html) - -
- -[![logo](https://oss.javaguide.cn/github/javaguide/csdn/1c00413c65d1995993bf2b0daf7b4f03.png)](https://github.com/Snailclimb/JavaGuide) - -[GitHub](https://github.com/Snailclimb/JavaGuide) | [Gitee](https://gitee.com/SnailClimb/JavaGuide) - -
- -> - **面试专版**:准备 Java 面试的小伙伴可以考虑面试专版:**[《Java 面试指北 》](./docs/zhuanlan/java-mian-shi-zhi-bei.md)** (质量很高,专为面试打造,配合 JavaGuide 食用)。 -> - **知识星球**:专属面试小册/一对一交流/简历修改/专属求职指南,欢迎加入 **[JavaGuide 知识星球](./docs/about-the-author/zhishixingqiu-two-years.md)**(点击链接即可查看星球的详细介绍,一定确定自己真的需要再加入)。 -> - **使用建议** :有水平的面试官都是顺着项目经历挖掘技术问题。一定不要死记硬背技术八股文!详细的学习建议请参考:[JavaGuide 使用建议](./docs/javaguide/use-suggestion.md)。 -> - **求个Star**:如果觉得 JavaGuide 的内容对你有帮助的话,还请点个免费的 Star,这是对我最大的鼓励,感谢各位一起同行,共勉!Github 地址:[https://github.com/Snailclimb/JavaGuide](https://github.com/Snailclimb/JavaGuide) 。 -> - **转载须知**:以下所有文章如非文首说明为转载皆为 JavaGuide 原创,转载请在文首注明出处。如发现恶意抄袭/搬运,会动用法律武器维护自己的权益。让我们一起维护一个良好的技术创作环境! - -
- -
- - - ## 项目相关 - [项目介绍](https://javaguide.cn/javaguide/intro.html) From 38aa70d5307ee188881a057d8798b1bfa70ca4a3 Mon Sep 17 00:00:00 2001 From: shnulaa Date: Wed, 7 Jan 2026 09:16:44 +0800 Subject: [PATCH 18/19] Delete CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 7e16d266789..00000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -doc.liuyq.co \ No newline at end of file From 2438ffe7044d7de51d2cfe32bf459d371f919ad7 Mon Sep 17 00:00:00 2001 From: shnulaa Date: Wed, 7 Jan 2026 09:16:55 +0800 Subject: [PATCH 19/19] Create CNAME --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 00000000000..98297e4155f --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +doc.xxxxl.ink \ No newline at end of file