AparnaVelvet commited on
Commit
9133f0d
·
verified ·
1 Parent(s): a03196e

Pink UI + Load Last 30 Titles

Browse files
Files changed (1) hide show
  1. index.html +48 -20
index.html CHANGED
@@ -3,24 +3,25 @@
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width,initial-scale=1" />
6
- <title>Aparna Video Queue Helper</title>
7
  <style>
8
- body { font-family: system-ui, sans-serif; max-width: 740px; margin: 24px auto; padding: 0 16px; background: #0f1117; color: #f1f5f9; }
9
- label { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
10
- input, textarea { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 10px; border-radius: 8px; border: 1px solid #334155; background: #1e293b; color: #f8fafc; font-size: 14px; }
 
11
  .radios { display: flex; gap: 18px; margin-top: 8px; }
12
  .radios label { display: flex; align-items: center; gap: 6px; margin-top: 0; font-weight: 500; cursor: pointer; }
13
- .radios input { width: auto; margin: 0; }
14
- .url-row { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
15
- .url-row input { margin-top: 0; flex: 1; }
16
- .btn-sec { padding: 10px 14px; border: 1px solid #475569; border-radius: 8px; background: #334155; color: #f8fafc; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
17
- .btn-pri { margin-top: 18px; width: 100%; padding: 12px; border: 0; border-radius: 8px; background: #e11d48; color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
18
  button:disabled { opacity: 0.6; cursor: wait; }
19
- #status { margin-top: 14px; padding: 12px; border-radius: 8px; background: #1e293b; border: 1px solid #334155; white-space: pre-wrap; font-family: monospace; }
20
  </style>
21
  </head>
22
  <body>
23
- <h2>Aparna Nurse Psalms — Queue Helper</h2>
24
 
25
  <label>Video Type</label>
26
  <div class="radios">
@@ -28,14 +29,18 @@
28
  <label><input type="radio" name="video_type" value="longform" /> longform</label>
29
  </div>
30
 
31
- <label for="access_key">Access Key</label>
32
- <input id="access_key" type="text" placeholder="Enter your HF write token (hf_...)" />
 
 
 
 
33
 
34
  <label for="video_title">Video Title</label>
35
  <input id="video_title" type="text" placeholder="Enter catchy clickable YouTube title..." />
36
 
37
  <label for="audio_url">Audio URL</label>
38
- <div class="url-row">
39
  <input id="audio_url" type="url" placeholder="https://..." />
40
  <button id="paste_btn" class="btn-sec" type="button">Paste from Clipboard</button>
41
  </div>
@@ -52,9 +57,11 @@
52
  <div id="status">Ready.</div>
53
 
54
  <script type="module">
55
- import { uploadFile } from "https://cdn.jsdelivr.net/npm/@huggingface/hub/+esm";
56
 
57
  const keyEl = document.getElementById("access_key");
 
 
58
  const titleEl = document.getElementById("video_title");
59
  const urlEl = document.getElementById("audio_url");
60
  const pasteBtn = document.getElementById("paste_btn");
@@ -65,16 +72,37 @@
65
  const stEl = document.getElementById("status");
66
  const savedFingerprints = new Set();
67
 
68
- const savedKey = localStorage.getItem("aparna_hf_key") || "";
69
  if (savedKey) keyEl.value = savedKey;
70
 
 
 
 
71
  function toggleThumb() {
72
- const vt = document.querySelector('input[name="video_type"]:checked')?.value || "shorts";
73
- thumbWrap.style.display = vt === "longform" ? "block" : "none";
74
  }
75
  document.querySelectorAll('input[name="video_type"]').forEach(r => r.addEventListener("change", toggleThumb));
76
  toggleThumb();
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  pasteBtn.addEventListener("click", async () => {
79
  try {
80
  const txt = (await navigator.clipboard.readText() || "").trim();
@@ -89,7 +117,7 @@
89
 
90
  btnEl.addEventListener("click", async () => {
91
  const token = keyEl.value.trim();
92
- const vtype = document.querySelector('input[name="video_type"]:checked')?.value || "shorts";
93
  const title = titleEl.value.replace(/[\r\n]+/g, " ").trim();
94
  const url = urlEl.value.trim();
95
  const thumbPrompt = vtype === "longform" ? thumbEl.value.replace(/[\r\n]+/g, " ").trim() : "";
@@ -113,7 +141,7 @@
113
  return;
114
  }
115
 
116
- localStorage.setItem("aparna_hf_key", token);
117
  btnEl.disabled = true;
118
  stEl.textContent = "Saving...";
119
 
 
3
  <head>
4
  <meta charset="utf-8" />
5
  <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ <title>Aparna Nurse Psalms — Queue</title>
7
  <style>
8
+ body { font-family: system-ui, sans-serif; max-width: 740px; margin: 24px auto; padding: 0 16px; background: #160c14; color: #fdf2f8; }
9
+ h2 { color: #f472b6; }
10
+ label { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; color: #fbcfe8; }
11
+ input, textarea { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 10px; border-radius: 8px; border: 1px solid #831843; background: #281322; color: #fdf2f8; font-size: 14px; }
12
  .radios { display: flex; gap: 18px; margin-top: 8px; }
13
  .radios label { display: flex; align-items: center; gap: 6px; margin-top: 0; font-weight: 500; cursor: pointer; }
14
+ .radios input { width: auto; margin: 0; accent-color: #ec4899; }
15
+ .row { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
16
+ .row input { margin-top: 0; flex: 1; }
17
+ .btn-sec { padding: 10px 14px; border: 1px solid #9d174d; border-radius: 8px; background: #500724; color: #fbcfe8; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
18
+ .btn-pri { margin-top: 18px; width: 100%; padding: 12px; border: 0; border-radius: 8px; background: #ec4899; color: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
19
  button:disabled { opacity: 0.6; cursor: wait; }
20
+ #titles_box, #status { margin-top: 10px; padding: 12px; border-radius: 8px; background: #281322; border: 1px solid #831843; white-space: pre-wrap; font-family: monospace; font-size: 13px; max-height: 220px; overflow-y: auto; }
21
  </style>
22
  </head>
23
  <body>
24
+ <h2>🩷 Aparna Nurse Psalms — Queue Helper</h2>
25
 
26
  <label>Video Type</label>
27
  <div class="radios">
 
29
  <label><input type="radio" name="video_type" value="longform" /> longform</label>
30
  </div>
31
 
32
+ <label for="access_key">Access Key (Fine-Grained Token)</label>
33
+ <div class="row">
34
+ <input id="access_key" type="password" placeholder="Paste fine-grained token (hf_...)" />
35
+ <button id="load_titles_btn" class="btn-sec" type="button">Load Last 30 Titles</button>
36
+ </div>
37
+ <div id="titles_box">(Click "Load Last 30 Titles" above to view past titles)</div>
38
 
39
  <label for="video_title">Video Title</label>
40
  <input id="video_title" type="text" placeholder="Enter catchy clickable YouTube title..." />
41
 
42
  <label for="audio_url">Audio URL</label>
43
+ <div class="row">
44
  <input id="audio_url" type="url" placeholder="https://..." />
45
  <button id="paste_btn" class="btn-sec" type="button">Paste from Clipboard</button>
46
  </div>
 
57
  <div id="status">Ready.</div>
58
 
59
  <script type="module">
60
+ import { downloadFile, uploadFile } from "https://cdn.jsdelivr.net/npm/@huggingface/hub/+esm";
61
 
62
  const keyEl = document.getElementById("access_key");
63
+ const loadBtn = document.getElementById("load_titles_btn");
64
+ const titlesBox = document.getElementById("titles_box");
65
  const titleEl = document.getElementById("video_title");
66
  const urlEl = document.getElementById("audio_url");
67
  const pasteBtn = document.getElementById("paste_btn");
 
72
  const stEl = document.getElementById("status");
73
  const savedFingerprints = new Set();
74
 
75
+ const savedKey = localStorage.getItem("aparna_fg_key") || "";
76
  if (savedKey) keyEl.value = savedKey;
77
 
78
+ function getVt() {
79
+ return document.querySelector('input[name="video_type"]:checked')?.value || "shorts";
80
+ }
81
  function toggleThumb() {
82
+ thumbWrap.style.display = getVt() === "longform" ? "block" : "none";
 
83
  }
84
  document.querySelectorAll('input[name="video_type"]').forEach(r => r.addEventListener("change", toggleThumb));
85
  toggleThumb();
86
 
87
+ loadBtn.addEventListener("click", async () => {
88
+ const token = keyEl.value.trim();
89
+ if (!token) { titlesBox.textContent = "ERROR: Enter Access Key first."; return; }
90
+ localStorage.setItem("aparna_fg_key", token);
91
+ const histPath = getVt() === "longform" ? "history/longform_titles.txt" : "history/shorts_titles.txt";
92
+ titlesBox.textContent = "Loading...";
93
+ try {
94
+ const res = await downloadFile({
95
+ repo: { type: "dataset", name: "AparnaVelvet/Storage" },
96
+ path: histPath,
97
+ accessToken: token,
98
+ });
99
+ const txt = res ? (await res.text()).trim() : "";
100
+ titlesBox.textContent = txt || "(0 titles so far — first run!)";
101
+ } catch (err) {
102
+ titlesBox.textContent = "ERROR loading titles: " + (err?.message || err);
103
+ }
104
+ });
105
+
106
  pasteBtn.addEventListener("click", async () => {
107
  try {
108
  const txt = (await navigator.clipboard.readText() || "").trim();
 
117
 
118
  btnEl.addEventListener("click", async () => {
119
  const token = keyEl.value.trim();
120
+ const vtype = getVt();
121
  const title = titleEl.value.replace(/[\r\n]+/g, " ").trim();
122
  const url = urlEl.value.trim();
123
  const thumbPrompt = vtype === "longform" ? thumbEl.value.replace(/[\r\n]+/g, " ").trim() : "";
 
141
  return;
142
  }
143
 
144
+ localStorage.setItem("aparna_fg_key", token);
145
  btnEl.disabled = true;
146
  stEl.textContent = "Saving...";
147