Skip to content

Commit

Permalink
v1.0.2支持知乎的夜间模式
Browse files Browse the repository at this point in the history
  • Loading branch information
no13bus authored and no13bus committed Dec 15, 2022
1 parent 08e5947 commit 41dc2f9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/content-script/index.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import Browser from "webextension-polyfill";

async function run(question) {
const theme = document.documentElement.dataset.theme;
let container = document.querySelector("div.chat-gpt-zhihu");
if (container) {
container.remove();
}
container = document.createElement("div");
container.classList.add("chat-gpt-zhihu");
if (theme === "dark") {
container.classList.add("dark");
}

container.className = "chat-gpt-zhihu";
container.innerHTML =
"<div class='chat-gpt-zhihu-header'>Waiting for ChatGPT response...</div>";

Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ChatGPT for zhihu",
"description": "Display ChatGPT response alongside Zhihu Search results",
"version": "1.0.1",
"version": "1.0.2",
"manifest_version": 3,
"icons": {
"16": "logo.png",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.v2.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ChatGPT for Zhihu",
"description": "Display ChatGPT response alongside Zhihu Search results",
"version": "1.0.1",
"version": "1.0.2",
"manifest_version": 2,
"icons": {
"16": "logo.png",
Expand Down
18 changes: 15 additions & 3 deletions src/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
.chat-gpt-zhihu {
background: #fff;
--chat-gpt-zhihu-bg-color: #fff;
--chat-gpt-zhihu-border-color: #f6f6f6;
--chat-gpt-tooptip-color: #fff;
}

.chat-gpt-zhihu.dark {
--chat-gpt-zhihu-bg-color: #121212;
--chat-gpt-zhihu-border-color: #1b1b1b;
--chat-gpt-tooptip-color: #121212;
}

.chat-gpt-zhihu {
background: var(--chat-gpt-zhihu-bg-color);
border-radius: 2px;
-webkit-box-shadow: 0 1px 3px hsl(0deg 0% 7% / 10%);
box-shadow: 0 1px 3px hsl(0deg 0% 7% / 10%);
Expand All @@ -13,7 +25,7 @@
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border-bottom: 1px solid #f6f6f6;
border-bottom: 1px solid var(--chat-gpt-zhihu-border-color);
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: -webkit-box;
Expand Down Expand Up @@ -62,7 +74,7 @@
position: absolute;
width: 120px;
background-color: #555;
color: #fff;
color: var(--chat-gpt-tooptip-color);
text-align: center;
padding: 5px 0;
border-radius: 6px;
Expand Down

0 comments on commit 41dc2f9

Please sign in to comment.