diff --git a/websites/T/The Odin Project/dist/metadata.json b/websites/T/The Odin Project/dist/metadata.json new file mode 100644 index 000000000000..0bfdac5fab17 --- /dev/null +++ b/websites/T/The Odin Project/dist/metadata.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.7", + "author": { + "name": "dogukan", + "id": "0420" + }, + "service": "The Odin Project", + "description": { + "en": "The Odin Project is one of those \"What I wish I had when I was learning\" resources. Not everyone has access to a computer science education or the funds to attend an intensive coding school and neither of those is right for everyone anyway. This project is designed to fill in the gap for people who are trying to hack it on their own but still want a high quality education." + }, + "url": "www.theodinproject.com", + "version": "1.0.0", + "logo": "https://i.imgur.com/gtBvHQH.png", + "thumbnail": "https://i.imgur.com/5rm6BZ6.png", + "color": "#e3b261", + "category": "other", + "tags": [ + "top", + "odin", + "project", + "odin-project", + "the-odin-project" + ] +} \ No newline at end of file diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts new file mode 100644 index 000000000000..0dc0ca22d5b0 --- /dev/null +++ b/websites/T/The Odin Project/presence.ts @@ -0,0 +1,58 @@ +const presence = new Presence({ + clientId: "1013489969379152022", + }), + browsingTimestamp = Math.floor(Date.now() / 1000); +presence.on("UpdateData", async () => { + const presenceData: PresenceData = { + largeImageKey: "https://i.imgur.com/gtBvHQH.png", + startTimestamp: browsingTimestamp, + }, + lesson = document.querySelector( + "body > div.page-container.lesson > header > div > div > h1" + ), + course = document.querySelector( + "body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1" + ), + courseTitle = document.querySelector( + "body > div.page-container.lesson > header > div > div > a > h2" + ), + path = document.location.pathname; + switch (path) { + case "/paths": { + presenceData.state = "Viewing all Paths"; + break; + } + case "/paths/full-stack-javascript": { + presenceData.state = "Viewing the Full Stack Javascript Path"; + break; + } + case "/paths/full-stack-ruby-on-rails": { + presenceData.state = "Viewing the Full Stack Ruby Path"; + break; + } + case "/paths/foundations/courses/foundations": { + presenceData.state = "Viewing the Foundations Path"; + break; + } + default: + presenceData.state = "Viewing Dashboard"; + } + + if (path.includes("/paths/full-stack-javascript/courses/")) { + presenceData.details = "Full Stack Javascript - Courses"; + presenceData.state = `${course.textContent}`; + } else if (path.includes("/paths/full-stack-ruby-on-rails/courses/")) { + presenceData.details = "Full Stack Ruby - Courses"; + presenceData.state = `${course.textContent}`; + } else if (path.includes("/foundations-")) { + presenceData.state = `${lesson.textContent}`; + presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"; + } else if (path.includes("/lessons/node-")) { + presenceData.details = courseTitle.textContent; + presenceData.state = lesson.textContent; + } else if (path.includes("/lessons/ruby-")) { + presenceData.details = courseTitle.textContent; + presenceData.state = lesson.textContent; + } + presence.setActivity(presenceData); +}); diff --git a/websites/T/The Odin Project/tsconfig.json b/websites/T/The Odin Project/tsconfig.json new file mode 100644 index 000000000000..28f3e1115d9d --- /dev/null +++ b/websites/T/The Odin Project/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist/" + } +} \ No newline at end of file