diff --git a/websites/W/WriterDuet/metadata.json b/websites/W/WriterDuet/metadata.json new file mode 100644 index 000000000000..8aa664378fa1 --- /dev/null +++ b/websites/W/WriterDuet/metadata.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.10", + "author": { + "id": "358402930191106049", + "name": "ion606" + }, + "service": "WriterDuet", + "description": { + "en": "Plan, write, and share with the industry-standard software used by over 1 million screenwriters, TV shows, and blockbusters" + }, + "url": [ + "www.writerduet.com", + "writerduet.helpscoutdocs.com" + ], + "matches": [ + "https://*.writerduet.com/*", + "https://*writerduet.helpscoutdocs.com/*" + ], + "version": "1.0.0", + "logo": "https://www.writerduet.com/script/wd-logo-square.png", + "thumbnail": "https://www.writerduet.com/static/media/logo.3fd682b7.png", + "color": "#4598d4", + "category": "other", + "tags": [ + "writer", + "writerduet", + "writerduet" + ] +} \ No newline at end of file diff --git a/websites/W/WriterDuet/presence.ts b/websites/W/WriterDuet/presence.ts new file mode 100644 index 000000000000..1f0374f79d8c --- /dev/null +++ b/websites/W/WriterDuet/presence.ts @@ -0,0 +1,73 @@ +const presence = new Presence({ + clientId: "1234183805380857907", + }), + browsingTimestamp = Math.floor(Date.now() / 1000); + +const enum Assets { + Logo = "https://www.writerduet.com/script/wd-logo-square.png", +} + +const enum Pages { + home = "", + script = "script", + blog = "blog", + help = "category", + pricing = "pricing", + article = "article", +} + +presence.on("UpdateData", async () => { + const presenceData: PresenceData = { + largeImageKey: Assets.Logo, + startTimestamp: browsingTimestamp, + }, + [, page, subpage] = document.location.pathname.split("/"); + + switch (page.split("#")[0]) { + case Pages.script: + { + presenceData.details = document.title; + presenceData.state = document + .querySelector(".Mui-selected") + .querySelector("[data-tip]").textContent; + presence.setActivity(presenceData); + } + break; + + case Pages.home: + { + presenceData.details = "Browsing Home"; + } + break; + + case Pages.help: + case Pages.article: + { + (presenceData.details = "Browsing Help"), + (presenceData.state = + document.querySelector("#categoryHead > h1")?.textContent || + document.querySelector(".title").textContent); + } + break; + + case Pages.pricing: + presenceData.details = "Reviewing Payement Plans"; + break; + + case Pages.blog: + { + if (subpage) { + presenceData.details = "Reading Blog Article"; + presenceData.state = document.querySelector( + ".jupiterx-post-title" + ).textContent; + } else presenceData.details = "Reading the Blog"; + } + break; + + default: + presenceData.details = "Browsing the Site"; + } + + presence.setActivity(presenceData); +});