1
0
mirror of https://github.com/XFox111/TabsAsideExtension.git synced 2026-04-22 07:58:01 +03:00

!feat: major 3.0 release candidate

This commit is contained in:
2025-05-03 23:59:43 +03:00
parent dbc8c7fd4d
commit 39793a38c3
143 changed files with 14277 additions and 0 deletions
@@ -0,0 +1,74 @@
import { CollectionItem, GroupItem, TabItem } from "@/models/CollectionModels";
export default function serializeCollections(collections: CollectionItem[]): string
{
let data: string = "";
for (const collection of collections)
{
data += getCollectionString(collection);
for (const item of collection.items)
{
if (item.type === "group")
{
data += getGroupString(item);
for (const tab of item.items)
data += `\t${getTabString(tab)}`;
}
else if (item.type === "tab")
data += getTabString(item);
}
}
return data;
}
function getCollectionString(collection: CollectionItem): string
{
let data: string = `c${collection.timestamp}`;
if (collection.color)
data += `/${collection.color}`;
if (collection.title)
data += `|${collection.title}`;
data += "\n";
return data;
}
function getGroupString(group: GroupItem): string
{
let data: string = "\tg";
if (group.pinned === true)
data += "/p";
else
{
data += `/${group.color}`;
if (group.title)
data += `|${group.title}`;
}
data += "\n";
return data;
}
function getTabString(tab: TabItem): string
{
let data: string = "\tt";
data += `|${tab.url}|`;
if (tab.title)
data += tab.title;
data += "\n";
return data;
}