Skip to content

Commit 3e594f5

Browse files
author
robot
committed
fix: zen 模式报错
1 parent 7206d34 commit 3e594f5

File tree

4 files changed

+62
-5
lines changed

4 files changed

+62
-5
lines changed

‎src/contentScript.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
// import ReactDOM from "react-dom";
55
// import { Menu, Dropdown, Button } from "antd";
66
// import { DownOutlined, UserOutlined } from "@ant-design/icons";
7-
import { copyToClipboard, bjwd, getStorage, setCloundStorage } from "./utils";
7+
import {
8+
copyToClipboard,
9+
bjwd,
10+
getStorage,
11+
setCloundStorage,
12+
addStyle,
13+
} from "./utils";
814
import zenAble from "./zen/zenMode";
915

1016
// WTF! ant message didn't go well with chrome extension?
@@ -331,6 +337,14 @@ function insertButton() {
331337
let inserted = false;
332338
let retried = 0;
333339
const MAX_TRY = 10;
340+
341+
// 去除智能提示
342+
// addStyle(`
343+
// .monaco-editor .editor-widget {
344+
// display: none !important;
345+
// visibility: hidden !important;
346+
// }
347+
// `);
334348
const timerId = setInterval(() => {
335349
if (inserted) return clearInterval(timerId);
336350
if (retried > MAX_TRY) {

‎src/db/root.db.js

+33-2
Original file line numberDiff line numberDiff line change
@@ -10464,11 +10464,11 @@
1046410464
"code": [
1046510465
{
1046610466
"language": "js",
10467-
"text": "\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar sortArray = function(nums) {\n const counts = Array(50000 * 2 + 1).fill(0);\n const res = [];\n for(const num of nums) counts[50000 + num] += 1;\n for(let i in counts) {\n while(counts[i]--) {\n res.push(i - 50000)\n }\n }\n return res;\n};\n"
10467+
"text": "\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar sortArray = function (nums) {\n const counts = Array(50000 * 2 + 1).fill(0);\n const res = [];\n for (const num of nums) counts[50000 + num] += 1;\n for (let i in counts) {\n while (counts[i]--) {\n res.push(i - 50000);\n }\n }\n return res;\n};\n"
1046810468
},
1046910469
{
1047010470
"language": "js",
10471-
"text": "\nfunction swap(nums, a, b) {\n const temp = nums[a];\n nums[a] = nums[b];\n nums[b] = temp;\n}\n\nfunction helper(nums, start, end) {\n if (start >= end) return;\n const pivotIndex = start + ((end - start) >>> 1)\n const pivot = nums[pivotIndex]\n let i = start;\n let j = end;\n while (i <= j) {\n while (nums[i] < pivot) i++;\n while (nums[j] > pivot) j--;\n if (i <= j) {\n swap(nums, i, j);\n i++;\n j--;\n }\n }\n helper(nums, start, j);\n helper(nums, i, end);\n}\n\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar sortArray = function(nums) {\n helper(nums, 0, nums.length - 1);\n return nums;\n};\n"
10471+
"text": "\nfunction swap(nums, a, b) {\n const temp = nums[a];\n nums[a] = nums[b];\n nums[b] = temp;\n}\n\nfunction helper(nums, start, end) {\n if (start >= end) return;\n const pivotIndex = start + ((end - start) >>> 1);\n const pivot = nums[pivotIndex];\n let i = start;\n let j = end;\n while (i <= j) {\n while (nums[i] < pivot) i++;\n while (nums[j] > pivot) j--;\n if (i <= j) {\n swap(nums, i, j);\n i++;\n j--;\n }\n }\n helper(nums, start, j);\n helper(nums, i, end);\n}\n\n/**\n * @param {number[]} nums\n * @return {number[]}\n */\nvar sortArray = function (nums) {\n helper(nums, 0, nums.length - 1);\n return nums;\n};\n"
1047210472
}
1047310473
]
1047410474
},
@@ -10753,6 +10753,37 @@
1075310753
}
1075410754
]
1075510755
},
10756+
"find-the-town-judge":{
10757+
"id": "997",
10758+
"name": "find-the-town-judge",
10759+
"pre": [
10760+
{
10761+
"text": "图",
10762+
"link": null,
10763+
"color": "green"
10764+
}
10765+
],
10766+
"keyPoints": [
10767+
{
10768+
"text": "将问题抽象为图,问题转为求图的入度和出度",
10769+
"link": null,
10770+
"color": "blue"
10771+
}
10772+
],
10773+
"companies": [],
10774+
"giteeSolution": "https://gitee.com/golong/leetcode/blob/master/problems/997.find-the-town-judge.md",
10775+
"solution": "https://github.com/azl397985856/leetcode/blob/master/problems/997.find-the-town-judge.md",
10776+
"code": [
10777+
{
10778+
"language": "py",
10779+
"text": "\n\nclass Solution:\n def findJudge(self, N, trust):\n in_degree = [0] * (N + 1)\n out_degree = [0] * (N + 1)\n for a, b in trust:\n in_degree[b] += 1\n out_degree[a] += 1\n for i in range(1, N + 1):\n if in_degree[i] == N - 1 and out_degree[i] == 0:\n return i\n return -1\n\n"
10780+
},
10781+
{
10782+
"language": "py",
10783+
"text": "\nclass Solution:\n def findJudge(self, N, trust):\n count = [0] * (N + 1)\n for i, j in trust:\n count[i] -= 1\n count[j] += 1\n for i in range(1, N + 1):\n if count[i] == N - 1:\n return i\n return -1\n"
10784+
}
10785+
]
10786+
},
1075610787
"max-consecutive-ones-iii":{
1075710788
"id": "1004",
1075810789
"name": "max-consecutive-ones-iii",

‎src/utils.js

+12
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,15 @@ export function getColor(text) {
331331
for (const c of text) ans += c.charCodeAt();
332332
return COLORS[ans % COLORS.length];
333333
}
334+
335+
export const addStyle = (css) => {
336+
const style = document.createElement("link");
337+
try {
338+
style.innerHTML = css;
339+
} catch (e) {
340+
console.log(e);
341+
style.styleSheet.cssText = css;
342+
}
343+
const head = document.getElementsByTagName("head")[0];
344+
head.appendChild(style);
345+
};

‎src/zen/zenMode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const leetCodeLogo =
55
"https://static.leetcode-cn.com/cn-mono-assets/production/main/assets/favicon-notification-32x32.3f045777.png";
66

77
function findHeader() {
8-
const tag = document.querySelector("#new-ft");
9-
return tag.parentElement.parentElement;
8+
const tag = document.querySelector("#lc-home");
9+
return tag.children[0].children[0];
1010
}
1111

1212
function findSider() {

0 commit comments

Comments
 (0)