Skip to content

Commit

Permalink
format and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
xbubbo committed Nov 4, 2024
1 parent 3f9b55b commit a161563
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/lib/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ document.addEventListener("astro:page-load", () => {
document.title = localStorage.getItem("title") ?? "Home";
const icon = localStorage.getItem("icon") ?? "/assets/media/favicons/default.png";
const iconElm = document.getElementById("icon");
if (iconElm) iconElm.href = icon;
if (iconElm) (iconElm as HTMLLinkElement).href = icon;

// Nav
const hamburger = document.getElementById("hamburger");
Expand Down
30 changes: 15 additions & 15 deletions src/lib/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ document.addEventListener("astro:page-load", () => {
});
}

// Bookmark
function addBookmark() {
const CurrentURL = frame?.contentWindow?.location.href;
// Bookmark
function addBookmark() {
const CurrentURL = frame?.contentWindow?.location.href;

const Path = CurrentURL?.split('/').slice(3).join('/').split('/').pop() || "";
const Path = CurrentURL?.split("/").slice(3).join("/").split("/").pop() || "";

const Title = prompt("Enter a Title for this bookmark:", "New Bookmark");
const Title = prompt("Enter a Title for this bookmark:", "New Bookmark");

if (Title) {
const decodedUrl = window.__uv$config.decodeUrl(Path);
const bookmarks = JSON.parse(localStorage.getItem("bookmarks") || "[]");
bookmarks.push({ Title, url: decodedUrl });
localStorage.setItem("bookmarks", JSON.stringify(bookmarks));
console.log("Bookmark added:", { Title, url: decodedUrl });
if (Title) {
const decodedUrl = window.__uv$config.decodeUrl(Path);
const bookmarks = JSON.parse(localStorage.getItem("bookmarks") || "[]");
bookmarks.push({ Title, url: decodedUrl });
localStorage.setItem("bookmarks", JSON.stringify(bookmarks));
console.log("Bookmark added:", { Title, url: decodedUrl });
}
}
if (bookmark) {
bookmark.addEventListener("click", addBookmark);
}
}
if (bookmark) {
bookmark.addEventListener("click", addBookmark);
}
});
13 changes: 4 additions & 9 deletions src/pages/tb.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
import Layout from "@/layouts/Layout.astro";
import { ArrowLeft, ArrowRight, Home, Loader2, Maximize2, Plus, RotateCw, Star } from "lucide-astro";
---

<script src="@/lib/tabs.ts"></script>
<Layout>
<div class="bg-background-secondary h-10 flex items-center border-b border-border px-2">
<div class="flex space-x-2">
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-accent text-text shadow-sm">
Tab 1
</button>
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-interactive text-interactive-secondary hover:bg-accent-secondary">
Tab 2
</button>
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-interactive text-interactive-secondary hover:bg-accent-secondary">
Tab 3
</button>
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-accent text-text shadow-sm"> Tab 1 </button>
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-interactive text-interactive-secondary hover:bg-accent-secondary"> Tab 2 </button>
<button class="flex items-center px-4 py-1.5 rounded-t-lg bg-interactive text-interactive-secondary hover:bg-accent-secondary"> Tab 3 </button>
</div>
<div class="flex-grow"></div>
<button class="p-2 rounded-full bg-interactive hover:bg-accent-secondary">
Expand Down

0 comments on commit a161563

Please sign in to comment.