Skip to content

Commit c2fd80e

Browse files
author
robot
committed
upgrade node
1 parent 419ce41 commit c2fd80e

File tree

5 files changed

+115
-117
lines changed

5 files changed

+115
-117
lines changed

‎src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, Suspense, useEffect } from "react";
1+
import React, { useState, Suspense } from "react";
22
import { Button, Table, Empty, Tabs, Image } from "antd";
33

44
import "highlight.js/styles/github.css";

‎src/codeTemplates/grapth.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = {
1919
2020
\`\`\`
2121
E -- 1 --> B -- 1 --> C -- 1 --> D -- 1 --> F
22-
\ /\
23-
\ ||
22+
\\ /\
23+
\\ ||
2424
-------- 2 ---------> G ------- 1 ------
2525
\`\`\`
2626

‎src/contentScript.js

+110-110
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
// import { Menu, Dropdown, Button } from "antd";
66
// import { DownOutlined, UserOutlined } from "@ant-design/icons";
77
import {
8-
copyToClipboard,
9-
bjwd,
8+
// bjwd,
109
getStorage,
1110
setCloundStorage,
1211
// addStyle,
1312
} from "./utils";
14-
import zenAble from "./zen/zenMode";
13+
// import zenAble from "./zen/zenMode";
1514
import hideFailCases from "./submission/hideFailCases";
1615

1716
// WTF! ant message didn't go well with chrome extension?
@@ -84,115 +83,115 @@ const message = {
8483
// } else
8584

8685
// testcase eg: `bottom = "BCD", allowed = ["BCG", "CDE", "GEA", "FFF"], c = [1,2,3], d = 2`
87-
function normalize(testCase, includeArray = true) {
88-
testCase = testCase.trim().replace(/\n/g, "").replace(" ", "");
89-
90-
// 单一参数
91-
// console.log(testCase);
92-
if (!testCase.includes("=")) {
93-
// 数组直接返回
94-
// eslint-disable-next-line
95-
if (testCase.includes("[") || testCase.includes('"')) {
96-
return testCase;
97-
} else {
98-
// 输入: 3, 2, 0, 0
99-
// 输入: 0.0625
100-
101-
const parts = testCase.split(",");
102-
if (parts.length === 0) return parts.join("");
103-
return parts.join("\n");
104-
}
105-
}
106-
let stack = [];
107-
let i = 0;
108-
while (i < testCase.length) {
109-
while (i < testCase.length && testCase[i] !== "=") {
110-
i += 1;
111-
}
112-
// skip =
113-
i += 1;
114-
115-
while (i < testCase.length && testCase[i] !== "[" && testCase[i] !== ",") {
116-
stack.push(testCase[i]);
117-
i += 1;
118-
}
119-
if (testCase[i] === ",") {
120-
// skip ,
121-
i += 1;
122-
stack.push("\n");
123-
} else if (includeArray) {
124-
// 解析为数组
125-
// cnt 左括号[ 与 右括号] 个数的差值
126-
let cnt = 0;
127-
while (i < testCase.length) {
128-
stack.push(testCase[i]);
129-
cnt += testCase[i] === "[";
130-
cnt -= testCase[i] === "]";
131-
i += 1;
132-
if (cnt === 0) {
133-
if (i !== testCase.length) {
134-
stack.push("\n");
135-
}
86+
// function normalize(testCase, includeArray = true) {
87+
// testCase = testCase.trim().replace(/\n/g, "").replace("&nbsp;", "");
88+
89+
// // 单一参数
90+
// // console.log(testCase);
91+
// if (!testCase.includes("=")) {
92+
// // 数组直接返回
93+
// // eslint-disable-next-line
94+
// if (testCase.includes("[") || testCase.includes('"')) {
95+
// return testCase;
96+
// } else {
97+
// // 输入: 3, 2, 0, 0
98+
// // 输入: 0.0625
99+
100+
// const parts = testCase.split(",");
101+
// if (parts.length === 0) return parts.join("");
102+
// return parts.join("\n");
103+
// }
104+
// }
105+
// let stack = [];
106+
// let i = 0;
107+
// while (i < testCase.length) {
108+
// while (i < testCase.length && testCase[i] !== "=") {
109+
// i += 1;
110+
// }
111+
// // skip =
112+
// i += 1;
113+
114+
// while (i < testCase.length && testCase[i] !== "[" && testCase[i] !== ",") {
115+
// stack.push(testCase[i]);
116+
// i += 1;
117+
// }
118+
// if (testCase[i] === ",") {
119+
// // skip ,
120+
// i += 1;
121+
// stack.push("\n");
122+
// } else if (includeArray) {
123+
// // 解析为数组
124+
// // cnt 左括号[ 与 右括号] 个数的差值
125+
// let cnt = 0;
126+
// while (i < testCase.length) {
127+
// stack.push(testCase[i]);
128+
// cnt += testCase[i] === "[";
129+
// cnt -= testCase[i] === "]";
130+
// i += 1;
131+
// if (cnt === 0) {
132+
// if (i !== testCase.length) {
133+
// stack.push("\n");
134+
// }
136135

137-
break;
138-
}
139-
}
140-
} else {
141-
while (i < testCase.length) {
142-
stack.push(testCase[i]);
143-
i += 1;
144-
}
145-
}
146-
}
147-
const ans = stack.join("");
148-
if (includeArray && ans[ans.length - 1] !== testCase[testCase.length - 1]) {
149-
return normalize(testCase, false);
150-
}
151-
return stack.join("");
152-
}
136+
// break;
137+
// }
138+
// }
139+
// } else {
140+
// while (i < testCase.length) {
141+
// stack.push(testCase[i]);
142+
// i += 1;
143+
// }
144+
// }
145+
// }
146+
// const ans = stack.join("");
147+
// if (includeArray && ans[ans.length - 1] !== testCase[testCase.length - 1]) {
148+
// return normalize(testCase, false);
149+
// }
150+
// return stack.join("");
151+
// }
153152

154-
function extractTestCase(text, prefix) {
155-
const possiblePrefixs = [
156-
"输出",
157-
"返回",
158-
"Output",
159-
"output",
160-
"Return",
161-
"return",
162-
"",
163-
];
164-
for (let tag of possiblePrefixs) {
165-
const testCase = text.match(new RegExp(`${prefix}(.*)${tag}`, "s"));
166-
if (testCase && testCase.length > 1) {
167-
return testCase;
168-
}
169-
}
170-
return [];
171-
}
153+
// function extractTestCase(text, prefix) {
154+
// const possiblePrefixs = [
155+
// "输出",
156+
// "返回",
157+
// "Output",
158+
// "output",
159+
// "Return",
160+
// "return",
161+
// "",
162+
// ];
163+
// for (let tag of possiblePrefixs) {
164+
// const testCase = text.match(new RegExp(`${prefix}(.*)${tag}`, "s"));
165+
// if (testCase && testCase.length > 1) {
166+
// return testCase;
167+
// }
168+
// }
169+
// return [];
170+
// }
172171

173-
function getProviedTestCases(includeArray = true) {
174-
const possibleTags = ["pre", "p"];
175-
const possiblePrefixs = ["输入:", "输入:", "Input:", "input:"];
176-
const ans = [];
177-
for (let tag of possibleTags) {
178-
const pres = document.querySelectorAll(tag);
179-
180-
for (let prefix of possiblePrefixs) {
181-
for (var i = 0; i < pres.length; ++i) {
182-
if (pres[i].innerText.includes(prefix)) {
183-
const testcase = extractTestCase(pres[i].innerText, prefix);
184-
if (!testcase || testcase.length <= 1) {
185-
bjwd();
186-
return [];
187-
}
188-
ans.push(normalize(testcase[1], includeArray));
189-
}
190-
}
191-
if (ans.length > 0) return ans;
192-
}
193-
}
194-
return ans;
195-
}
172+
// function getProviedTestCases(includeArray = true) {
173+
// const possibleTags = ["pre", "p"];
174+
// const possiblePrefixs = ["输入:", "输入:", "Input:", "input:"];
175+
// const ans = [];
176+
// for (let tag of possibleTags) {
177+
// const pres = document.querySelectorAll(tag);
178+
179+
// for (let prefix of possiblePrefixs) {
180+
// for (var i = 0; i < pres.length; ++i) {
181+
// if (pres[i].innerText.includes(prefix)) {
182+
// const testcase = extractTestCase(pres[i].innerText, prefix);
183+
// if (!testcase || testcase.length <= 1) {
184+
// bjwd();
185+
// return [];
186+
// }
187+
// ans.push(normalize(testcase[1], includeArray));
188+
// }
189+
// }
190+
// if (ans.length > 0) return ans;
191+
// }
192+
// }
193+
// return ans;
194+
// }
196195
// const menu = (
197196
// <Menu onClick={() => handleTestCaseClick(false)}>
198197
// <Menu.Item key="1" icon={<UserOutlined />}>
@@ -499,8 +498,9 @@ function insertButton() {
499498
inserted = true;
500499
} else if (buttons[i].innerText.includes("提交")) {
501500
const click = buttons[i].onclick;
501+
const originalFn = buttons[i]
502502
buttons[i].onclick = (...args) => {
503-
click.call(buttons[i], ...args);
503+
click.call(originalFn, ...args);
504504

505505
// try to hide failed test cases
506506
let tries = 0;

‎src/dataStructureVis/index.jsx

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import calm from "../db/dataStructureVis/calm";
3333
import "./index.css";
3434

3535
const { Option } = Select;
36-
const { Panel } = Collapse;
3736

3837
const InitialData = {
3938
elements: [],
@@ -201,7 +200,6 @@ export default function DataStrutureVis() {
201200
const [dataSource, setDataSource] = useState(initialDataSource);
202201
const [modalVisible, setModalVisible] = useState(false);
203202
const [fullScreenMode, setFullScreenMode] = useState(false);
204-
const [offsetTop] = useState(550);
205203
const [customTypeName, setCustomTypeName] = useState("自定义");
206204

207205
const onResize = () => {

‎src/locales/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import en from "./en";
33
// import { getStorage, setStorage } from "../utils";
44
// const STORAGE_LANG_KEY = "LEETCODE_CHEAT_LANG";
55
const LEETCODE_URL_CN = "https://leetcode.cn";
6-
const LEETCODE_URL_EN = "https://leetcode.com";
6+
// const LEETCODE_URL_EN = "https://leetcode.com";
77
const DEFAULT_LANG = "cn";
88

99
let lang = DEFAULT_LANG;
@@ -44,7 +44,7 @@ export const t = (keypath, slotText) => {
4444
let content = getForPath(langData, keypath);
4545
if (slotText) {
4646
if (Array.isArray(slotText)) {
47-
slotText.map((item, idx) => {
47+
slotText.forEach((item, idx) => {
4848
content = content.replace(`{${idx}}`, item);
4949
})
5050
} else {

0 commit comments

Comments
 (0)