From 5d9880304a229562e5a1fac9f5187cf124af193f Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:27:08 +0000 Subject: [PATCH 01/21] cool stuff --- ejs/calendar.ejs | 111 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 ejs/calendar.ejs diff --git a/ejs/calendar.ejs b/ejs/calendar.ejs new file mode 100644 index 00000000..7d4c4486 --- /dev/null +++ b/ejs/calendar.ejs @@ -0,0 +1,111 @@ + + + + + + + + Poke! Calendar + + + +
+

Poke Calendar!! woaww

+

Gregorian Year: <%= year %>

+

Islamic Year: <%= islamicYear %>

+

Persian Year: <%= persianYear %>

+

Week of <%= currentDate.toDateString() %>

+ + + + + + + + + + + + + + + + <% days.forEach(day => { %> + + <% }) %> + + +
Sunday!!!!Monday :cTuesdayWednesdayThursdayFridaySaturday
<%= day.getDate() %> - <%= day.toDateString() %>
+ + +
+ + From 3e75a28a129f53385a1015e9b04461f718c77fed Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:33:46 +0000 Subject: [PATCH 02/21] cool stuff --- src/libpoketube/init/pages-static.js | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/libpoketube/init/pages-static.js b/src/libpoketube/init/pages-static.js index 76ea6a66..0fe158f2 100644 --- a/src/libpoketube/init/pages-static.js +++ b/src/libpoketube/init/pages-static.js @@ -153,6 +153,52 @@ module.exports = function (app, config, renderTemplate) { renderTemplate(res, req, "content-settings.ejs"); }); + + function gregorianToIslamic(gDate) { + const jd = Math.floor((gDate - new Date(1970, 0, 1)) / (24 * 60 * 60 * 1000)) + 2440588; + const islamicYear = Math.floor((30 * (jd - 1948440) + 10646) / 10631); + return islamicYear; +} + + function gregorianToPersian(gDate) { + const persianEpoch = 226895; // Julian Day of Persian Epoch + const jd = Math.floor((gDate - new Date(1970, 0, 1)) / (24 * 60 * 60 * 1000)) + 2440588; + const persianYear = Math.floor((jd - persianEpoch) / 365.2421985) + 1; + return persianYear; +} + +app.get('/calendar', (req, res) => { + const queryDate = req.query.date ? new Date(req.query.date) : new Date(); + const weekOffset = parseInt(req.query.week) || 0; + + const currentDate = new Date(queryDate); + currentDate.setDate(currentDate.getDate() + weekOffset * 7); + + const year = currentDate.getFullYear(); + const month = currentDate.getMonth(); + const startOfWeek = new Date(currentDate); + startOfWeek.setDate(currentDate.getDate() - currentDate.getDay()); + + const days = Array.from({ length: 7 }, (_, i) => { + const day = new Date(startOfWeek); + day.setDate(startOfWeek.getDate() + i); + return day; + }); + + const islamicYear = gregorianToIslamic(currentDate); + const persianYear = gregorianToPersian(currentDate); + + renderTemplate(res, req, "calendar.ejs", { + year, + islamicYear, + persianYear, + month, + currentDate, + days, + }); +}); + + app.get("/offline", function (req, res) { res.sendFile("offline.html", { root: location_pwa }); }); From d5dd9303b8d9733bed0328eba94d3725f79bd8d9 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:35:33 +0000 Subject: [PATCH 03/21] Update html/calendar.ejs --- {ejs => html}/calendar.ejs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {ejs => html}/calendar.ejs (100%) diff --git a/ejs/calendar.ejs b/html/calendar.ejs similarity index 100% rename from ejs/calendar.ejs rename to html/calendar.ejs From 27ae6acc87b705716abb9716a69eec47e3d3f0f5 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:42:22 +0000 Subject: [PATCH 04/21] woaw stuff --- src/libpoketube/init/pages-static.js | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/libpoketube/init/pages-static.js b/src/libpoketube/init/pages-static.js index 0fe158f2..4a8d7d59 100644 --- a/src/libpoketube/init/pages-static.js +++ b/src/libpoketube/init/pages-static.js @@ -168,32 +168,29 @@ module.exports = function (app, config, renderTemplate) { } app.get('/calendar', (req, res) => { - const queryDate = req.query.date ? new Date(req.query.date) : new Date(); - const weekOffset = parseInt(req.query.week) || 0; + const queryDate = req.query.date ? new Date(req.query.date) : new Date(); + + const year = queryDate.getFullYear(); + const month = queryDate.getMonth(); - const currentDate = new Date(queryDate); - currentDate.setDate(currentDate.getDate() + weekOffset * 7); + const firstDay = new Date(year, month, 1); + const firstDayWeekday = firstDay.getDay(); - const year = currentDate.getFullYear(); - const month = currentDate.getMonth(); - const startOfWeek = new Date(currentDate); - startOfWeek.setDate(currentDate.getDate() - currentDate.getDay()); + const totalDays = new Date(year, month + 1, 0).getDate(); - const days = Array.from({ length: 7 }, (_, i) => { - const day = new Date(startOfWeek); - day.setDate(startOfWeek.getDate() + i); - return day; + const days = Array.from({ length: 42 }, (_, i) => { + const day = new Date(year, month, i - firstDayWeekday + 1); + return (day.getMonth() === month) ? day : null; }); - const islamicYear = gregorianToIslamic(currentDate); - const persianYear = gregorianToPersian(currentDate); + const islamicYear = gregorianToIslamic(queryDate); + const persianYear = gregorianToPersian(queryDate); renderTemplate(res, req, "calendar.ejs", { year, islamicYear, persianYear, - month, - currentDate, + currentDate: queryDate, days, }); }); From 786704bcde83abcf99383f798a47c13ec236966b Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:43:35 +0000 Subject: [PATCH 05/21] make it months instead wawa :3 --- html/calendar.ejs | 100 ++++++++++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/html/calendar.ejs b/html/calendar.ejs index 7d4c4486..88dd93d8 100644 --- a/html/calendar.ejs +++ b/html/calendar.ejs @@ -3,8 +3,8 @@ - - + + Poke! Calendar @@ -13,10 +13,6 @@ body { background-color: #121212; color: #ffffff; font-family: Arial, sans-serif; - display: flex; - justify-content: center; - align-items: center; - height: 100vh; margin: 0; } @@ -28,9 +24,29 @@ body { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); width: 90%; max-width: 800px; + margin: auto; } -h1, h2, h3 { +.navbar { + background-color: #333333; + padding: 10px; + display: flex; + justify-content: space-between; /* Aligns items on both ends */ + align-items: center; /* Centers items vertically */ +} + +.navbar h1 { + margin: 0; + color: #bb86fc; +} + +.navbar .years { + color: #bb86fc; /* Year text color */ + display: flex; /* Use flexbox for alignment */ + gap: 20px; /* Space between year elements */ +} + +h2, h3 { color: #bb86fc; } @@ -72,40 +88,48 @@ h1, h2, h3 { .button:hover { background-color: #9c62f3; } - -
+ +
+ From 3c2564f170d06ff709bea4d4ccf731cbedb7ad50 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:45:23 +0000 Subject: [PATCH 06/21] silly --- src/libpoketube/init/pages-static.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libpoketube/init/pages-static.js b/src/libpoketube/init/pages-static.js index 4a8d7d59..8bf72e7d 100644 --- a/src/libpoketube/init/pages-static.js +++ b/src/libpoketube/init/pages-static.js @@ -192,6 +192,7 @@ app.get('/calendar', (req, res) => { persianYear, currentDate: queryDate, days, + month, }); }); From 9cdc85ca910d2ffbe5c2332a3598c4033f4167f0 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:48:10 +0000 Subject: [PATCH 07/21] :3 --- src/libpoketube/init/pages-static.js | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/libpoketube/init/pages-static.js b/src/libpoketube/init/pages-static.js index 8bf72e7d..757ed740 100644 --- a/src/libpoketube/init/pages-static.js +++ b/src/libpoketube/init/pages-static.js @@ -168,31 +168,36 @@ module.exports = function (app, config, renderTemplate) { } app.get('/calendar', (req, res) => { - const queryDate = req.query.date ? new Date(req.query.date) : new Date(); - + const queryDate = req.query.date ? new Date(req.query.date) : new Date(); + const year = queryDate.getFullYear(); - const month = queryDate.getMonth(); + const month = queryDate.getMonth(); // 0 (January) to 11 (December) - const firstDay = new Date(year, month, 1); - const firstDayWeekday = firstDay.getDay(); + const monthOffset = parseInt(req.query.month) || 0; // Get month offset from query + const newDate = new Date(year, month + monthOffset, 1); // Adjust the month + const newYear = newDate.getFullYear(); + const newMonth = newDate.getMonth(); - const totalDays = new Date(year, month + 1, 0).getDate(); + const firstDay = new Date(newYear, newMonth, 1); + const firstDayWeekday = firstDay.getDay(); // Day of the week (0-6) + + const totalDays = new Date(newYear, newMonth + 1, 0).getDate(); const days = Array.from({ length: 42 }, (_, i) => { - const day = new Date(year, month, i - firstDayWeekday + 1); - return (day.getMonth() === month) ? day : null; + const day = new Date(newYear, newMonth, i - firstDayWeekday + 1); + return (day.getMonth() === newMonth) ? day : null; }); - const islamicYear = gregorianToIslamic(queryDate); - const persianYear = gregorianToPersian(queryDate); + const islamicYear = gregorianToIslamic(newDate); + const persianYear = gregorianToPersian(newDate); renderTemplate(res, req, "calendar.ejs", { - year, + year: newYear, islamicYear, persianYear, - currentDate: queryDate, + currentDate: newDate, days, - month, + month: newMonth, }); }); From 0a35ab0cf01cf084d5b1b534d7e0a62d924cd5c6 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:51:31 +0000 Subject: [PATCH 08/21] stuff stuff --- html/calendar.ejs | 219 +++++++++++++++++++++++----------------------- 1 file changed, 109 insertions(+), 110 deletions(-) diff --git a/html/calendar.ejs b/html/calendar.ejs index 88dd93d8..95ed95e8 100644 --- a/html/calendar.ejs +++ b/html/calendar.ejs @@ -6,91 +6,89 @@ Poke! Calendar + - - -
- - - - - - - - - - - - - - <% for (let i = 0; i < 6; i++) { %> +
+
SundayMondayTuesdayWednesdayThursdayFridaySaturday
+ - <% for (let j = 0; j < 7; j++) { %> - - <% } %> + + + + + + + - <% } %> - -
- <% const day = days[i * 7 + j]; %> - <%= day ? day.getDate() : '' %> - SundayMondayTuesdayWednesdayThursdayFridaySaturday
+ + + <% for (let i = 0; i < 6; i++) { %> + + <% for (let j = 0; j < 7; j++) { %> + + <% const day = days[i * 7 + j]; %> + <%= day ? day.getDate() : '' %> + + <% } %> + + <% } %> + + - -
From 3ddc1e072df5dfaab67a071ae00395460edd0f0d Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:52:57 +0000 Subject: [PATCH 09/21] pls work --- src/libpoketube/init/pages-static.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libpoketube/init/pages-static.js b/src/libpoketube/init/pages-static.js index 757ed740..9c74ac1f 100644 --- a/src/libpoketube/init/pages-static.js +++ b/src/libpoketube/init/pages-static.js @@ -168,21 +168,21 @@ module.exports = function (app, config, renderTemplate) { } app.get('/calendar', (req, res) => { + // Get the date from query or default to today const queryDate = req.query.date ? new Date(req.query.date) : new Date(); + // Extract the year and month from the date const year = queryDate.getFullYear(); const month = queryDate.getMonth(); // 0 (January) to 11 (December) - const monthOffset = parseInt(req.query.month) || 0; // Get month offset from query - const newDate = new Date(year, month + monthOffset, 1); // Adjust the month + const monthOffset = parseInt(req.query.month) || 0; + const newDate = new Date(year, month + monthOffset, 1); const newYear = newDate.getFullYear(); const newMonth = newDate.getMonth(); const firstDay = new Date(newYear, newMonth, 1); const firstDayWeekday = firstDay.getDay(); // Day of the week (0-6) - const totalDays = new Date(newYear, newMonth + 1, 0).getDate(); - const days = Array.from({ length: 42 }, (_, i) => { const day = new Date(newYear, newMonth, i - firstDayWeekday + 1); return (day.getMonth() === newMonth) ? day : null; @@ -192,7 +192,7 @@ app.get('/calendar', (req, res) => { const persianYear = gregorianToPersian(newDate); renderTemplate(res, req, "calendar.ejs", { - year: newYear, + year: newYear, islamicYear, persianYear, currentDate: newDate, From 06d1770c0edf102f8257a82a2a6d5aa3a7a81c9c Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:54:44 +0000 Subject: [PATCH 10/21] work --- html/calendar.ejs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/html/calendar.ejs b/html/calendar.ejs index 95ed95e8..61790d0d 100644 --- a/html/calendar.ejs +++ b/html/calendar.ejs @@ -125,10 +125,11 @@ - + +
From 2aa943f141e6226bedc6342a24b525a3dc76bb9f Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 14:58:35 +0000 Subject: [PATCH 11/21] awa --- html/calendar.ejs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/html/calendar.ejs b/html/calendar.ejs index 61790d0d..7b4911af 100644 --- a/html/calendar.ejs +++ b/html/calendar.ejs @@ -6,6 +6,16 @@ Poke! Calendar + + + + + + + + + + From e4f33378bd65f001b9cdf4bd7562d600d71e93cf Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 16:42:55 +0000 Subject: [PATCH 16/21] css stuff --- html/calendar.ejs | 198 ++++++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 94 deletions(-) diff --git a/html/calendar.ejs b/html/calendar.ejs index 337689fc..d4c48c7f 100644 --- a/html/calendar.ejs +++ b/html/calendar.ejs @@ -15,117 +15,127 @@ From 7f9933ae164548a03ea97bb24f5ecbabc234fe60 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 19:07:49 +0000 Subject: [PATCH 17/21] update css stuff :3 --- html/translate.ejs | 364 ++++++++++++++------------------------------- 1 file changed, 111 insertions(+), 253 deletions(-) diff --git a/html/translate.ejs b/html/translate.ejs index b6200b0d..f18b4ce7 100644 --- a/html/translate.ejs +++ b/html/translate.ejs @@ -17,7 +17,6 @@ along with this program. If not, see https://www.gnu.org/licenses/. --> - PokeTranslate @@ -25,225 +24,122 @@ - + - - + + - - <% if (isMobile) { %> - - <% } %> - - <% if (!isMobile) { %> - - <% } %> -
- -

PokeTranslate

- -
+
+
+

PokeTranslate

+
- -
-
- + <% const languageOptions = [ { code: 'autodetect', name: 'Autodetect' }, { code: 'af', name: 'Afrikaans' }, @@ -342,79 +238,43 @@ ]; %> - - + +
+ + - - - - - + +
-
- + - -
-
- -
+ - - -
- -
-
- -
- -
- - -
- -
- - - -
- - - - -
- - -
- - -
-
-
- - +
+ + +
+ +
- + - \ No newline at end of file + From c91b1423a4787595888283745980970dbc543f3b Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 19:15:11 +0000 Subject: [PATCH 18/21] test2 --- html/translate.ejs | 357 ++++++++++++++++++++++++++------------------- 1 file changed, 208 insertions(+), 149 deletions(-) diff --git a/html/translate.ejs b/html/translate.ejs index f18b4ce7..ab41069c 100644 --- a/html/translate.ejs +++ b/html/translate.ejs @@ -16,130 +16,173 @@ You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/. --> - + - - PokeTranslate - - - - - - - - - - - - - textarea { - width: 100%; - resize: vertical; - padding: 1em; - font-size: 1rem; - border-radius: 1em; - border: 2px solid #495057; - background-color: #131618; - color: #f8f9fa; - } + <% if (isMobile) { %> + + <% } %> - .center { - text-align: center; - } + <% if (!isMobile) { %> + + <% } %> + - button { - padding: 10px 20px; - font-size: 1rem; - border: 2px solid #888888; - border-radius: 1em; - background-color: #131618; - color: #f8f9fa; - cursor: pointer; - } - - button:hover { - background-color: #478061; - border-color: #478061; - color: #ffffff; - } - - @media screen and (max-width: 768px) { - .container { - padding: 1em; - } - - header h1 { - font-size: 1.5rem; - } - - .languages { - flex-direction: column; - } - - button { - width: 100%; - } - } - - - - -
-
-

PokeTranslate

-
- - + +
+
+

PokeTranslate

+
+ <% const languageOptions = [ { code: 'autodetect', name: 'Autodetect' }, { code: 'af', name: 'Afrikaans' }, @@ -203,7 +246,7 @@ { code: 'km', name: 'Khmer' }, { code: 'rw', name: 'Kinyarwanda' }, { code: 'kok', name: 'Konkani' }, - { code: 'ko', name: 'Korean' }, + { code: 'ko', name: 'Korean (PROK)' }, { code: 'kri', name: 'Krio' }, { code: 'ku', name: 'Kurdish (Kurmanji)' }, { code: 'sd', name: 'Sindhi' }, @@ -235,55 +278,71 @@ { code: 'yi', name: 'Yiddish' }, { code: 'yo', name: 'Yoruba' }, { code: 'zu', name: 'Zulu' } -]; %> - - -
-
- - <% languageOptions.forEach(language => { %> - + <% }); %> - - <% languageOptions.slice(1).forEach(language => { %> - + <% }); %>
+
- - - - -
- - + +
+
+
- -
- + + - // Auto resize textarea to fit words inside it without the need to scroll - var input = document.getElementById("input"); - var output = document.getElementById("output"); - input.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;"); - output.setAttribute("style", "height:" + output.scrollHeight + "px;overflow-y:scroll;"); - input.addEventListener("input", function(e) { - this.style.height = 150 + "px"; - this.style.height = this.scrollHeight + "px"; - }); - - - + + + + From 3635d37245b3a440853af0e525e0c7929115e5e8 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 19:30:20 +0000 Subject: [PATCH 19/21] stuff :3 --- html/apps.ejs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/html/apps.ejs b/html/apps.ejs index 2fdf74af..a4b7cea0 100644 --- a/html/apps.ejs +++ b/html/apps.ejs @@ -125,10 +125,12 @@
Games - Web Search + Fediverse Translate Maps - PokeTube + Fediverse + Calendar + Watch Settings
From 72fe45cb9e6df3d17ff20e6b94f80a110a82eea8 Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 19:33:00 +0000 Subject: [PATCH 20/21] stuff :3 --- html/apps.ejs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/apps.ejs b/html/apps.ejs index a4b7cea0..91836077 100644 --- a/html/apps.ejs +++ b/html/apps.ejs @@ -125,11 +125,11 @@
Games - Fediverse + Search Translate Maps Fediverse - Calendar + Calendar Watch Settings From c930e55c464189b0083a892a63b147f7fc634b9e Mon Sep 17 00:00:00 2001 From: ashley Date: Fri, 4 Oct 2024 19:39:11 +0000 Subject: [PATCH 21/21] fix goober bug --- src/libpoketube/init/pages-channel-and-download.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index 19be20dd..2f91a2cf 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -88,7 +88,7 @@ module.exports = function (app, config, renderTemplate) { }); app.get("/search", async (req, res) => { - const query = req.query.query.replace("ohio", "things to do in ohio"); + const query = req.query.query ? req.query.query.replace("ohio", "things to do in ohio") : ''; const tab = req.query.tab; const { fetch } = await import("undici");