Skip to content

Commit 62cf20c

Browse files
fix header issue for response with thinking block
fix: update the selectors to only target what we want
2 parents d888e0a + 2055aaa commit 62cf20c

6 files changed

Lines changed: 32 additions & 22 deletions

File tree

extensions/chrome/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "thinking-claude",
3-
"version": "3.1.0",
3+
"version": "3.1.2",
44
"description": "Chrome extension for letting Claude think like a real human",
55
"type": "module",
66
"scripts": {

extensions/chrome/public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Thinking Claude",
4-
"version": "3.1.0",
4+
"version": "3.1.2",
55
"description": "Chrome extension for letting Claude think like a real human",
66
"content_scripts": [
77
{

extensions/chrome/public/styles.css

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Overwrite original claude thinking block content styles */
2-
.code-block__code {
2+
div[data-is-streaming] pre:first-child .code-block__code {
33
background: none !important;
44
white-space: pre-wrap !important;
55
word-wrap: break-word !important;
@@ -20,30 +20,33 @@
2020
/* collapsed states */
2121

2222
/* Collapsed state */
23-
.code-block__code.collapsed {
23+
div[data-is-streaming] pre:first-child .code-block__code.collapsed {
2424
height: 0 !important;
2525
padding: 0 !important;
2626
visibility: hidden !important;
2727
opacity: 0 !important;
2828
}
2929

3030
/* Collapsed state */
31-
[data-thinking-block-state="collapsed"] .code-block__code {
31+
[data-thinking-block-state="collapsed"]
32+
div[data-is-streaming]
33+
pre:first-child
34+
.code-block__code {
3235
height: 0 !important;
3336
padding: 0 !important;
3437
visibility: hidden !important;
3538
opacity: 0 !important;
3639
}
3740

3841
/* Expanded state */
39-
/* [data-thinking-block-state="expanded"] .code-block__code {
42+
/* [data-thinking-block-state="expanded"] div[data-is-streaming] pre:first-child .code-block__code {
4043
height: 50vh !important;
4144
padding: 1em !important;
4245
visibility: visible !important;
4346
opacity: 1 !important;
4447
} */
4548

46-
code {
49+
div[data-is-streaming] pre:first-child code {
4750
background: none !important;
4851
white-space: pre-wrap !important;
4952
word-wrap: break-word !important;
@@ -74,13 +77,13 @@ code span:hover {
7477
/* --------------------------------- */
7578

7679
/* Copy button container */
77-
div[data-is-streaming] .pointer-events-none.sticky {
80+
div[data-is-streaming] pre:first-child .pointer-events-none.sticky {
7881
cursor: pointer !important;
7982
pointer-events: auto !important;
8083
}
8184

8285
/* Copy button container */
83-
div[data-is-streaming] .from-bg-300\\/90 {
86+
div[data-is-streaming] pre:first-child .from-bg-300\\/90 {
8487
pointer-events: auto !important;
8588
user-select: none !important;
8689
}
@@ -89,7 +92,9 @@ div[data-is-streaming] .from-bg-300\\/90 {
8992

9093
/* Update the header text */
9194
/* This is the original header text */
92-
pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty) {
95+
div[data-is-streaming]
96+
pre:first-child
97+
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty) {
9398
font-size: 0; /* Hide original text */
9499
pointer-events: auto !important; /* Make sure it's clickable */
95100
cursor: pointer !important;
@@ -99,17 +104,20 @@ pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty) {
99104
}
100105

101106
/* Update the text of the header */
102-
[data-thinking-block-state="collapsed"]
103-
pre
107+
108+
div[data-thinking-block-state="collapsed"]
109+
pre:first-child
104110
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::after {
105-
content: "Open Claude's thinking";
111+
content: "View Claude's thinking" !important;
106112
font-size: 0.875rem; /* Restore font size */
107113
cursor: pointer;
108114
font-family: var(--font-user-message);
109115
transition: color 0.15s ease-in-out;
110116
}
111117

112-
pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::after {
118+
div[data-is-streaming]
119+
pre:first-child
120+
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::after {
113121
content: "Claude's thinking";
114122
font-size: 0.875rem; /* Restore font size */
115123
cursor: pointer;
@@ -118,16 +126,17 @@ pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::after {
118126
}
119127

120128
/* Hover state */
129+
/* This implementation is limited. We can consider to disable this hover state. */
121130
[data-thinking-block-state="expanded"]
122-
pre
131+
pre:first-child
123132
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty):hover::after {
124133
color: hsl(var(--text-100));
125134
content: "Hide Claude's thinking";
126135
}
127136

128137
/* Streaming state styles */
129138
div[data-is-streaming="true"]
130-
pre
139+
pre:first-child
131140
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::after {
132141
content: "Claude is thinking...";
133142
background: linear-gradient(
@@ -149,7 +158,8 @@ div[data-is-streaming="true"]
149158
}
150159

151160
/* Chevron-down icon */
152-
pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::before {
161+
pre:first-child
162+
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::before {
153163
content: "";
154164
width: 15px;
155165
height: 15px;
@@ -182,7 +192,7 @@ pre .text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::before {
182192
/* Chevron animation */
183193

184194
[data-thinking-block-state="collapsed"]
185-
pre
195+
pre:first-child
186196
.text-text-300.absolute.pl-3.pt-2\.5.text-xs:not(:empty)::before {
187197
transform: rotate(180deg);
188198
}

extensions/chrome/src/content/v3/features/thinking-block/thinking-block-toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { setupControls } from "./setup-controls"
55

66
export function addThinkingBlockToggle() {
77
mutationObserver.initialize()
8-
mutationObserver.subscribe(processThinkingBlocks)
8+
return mutationObserver.subscribe(processThinkingBlocks)
99
}
1010

1111
function processThinkingBlocks() {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const THINKING_BLOCK_CONTROLS_SELECTORS = [
2-
".text-text-300.absolute",
3-
".pointer-events-none.sticky",
2+
"pre:first-child .text-text-300.absolute",
3+
"pre:first-child .pointer-events-none.sticky",
44
].join(", ")

extensions/chrome/test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Version Bumping Test File
2-
v3.1.0
2+
v3.1.1

0 commit comments

Comments
 (0)