From d3a43e3216c51e74dccd5e705338f994ae0377b2 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Sun, 28 Aug 2022 19:59:44 +0200 Subject: [PATCH 01/11] feat(The Odin Project): new presence --- .../T/The Odin Project/dist/metadata.json | 24 +++++++++++++++++++ websites/T/The Odin Project/tsconfig.json | 6 +++++ 2 files changed, 30 insertions(+) create mode 100644 websites/T/The Odin Project/dist/metadata.json create mode 100644 websites/T/The Odin Project/tsconfig.json 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..5a8d4d0b7f76 --- /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/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 From 700c6956bd78f180df1c3d15fe1514f140f55646 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Sun, 28 Aug 2022 20:01:07 +0200 Subject: [PATCH 02/11] feat(The Odin Project): New presence --- websites/T/The Odin Project/presence.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 websites/T/The Odin Project/presence.ts diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts new file mode 100644 index 000000000000..fae1edcda840 --- /dev/null +++ b/websites/T/The Odin Project/presence.ts @@ -0,0 +1,14 @@ +const presence = new Presence({ + //The client ID of the Application created at https://discordapp.com/developers/applications + clientId: "1013489969379152022" + }), + browsingTimestamp = Math.floor(Date.now() / 1000); + +presence.on("UpdateData", async () => { + const presenceData: PresenceData = { + largeImageKey: "https://i.imgur.com/gtBvHQH.png", + startTimestamp: browsingTimestamp, + }; + + presence.setActivity(presenceData); +}); From a39edb5f94d8c02510d9675d246d6ce65ab57acb Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Sun, 28 Aug 2022 20:02:04 +0200 Subject: [PATCH 03/11] feat(The Odin Project): new Presence --- websites/T/The Odin Project/presence.ts | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index fae1edcda840..063b3e34cdb0 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -10,5 +10,43 @@ presence.on("UpdateData", async () => { startTimestamp: browsingTimestamp, }; + // Constants to get lessons and courses titles + const lesson = document.querySelector("body > div.page-container.lesson > header > div > div > h1") as HTMLElement | null; + const course = document.querySelector("body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1") as HTMLElement | null + const courseTitle = document.querySelector("body > div.page-container.lesson > header > div > div > a > h2") as HTMLElement | null + + // Default viewing dashboard because TOP blocks network traffic when trying to get pathname inside of dashboard + presenceData.state = 'Viewing Dashboard' + + // When viewing paths + if (document.location.pathname === "/paths") + presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; + else if (document.location.pathname === "/paths/full-stack-javascript") + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗰𝗿𝗶𝗽𝘁 𝗣𝗮𝘁𝗵" + else if (document.location.pathname === "/paths/full-stack-ruby-on-rails") + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 𝗼𝗻 𝗥𝗮𝗶𝗹𝘀 𝗣𝗮𝘁𝗵" + + // When viewing one of the Paths in detail + else if (document.location.pathname === "/paths/foundations/courses/foundations") + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝗼𝘂𝗻𝗱𝗮𝘁𝗶𝗼𝗻𝘀 𝗣𝗮𝘁𝗵" + else if (document.location.pathname.includes('/paths/full-stack-javascript/courses/')) + presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀", + presenceData.state = `${course.innerText}` + else if (document.location.pathname.includes('/paths/full-stack-ruby-on-rails/courses/')) + presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀", + presenceData.state = `${course.innerText}` + + // When working on a lesson + else if (document.location.pathname.includes("/foundations-")) + presenceData.state = `${lesson.innerText}`, + presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣" + else if (document.location.pathname.includes('/lessons/node-')) + presenceData.details = courseTitle.innerText, + presenceData.state = lesson.innerText + else if (document.location.pathname.includes('/lessons/ruby-')) + presenceData.details = courseTitle.innerText, + presenceData.state = lesson.innerText + + presence.setActivity(presenceData); }); From b92eb2cb6f33a8a761ea5d6d2ac64c51d8779b5c Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Sun, 28 Aug 2022 22:20:07 +0200 Subject: [PATCH 04/11] style(The Odin Project): fixed prettier --- websites/T/The Odin Project/presence.ts | 102 ++++++++++++++---------- 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index 063b3e34cdb0..f19f9ce10ce4 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -1,52 +1,72 @@ +/* eslint-disable unicorn/prefer-dom-node-text-content */ const presence = new Presence({ - //The client ID of the Application created at https://discordapp.com/developers/applications - clientId: "1013489969379152022" + //The client ID of the Application created at https://discordapp.com/developers/applications + clientId: "1013489969379152022", }), browsingTimestamp = Math.floor(Date.now() / 1000); presence.on("UpdateData", async () => { const presenceData: PresenceData = { - largeImageKey: "https://i.imgur.com/gtBvHQH.png", - startTimestamp: browsingTimestamp, - }; + largeImageKey: "https://i.imgur.com/gtBvHQH.png", + startTimestamp: browsingTimestamp, + }, + + lesson = document.querySelector( + "body > div.page-container.lesson > header > div > div > h1" + ) as HTMLElement | null, + course = document.querySelector( + "body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1" + ) as HTMLElement | null, + courseTitle = document.querySelector( + "body > div.page-container.lesson > header > div > div > a > h2" + ) as HTMLElement | null; - // Constants to get lessons and courses titles - const lesson = document.querySelector("body > div.page-container.lesson > header > div > div > h1") as HTMLElement | null; - const course = document.querySelector("body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1") as HTMLElement | null - const courseTitle = document.querySelector("body > div.page-container.lesson > header > div > div > a > h2") as HTMLElement | null - - // Default viewing dashboard because TOP blocks network traffic when trying to get pathname inside of dashboard - presenceData.state = 'Viewing Dashboard' - - // When viewing paths - if (document.location.pathname === "/paths") - presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; - else if (document.location.pathname === "/paths/full-stack-javascript") - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗰𝗿𝗶𝗽𝘁 𝗣𝗮𝘁𝗵" - else if (document.location.pathname === "/paths/full-stack-ruby-on-rails") - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 𝗼𝗻 𝗥𝗮𝗶𝗹𝘀 𝗣𝗮𝘁𝗵" - - // When viewing one of the Paths in detail - else if (document.location.pathname === "/paths/foundations/courses/foundations") - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝗼𝘂𝗻𝗱𝗮𝘁𝗶𝗼𝗻𝘀 𝗣𝗮𝘁𝗵" - else if (document.location.pathname.includes('/paths/full-stack-javascript/courses/')) - presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀", - presenceData.state = `${course.innerText}` - else if (document.location.pathname.includes('/paths/full-stack-ruby-on-rails/courses/')) - presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀", - presenceData.state = `${course.innerText}` - - // When working on a lesson - else if (document.location.pathname.includes("/foundations-")) - presenceData.state = `${lesson.innerText}`, - presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣" - else if (document.location.pathname.includes('/lessons/node-')) - presenceData.details = courseTitle.innerText, - presenceData.state = lesson.innerText - else if (document.location.pathname.includes('/lessons/ruby-')) - presenceData.details = courseTitle.innerText, - presenceData.state = lesson.innerText + + switch (document.location.pathname) { + case "/paths": { + presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; + break; + } + case "/paths/full-stack-javascript": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗰𝗿𝗶𝗽𝘁 𝗣𝗮𝘁𝗵"; + break; + } + case "/paths/full-stack-ruby-on-rails": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 𝗼𝗻 𝗥𝗮𝗶𝗹𝘀 𝗣𝗮𝘁𝗵"; + break; + } + case "/paths/foundations/courses/foundations": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝗼𝘂𝗻𝗱𝗮𝘁𝗶𝗼𝗻𝘀 𝗣𝗮𝘁𝗵"; + break; + } + default: + presenceData.state = "Viewing Dashboard"; + if ( + document.location.pathname.includes( + "/paths/full-stack-javascript/courses/" + ) + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if ( + document.location.pathname.includes( + "/paths/full-stack-ruby-on-rails/courses/" + ) + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if (document.location.pathname.includes("/foundations-")) { + (presenceData.state = `${lesson.innerText}`), + (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); + } else if (document.location.pathname.includes("/lessons/node-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); + } else if (document.location.pathname.includes("/lessons/ruby-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); + } + } presence.setActivity(presenceData); }); From 01cd491d6709df37f86c659dd27a08e26c7a3fbb Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Sun, 28 Aug 2022 22:44:30 +0200 Subject: [PATCH 05/11] feat(The Odin Project): new Presence --- websites/T/The Odin Project/presence.ts | 68 +++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index fae1edcda840..f19f9ce10ce4 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -1,14 +1,72 @@ +/* eslint-disable unicorn/prefer-dom-node-text-content */ const presence = new Presence({ - //The client ID of the Application created at https://discordapp.com/developers/applications - clientId: "1013489969379152022" + //The client ID of the Application created at https://discordapp.com/developers/applications + clientId: "1013489969379152022", }), browsingTimestamp = Math.floor(Date.now() / 1000); presence.on("UpdateData", async () => { const presenceData: PresenceData = { - largeImageKey: "https://i.imgur.com/gtBvHQH.png", - startTimestamp: browsingTimestamp, - }; + largeImageKey: "https://i.imgur.com/gtBvHQH.png", + startTimestamp: browsingTimestamp, + }, + + lesson = document.querySelector( + "body > div.page-container.lesson > header > div > div > h1" + ) as HTMLElement | null, + course = document.querySelector( + "body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1" + ) as HTMLElement | null, + courseTitle = document.querySelector( + "body > div.page-container.lesson > header > div > div > a > h2" + ) as HTMLElement | null; + + + switch (document.location.pathname) { + case "/paths": { + presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; + break; + } + case "/paths/full-stack-javascript": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗰𝗿𝗶𝗽𝘁 𝗣𝗮𝘁𝗵"; + break; + } + case "/paths/full-stack-ruby-on-rails": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 𝗼𝗻 𝗥𝗮𝗶𝗹𝘀 𝗣𝗮𝘁𝗵"; + break; + } + case "/paths/foundations/courses/foundations": { + presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝗼𝘂𝗻𝗱𝗮𝘁𝗶𝗼𝗻𝘀 𝗣𝗮𝘁𝗵"; + break; + } + default: + presenceData.state = "Viewing Dashboard"; + + if ( + document.location.pathname.includes( + "/paths/full-stack-javascript/courses/" + ) + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if ( + document.location.pathname.includes( + "/paths/full-stack-ruby-on-rails/courses/" + ) + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if (document.location.pathname.includes("/foundations-")) { + (presenceData.state = `${lesson.innerText}`), + (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); + } else if (document.location.pathname.includes("/lessons/node-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); + } else if (document.location.pathname.includes("/lessons/ruby-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); + } + } presence.setActivity(presenceData); }); From cca69a694a5d2f3466aad9002aa51b7271b886f1 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Mon, 29 Aug 2022 09:10:21 +0200 Subject: [PATCH 06/11] refactor(The Odin Project): refactor to prettier --- websites/T/The Odin Project/presence.ts | 48 ++++++++++++------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index f19f9ce10ce4..ac8806dbb113 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -10,7 +10,6 @@ presence.on("UpdateData", async () => { largeImageKey: "https://i.imgur.com/gtBvHQH.png", startTimestamp: browsingTimestamp, }, - lesson = document.querySelector( "body > div.page-container.lesson > header > div > div > h1" ) as HTMLElement | null, @@ -21,7 +20,6 @@ presence.on("UpdateData", async () => { "body > div.page-container.lesson > header > div > div > a > h2" ) as HTMLElement | null; - switch (document.location.pathname) { case "/paths": { presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; @@ -41,31 +39,29 @@ presence.on("UpdateData", async () => { } default: presenceData.state = "Viewing Dashboard"; + } - if ( - document.location.pathname.includes( - "/paths/full-stack-javascript/courses/" - ) - ) { - (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), - (presenceData.state = `${course.innerText}`); - } else if ( - document.location.pathname.includes( - "/paths/full-stack-ruby-on-rails/courses/" - ) - ) { - (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), - (presenceData.state = `${course.innerText}`); - } else if (document.location.pathname.includes("/foundations-")) { - (presenceData.state = `${lesson.innerText}`), - (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); - } else if (document.location.pathname.includes("/lessons/node-")) { - (presenceData.details = courseTitle.innerText), - (presenceData.state = lesson.innerText); - } else if (document.location.pathname.includes("/lessons/ruby-")) { - (presenceData.details = courseTitle.innerText), - (presenceData.state = lesson.innerText); - } + if ( + document.location.pathname.includes("/paths/full-stack-javascript/courses/") + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if ( + document.location.pathname.includes( + "/paths/full-stack-ruby-on-rails/courses/" + ) + ) { + (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), + (presenceData.state = `${course.innerText}`); + } else if (document.location.pathname.includes("/foundations-")) { + (presenceData.state = `${lesson.innerText}`), + (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); + } else if (document.location.pathname.includes("/lessons/node-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); + } else if (document.location.pathname.includes("/lessons/ruby-")) { + (presenceData.details = courseTitle.innerText), + (presenceData.state = lesson.innerText); } presence.setActivity(presenceData); From 725150ea401c76da551a600f1683304ccca126e7 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Mon, 29 Aug 2022 13:20:50 +0200 Subject: [PATCH 07/11] refactor(The Odin Project): yarn format --- .../T/The Odin Project/dist/metadata.json | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/websites/T/The Odin Project/dist/metadata.json b/websites/T/The Odin Project/dist/metadata.json index 5a8d4d0b7f76..0bfdac5fab17 100644 --- a/websites/T/The Odin Project/dist/metadata.json +++ b/websites/T/The Odin Project/dist/metadata.json @@ -1,24 +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" - ] + "$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 From ec45e361820cf6da02c3d8996e0d55cba94698a3 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Mon, 29 Aug 2022 13:37:22 +0200 Subject: [PATCH 08/11] refactor(The Odin Project): use textContent --- websites/T/The Odin Project/presence.ts | 40 ++++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index ac8806dbb113..2786c0b2c7e0 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -1,6 +1,4 @@ -/* eslint-disable unicorn/prefer-dom-node-text-content */ const presence = new Presence({ - //The client ID of the Application created at https://discordapp.com/developers/applications clientId: "1013489969379152022", }), browsingTimestamp = Math.floor(Date.now() / 1000); @@ -10,31 +8,31 @@ presence.on("UpdateData", async () => { largeImageKey: "https://i.imgur.com/gtBvHQH.png", startTimestamp: browsingTimestamp, }, - lesson = document.querySelector( + lesson = document.querySelector( "body > div.page-container.lesson > header > div > div > h1" - ) as HTMLElement | null, - course = document.querySelector( + ), + course = document.querySelector( "body > div.gradient.odin-dark-bg > div > div:nth-child(1) > a > h1" - ) as HTMLElement | null, - courseTitle = document.querySelector( + ), + courseTitle = document.querySelector( "body > div.page-container.lesson > header > div > div > a > h2" - ) as HTMLElement | null; + ); switch (document.location.pathname) { case "/paths": { - presenceData.state = "𝐕𝐢𝐞𝐰𝐢𝐧𝐠 𝐚𝐥𝐥 𝐏𝐚𝐭𝐡𝐬"; + presenceData.state = "Viewing all Paths"; break; } case "/paths/full-stack-javascript": { - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗰𝗿𝗶𝗽𝘁 𝗣𝗮𝘁𝗵"; + presenceData.state = "Viewing the Full Stack Javascript Path"; break; } case "/paths/full-stack-ruby-on-rails": { - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 𝗼𝗻 𝗥𝗮𝗶𝗹𝘀 𝗣𝗮𝘁𝗵"; + presenceData.state = "Viewing the Full Stack Ruby Path"; break; } case "/paths/foundations/courses/foundations": { - presenceData.state = "𝗩𝗶𝗲𝘄𝗶𝗻𝗴 𝘁𝗵𝗲 𝗙𝗼𝘂𝗻𝗱𝗮𝘁𝗶𝗼𝗻𝘀 𝗣𝗮𝘁𝗵"; + presenceData.state = "Viewing the Foundations Path"; break; } default: @@ -44,24 +42,24 @@ presence.on("UpdateData", async () => { if ( document.location.pathname.includes("/paths/full-stack-javascript/courses/") ) { - (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗝𝗮𝘃𝗮𝘀𝗰𝗿𝗶𝗽𝘁 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), - (presenceData.state = `${course.innerText}`); + (presenceData.details = "Full Stack Javascript - Courses"), + (presenceData.state = `${course.textContent}`); } else if ( document.location.pathname.includes( "/paths/full-stack-ruby-on-rails/courses/" ) ) { - (presenceData.details = "𝗙𝘂𝗹𝗹 𝗦𝘁𝗮𝗰𝗸 𝗥𝘂𝗯𝘆 - 𝗖𝗼𝘂𝗿𝘀𝗲𝘀"), - (presenceData.state = `${course.innerText}`); + (presenceData.details = "Full Stack Ruby - Courses"), + (presenceData.state = `${course.textContent}`); } else if (document.location.pathname.includes("/foundations-")) { - (presenceData.state = `${lesson.innerText}`), + (presenceData.state = `${lesson.textContent}`), (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); } else if (document.location.pathname.includes("/lessons/node-")) { - (presenceData.details = courseTitle.innerText), - (presenceData.state = lesson.innerText); + (presenceData.details = courseTitle.textContent), + (presenceData.state = lesson.textContent); } else if (document.location.pathname.includes("/lessons/ruby-")) { - (presenceData.details = courseTitle.innerText), - (presenceData.state = lesson.innerText); + (presenceData.details = courseTitle.textContent), + (presenceData.state = lesson.textContent); } presence.setActivity(presenceData); From 8208ce4eb274061f21c5b8b89ee48d027bf88c4b Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Mon, 29 Aug 2022 13:38:30 +0200 Subject: [PATCH 09/11] refactor(The Odin Project): create path Variable --- websites/T/The Odin Project/presence.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index 2786c0b2c7e0..5579c84a1b57 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -16,9 +16,10 @@ presence.on("UpdateData", async () => { ), courseTitle = document.querySelector( "body > div.page-container.lesson > header > div > div > a > h2" - ); + ), + path = document.location.pathname; - switch (document.location.pathname) { + switch (path) { case "/paths": { presenceData.state = "Viewing all Paths"; break; @@ -40,24 +41,24 @@ presence.on("UpdateData", async () => { } if ( - document.location.pathname.includes("/paths/full-stack-javascript/courses/") + path.includes("/paths/full-stack-javascript/courses/") ) { (presenceData.details = "Full Stack Javascript - Courses"), (presenceData.state = `${course.textContent}`); } else if ( - document.location.pathname.includes( + path.includes( "/paths/full-stack-ruby-on-rails/courses/" ) ) { (presenceData.details = "Full Stack Ruby - Courses"), (presenceData.state = `${course.textContent}`); - } else if (document.location.pathname.includes("/foundations-")) { + } else if (path.includes("/foundations-")) { (presenceData.state = `${lesson.textContent}`), (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); - } else if (document.location.pathname.includes("/lessons/node-")) { + } else if (path.includes("/lessons/node-")) { (presenceData.details = courseTitle.textContent), (presenceData.state = lesson.textContent); - } else if (document.location.pathname.includes("/lessons/ruby-")) { + } else if (path.includes("/lessons/ruby-")) { (presenceData.details = courseTitle.textContent), (presenceData.state = lesson.textContent); } From 09b84293d2fa35d2fa631c1a82ed323d61c0ffa7 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Mon, 29 Aug 2022 13:46:17 +0200 Subject: [PATCH 10/11] refactor(The Odin Project): no spaces --- websites/T/The Odin Project/presence.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index 5579c84a1b57..5247e29ff168 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -2,7 +2,6 @@ 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", @@ -18,7 +17,6 @@ presence.on("UpdateData", async () => { "body > div.page-container.lesson > header > div > div > a > h2" ), path = document.location.pathname; - switch (path) { case "/paths": { presenceData.state = "Viewing all Paths"; @@ -40,16 +38,10 @@ presence.on("UpdateData", async () => { presenceData.state = "Viewing Dashboard"; } - if ( - path.includes("/paths/full-stack-javascript/courses/") - ) { + 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/" - ) - ) { + } 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-")) { @@ -62,6 +54,5 @@ presence.on("UpdateData", async () => { (presenceData.details = courseTitle.textContent), (presenceData.state = lesson.textContent); } - presence.setActivity(presenceData); }); From 0a71f4a5adc165cffbd61fe4e28e0c7c0eddda84 Mon Sep 17 00:00:00 2001 From: dogukan-sys Date: Tue, 30 Aug 2022 14:05:12 +0200 Subject: [PATCH 11/11] =?UTF-8?q?refactor(The=20Odin=20Project):=20?= =?UTF-8?q?=F0=9F=9A=AE=20brackets=20and=20","?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- websites/T/The Odin Project/presence.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/websites/T/The Odin Project/presence.ts b/websites/T/The Odin Project/presence.ts index 5247e29ff168..0dc0ca22d5b0 100644 --- a/websites/T/The Odin Project/presence.ts +++ b/websites/T/The Odin Project/presence.ts @@ -39,20 +39,20 @@ presence.on("UpdateData", async () => { } if (path.includes("/paths/full-stack-javascript/courses/")) { - (presenceData.details = "Full Stack Javascript - Courses"), - (presenceData.state = `${course.textContent}`); + 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}`); + presenceData.details = "Full Stack Ruby - Courses"; + presenceData.state = `${course.textContent}`; } else if (path.includes("/foundations-")) { - (presenceData.state = `${lesson.textContent}`), - (presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"); + presenceData.state = `${lesson.textContent}`; + presenceData.details = "𝙁𝙤𝙪𝙣𝙙𝙖𝙩𝙞𝙤𝙣𝙨 - 𝙇𝙚𝙨𝙨𝙤𝙣"; } else if (path.includes("/lessons/node-")) { - (presenceData.details = courseTitle.textContent), - (presenceData.state = lesson.textContent); + presenceData.details = courseTitle.textContent; + presenceData.state = lesson.textContent; } else if (path.includes("/lessons/ruby-")) { - (presenceData.details = courseTitle.textContent), - (presenceData.state = lesson.textContent); + presenceData.details = courseTitle.textContent; + presenceData.state = lesson.textContent; } presence.setActivity(presenceData); });