Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
63 lines (53 loc) · 1.6 KB
/
Copy pathscript.js
File metadata and controls
63 lines (53 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// ================================
// WALLET CONNECT
// ================================
async function connectWallet() {
if (!window.ethereum) {
alert("❌ MetaMask not found");
return;
}
try {
const accounts = await ethereum.request({
method: "eth_requestAccounts",
});
document.getElementById("walletStatus").innerText =
"✅ Connected: " + accounts[0];
localStorage.setItem("walletAddress", accounts[0]);
} catch (err) {
console.error(err);
alert("Wallet connection failed");
}
}
// ================================
// VERIFY SKILL → REDIRECT TO TEST
// ================================
function verifySkillOnChain() {
const skill = document.getElementById("skillInput").value.trim();
const desc = document.getElementById("skillDesc").value.trim();
if (!skill || !desc) {
alert("❌ Please fill all fields");
return;
}
// Save pending skill (used by test.js)
localStorage.setItem("pendingSkill", skill);
localStorage.setItem("pendingDesc", desc);
console.log("Pending Skill Saved:", skill);
// Redirect to AI test page
window.location.href = "test.html";
}
// ================================
// RESUME PAGE
// ================================
function goToResume() {
window.location.href = "dashboard.html";
}
// ================================
// AUTO LOAD WALLET STATUS
// ================================
window.addEventListener("load", () => {
const addr = localStorage.getItem("walletAddress");
if (addr) {
const el = document.getElementById("walletStatus");
if (el) el.innerText = "✅ Connected: " + addr;
}
});