Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 825ca17

Browse files
committed
Move the link position to the bottom of the page
1 parent f790600 commit 825ca17

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

‎ACKNOWLEDGEMENTS.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
A big thanks to the following individuals for contributing:
44

5+
- [@JIEJIAN21](https://github.com/JIEJIAN21) - thanks for logo and icon design
56
- [@TsFreddie](https://github.com/TsFreddie)[contributions](https://github.com/jdneo/vscode-leetcode/commits?author=TsFreddie)
67
- [@ntt2k](https://github.com/ntt2k)[contributions](https://github.com/jdneo/vscode-leetcode/commits?author=ntt2k)
78
- [@purocean](https://github.com/purocean)[contributions](https://github.com/jdneo/vscode-leetcode/commits?author=purocean)
@@ -17,4 +18,5 @@ A big thanks to the following individuals for contributing:
1718
- [@houtianze](https://github.com/houtianze)[contributions](https://github.com/jdneo/vscode-leetcode/commits?author=houtianze)
1819
- [@magic-akari](https://github.com/magic-akari) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=magic-akari)
1920
- [@SF-Zhou](https://github.com/SF-Zhou) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=SF-Zhou)
20-
- [@JIEJIAN21](https://github.com/JIEJIAN21) - thanks for logo and icon design
21+
- [@fuafa](https://github.com/fuafa) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=fuafa)
22+
- [@iFun](https://github.com/iFun) - [contributions](https://github.com/jdneo/vscode-leetcode/commits?author=iFun)

‎src/webview/leetCodePreviewProvider.ts‎

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
7373
const { title, url, category, difficulty, likes, dislikes, body } = this.description;
7474
const head: string = markdownEngine.render(`# [${title}](${url})`);
7575
const info: string = markdownEngine.render([
76-
`| Category | Difficulty | Likes | Dislikes | [Discuss](${url.replace("/description/","/discuss/?currentPage=1&orderBy=most_votes&query=")}) | [Solution](${url.replace("/description/","/solution/")}) |`,
77-
`| :------: | :--------: | :---: | :------: | :-----: | :------: |`,
78-
`| ${category} | ${difficulty} | ${likes} | ${dislikes} | -- | -- |`,
76+
`| Category | Difficulty | Likes | Dislikes |`,
77+
`| :------: | :--------: | :---: | :------: |`,
78+
`| ${category} | ${difficulty} | ${likes} | ${dislikes} |`,
7979
].join("\n"));
8080
const tags: string = [
8181
`<details>`,
@@ -97,6 +97,11 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
9797
),
9898
`</details>`,
9999
].join("\n");
100+
const links: string = markdownEngine.render([
101+
`---`,
102+
`- [Discussion](${this.getDiscussionLink(url)})`,
103+
`- [Solution](${this.getSolutionLink(url)})`,
104+
].join("\n"));
100105
return `
101106
<!DOCTYPE html>
102107
<html>
@@ -114,6 +119,7 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
114119
${tags}
115120
${companies}
116121
${body}
122+
${links}
117123
${!this.sideMode ? button.element : ""}
118124
<script>
119125
const vscode = acquireVsCodeApi();
@@ -172,6 +178,24 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
172178
body: body.join("\n").replace(/<pre>[\r\n]*([^]+?)[\r\n]*<\/pre>/g, "<pre><code>1ドル</code></pre>"),
173179
};
174180
}
181+
182+
private getDiscussionLink(url: string): string {
183+
if (url.includes("leetcode-cn.com")) {
184+
return url.replace("/description/", "/comments/");
185+
} else if (url.includes("leetcode.com")) {
186+
return url.replace("/description/", "/discuss/?currentPage=1&orderBy=most_votes&query=");
187+
}
188+
189+
return "https://leetcode.com";
190+
}
191+
192+
private getSolutionLink(url: string): string {
193+
if (url.includes("leetcode-cn.com") || url.includes("leetcode.com")) {
194+
return url.replace("/description/", "/solution/");
195+
}
196+
197+
return "https://leetcode.com";
198+
}
175199
}
176200

177201
interface IDescription {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /