Skip to content

Commit 60d46a7

Browse files
author
lucifer
committed
fix: 每次调整前都要判断
1 parent b27b870 commit 60d46a7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/contentScript.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,12 @@ function insertButton() {
187187
writeSolutionButton.innerText = "去写题解";
188188
writeSolutionButton.style["margin-right"] = "20px";
189189
writeSolutionButton.style["line-height"] = "32px";
190-
let ele = document.querySelector(`[data-cypress="QuestionTitle"]`);
191190

192191
writeSolutionButton.onclick = () => {
193192
// d: "<a href="/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/">1579. 保证图可完全遍历</a>"
194-
if (!ele) {
195-
ele = document.querySelector(`[data-cypress="QuestionTitle"]`);
196-
}
193+
194+
const ele = document.querySelector(`[data-cypress="QuestionTitle"]`);
195+
197196
if (!ele) {
198197
return message.warn({
199198
content: "获取题目描述失败,请先切换到题目描述标签",

0 commit comments

Comments
 (0)