Skip to content

Commit a93fec1

Browse files
committed
chore(release): bump version to 1.2.1
1 parent 2e66722 commit a93fec1

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.1] - 2026-02-11
9+
10+
### Fixed
11+
- Fixed `mountHost` null check in `positionSidebar` function to prevent sidebar positioning failures on certain page layouts
12+
813
## [1.2.0] - 2026-02-11
914

1015
### Added

content.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
const anchorRect = anchor.getBoundingClientRect();
250250
const anchorHeight = anchor.offsetHeight;
251251
console.log('[GMTOC] anchor:', anchor.tagName, anchor.className.substring(0, 60), 'h:', anchorHeight, 'top:', Math.round(anchorRect.top), 'hostTop:', Math.round(hostRect.top));
252-
// 防御:anchor 尚未完成布局时不写入异常值,等待后续 ResizeObserver 触发修正
252+
// Defense: Don't write invalid values when anchor hasn't finished layout, let ResizeObserver fix it later
253253
if (anchorHeight > 0) {
254254
wrapperEl.style.top = (anchorRect.top - hostRect.top) + 'px';
255255
wrapperEl.style.height = anchorHeight + 'px';
@@ -342,15 +342,15 @@
342342
const stickyHeader = document.querySelector('#repos-sticky-header');
343343
if (stickyHeader) {
344344
resizeObserver.observe(stickyHeader);
345-
// 同时观察 sticky header 的直接子 div,确保高度变化时更新位置
345+
// Also observe sticky header's direct child div to update position when height changes
346346
const stickyDiv = stickyHeader.querySelector(':scope > div');
347347
if (stickyDiv) {
348348
resizeObserver.observe(stickyDiv);
349349
}
350350
}
351351
}
352352

353-
// 观察 #repos-sticky-header 元素出现(GitHub 可能延迟渲染该元素)
353+
// Watch for #repos-sticky-header element appearance (GitHub may render this element lazily)
354354
if (!document.querySelector('#repos-sticky-header')) {
355355
stickyHeaderObserver = new MutationObserver(() => {
356356
const stickyHeader = document.querySelector('#repos-sticky-header');
@@ -498,7 +498,7 @@
498498

499499
chrome.storage.sync.set({ [STORAGE_KEY_COLLAPSED]: settings.collapsed });
500500

501-
// 等待 CSS 布局更新后重新计算位置(收起时宽度从全尺寸变为 32px
501+
// Recalculate position after CSS layout update (width changes from full to 32px when collapsed)
502502
requestAnimationFrame(() => positionSidebar());
503503
}
504504

@@ -694,7 +694,7 @@
694694
/* ------------------------------------------------------------------ */
695695
function update() {
696696
console.log('[GMTOC] update() called');
697-
// 检测 stale DOM 引用:SPA 导航后旧 sidebar 已不在 DOM
697+
// Detect stale DOM reference: old sidebar no longer in DOM after SPA navigation
698698
if (sidebarEl && !sidebarEl.isConnected) {
699699
removeSidebar();
700700
}
@@ -829,7 +829,7 @@
829829
await loadSettings();
830830
update();
831831
setupNavigationListener();
832-
// 兜底:等待浏览器完成首次布局后再次校正 sidebar 位置
832+
// Fallback: Wait for browser to complete initial layout then re-correct sidebar position
833833
requestAnimationFrame(() => {
834834
requestAnimationFrame(() => {
835835
positionSidebar();

manifest.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"manifest_version": 3,
33
"name": "__MSG_extension_name__",
44
"description": "__MSG_extension_description__",
5-
"version": "1.2.0",
5+
"version": "1.2.1",
66
"default_locale": "en",
7-
"permissions": ["storage"],
7+
"permissions": [
8+
"storage"
9+
],
810
"action": {
911
"default_popup": "options.html",
1012
"default_icon": {
@@ -24,9 +26,15 @@
2426
},
2527
"content_scripts": [
2628
{
27-
"matches": ["https://github.com/*"],
28-
"css": ["content.css"],
29-
"js": ["content.js"],
29+
"matches": [
30+
"https://github.com/*"
31+
],
32+
"css": [
33+
"content.css"
34+
],
35+
"js": [
36+
"content.js"
37+
],
3038
"run_at": "document_idle"
3139
}
3240
]

0 commit comments

Comments
 (0)