Skip to content

Commit 12e7dc7

Browse files
Merge pull request #1 from j-harishankar/hari-feature-branch
Hari feature branch
2 parents 28fa772 + 5ed886e commit 12e7dc7

32 files changed

+322
-6
lines changed
File renamed without changes.

manifest.json renamed to extension/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"manifest_version": 3,
33
"name": "LeetCode Helper",
44
"version": "1.0",
5-
"description": "Get AI-powered help while solving LeetCode problems.",
6-
"permissions": [],
5+
"description": "Get AI-powered help while solving LeetCode problems",
6+
"permissions": ["activeTab", "scripting", "tabs"],
7+
"host_permissions": ["https://leetcode.com/*"],
78
"action": {
89
"default_popup": "popup.html",
910
"default_icon": {

popup.html renamed to extension/popup.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
body {
77
font-family: Arial, sans-serif;
88
padding: 10px;
9-
width: 250px;
9+
width: 300px;
1010
}
11+
12+
h3 {
13+
margin-top: 0;
14+
}
15+
1116
#getHelp {
1217
padding: 10px;
1318
background: #4CAF50;
@@ -16,13 +21,24 @@
1621
width: 100%;
1722
border-radius: 5px;
1823
cursor: pointer;
24+
margin-bottom: 10px;
25+
}
26+
27+
ul {
28+
padding-left: 20px;
29+
}
30+
31+
li {
32+
margin-bottom: 5px;
1933
}
2034
</style>
2135
</head>
2236
<body>
2337
<h3>Need Help with LeetCode?</h3>
2438
<button id="getHelp">Get Step-by-Step Help</button>
2539

40+
<ul id="output"></ul> <!-- This is where the guided steps will appear -->
41+
2642
<script src="popup.js"></script>
2743
</body>
2844
</html>

extension/popup.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
console.log("📦 popup.js loaded");
2+
3+
document.getElementById("getHelp").addEventListener("click", async () => {
4+
chrome.tabs.query({ active: true, currentWindow: true }, async (tabs) => {
5+
const tab = tabs[0];
6+
const url = tab.url;
7+
const title = tab.title;
8+
9+
console.log("LeetCode URL:", url);
10+
console.log("Problem Title:", title);
11+
12+
const response = await fetch("http://127.0.0.1:8000/api/solve/", {
13+
method: "POST",
14+
headers: {
15+
"Content-Type": "application/json"
16+
},
17+
body: JSON.stringify({ title, url })
18+
});
19+
20+
const data = await response.json();
21+
console.log("✅ Response from Django:", data);
22+
23+
const output = document.getElementById("output");
24+
output.innerHTML = "";
25+
26+
if (data.steps && Array.isArray(data.steps)) {
27+
data.steps.forEach((step, index) => {
28+
const li = document.createElement("li");
29+
li.textContent = step;
30+
output.appendChild(li);
31+
});
32+
} else {
33+
output.innerHTML = "<p>No steps found.</p>";
34+
}
35+
});
36+
});

leetcode_backend/api/__init__.py

Whitespace-only changes.
148 Bytes
Binary file not shown.
192 Bytes
Binary file not shown.
506 Bytes
Binary file not shown.
189 Bytes
Binary file not shown.
293 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)