Skip to content

Commit

Permalink
feat(auto_source): tweaks/adjustments on ui
Browse files Browse the repository at this point in the history
  • Loading branch information
gildesmarais committed Oct 21, 2024
1 parent 8bfb232 commit d74902b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions public/auto_source.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
.auto_source input,
.auto_source button {
width: 100%;
font-family: monospace;
}

.auto_source > form {
Expand Down Expand Up @@ -51,13 +50,15 @@

.auto_source iframe {
margin-top: 2em;
border: 2px groove var(--highlight);
border: 2px groove transparent;
border-radius: 0.5em;
display: none; /* Hide by default */
transition: border-color 0.2s;
}

.auto_source iframe[src] {
display: block;
min-height: 50em;
max-height: 80vh;
border-color: var(--highlight);
}
15 changes: 7 additions & 8 deletions public/auto_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const autoSource = (function () {
try {
const textToCopy = this.rssUrlField.value;
await navigator.clipboard.writeText(textToCopy);
console.log("Text copied to clipboard:", textToCopy);
} catch (error) {
console.error("Failed to copy text to clipboard:", error);
}
Expand All @@ -211,8 +210,8 @@ const autoSource = (function () {
*/
async subscribeToFeed() {
const feedUrl = this.rssUrlField.value;
const storedUser = LocalStorageFacade.getOrAskUser("username");
const storedPassword = LocalStorageFacade.getOrAskUser("password");
const storedUser = LocalStorageFacade.getOrAsk("username");
const storedPassword = LocalStorageFacade.getOrAsk("password");

const url = new URL(feedUrl);
url.username = storedUser;
Expand Down Expand Up @@ -255,16 +254,16 @@ const autoSource = (function () {
return localStorage.removeItem(key);
}

static getOrAskUser(columnName) {
let value = LocalStorageFacade.get(columnName);
static getOrAsk(key) {
let value = LocalStorageFacade.get(key);

while (typeof value !== "string" || value === "") {
value = window.prompt(`Please enter your ${columnName}:`);
value = window.prompt(`Please enter your ${key}:`);

if (!value || value.trim() === "") {
alert(`Blank ${columnName} submitted. Try again!`);
alert(`Blank ${key} submitted. Try again!`);
} else {
LocalStorageFacade.set(columnName, value);
LocalStorageFacade.set(key, value);
}
}

Expand Down

0 comments on commit d74902b

Please sign in to comment.