From defdbce041892c424364811239ae275c47f02347 Mon Sep 17 00:00:00 2001 From: Jackson Conte Date: Tue, 12 Dec 2023 21:20:30 -0800 Subject: [PATCH 1/3] Remove TODOs and commented out code --- specs/project specifications.md | 10 +--------- src/scripts/entity/InstanceEntry.js | 4 ---- src/scripts/instanceList.js | 8 -------- src/scripts/postBuilder/MastodonPostBuilder.js | 16 ---------------- src/scripts/settings-page.js | 3 --- 5 files changed, 1 insertion(+), 40 deletions(-) diff --git a/specs/project specifications.md b/specs/project specifications.md index d1701b9..133cab4 100644 --- a/specs/project specifications.md +++ b/specs/project specifications.md @@ -60,12 +60,4 @@ The project's feature goals are as follows: - Advanced recommendation algorithm - More platforms (PeerTube, Pixelfed, etc.) - Customizable UI themes -- A way to share customized instance lists among devices - - -## Project architecture -TODO: insert diagram - -## Wireframes and ideation -TODO: insert screenshots from Miro - +- A way to share customized instance lists among devices \ No newline at end of file diff --git a/src/scripts/entity/InstanceEntry.js b/src/scripts/entity/InstanceEntry.js index 726590e..cfcea31 100644 --- a/src/scripts/entity/InstanceEntry.js +++ b/src/scripts/entity/InstanceEntry.js @@ -56,10 +56,6 @@ export class InstanceEntry extends HTMLElement { script.type = "module"; script.textContent = ` import { handleRemoveInstance } from './src/scripts/instanceList.js'; - // document.getElementById('instance-removal-button').addEventListener('click', () => { - // handleRemoveInstance(${this.network}, ${this.url}); - // console.log('removal button clicked'); - // }); window.handleRemoveInstance = handleRemoveInstance; `; this.shadowRoot.appendChild(script); diff --git a/src/scripts/instanceList.js b/src/scripts/instanceList.js index 9a46b15..b38b9e4 100644 --- a/src/scripts/instanceList.js +++ b/src/scripts/instanceList.js @@ -43,15 +43,7 @@ export function saveLists(instanceLists, storage = localStorage) { * @returns {Promise} Promise which resolves to True if the instance addition was successful, False otherwise */ export async function addInstance(network, url, storage = localStorage) { - // TODO: move validation out of this function? (may separate concerns better) if (!(ALLOWED_NETWORKS.has(network)) || !validUrl(url)) return false; - // Commented out because this creates CORS errors if not done exactly on API - // try { - // let response = await fetch(url); - // if (response.status !== 200) return false; - // } catch (_) { - // return false; - // } let instanceList = fetchInstanceLists(storage); // network is already guaranteed to be in ALLOWED_NETWORKS and thus on the default list diff --git a/src/scripts/postBuilder/MastodonPostBuilder.js b/src/scripts/postBuilder/MastodonPostBuilder.js index 281ba08..c5a9855 100644 --- a/src/scripts/postBuilder/MastodonPostBuilder.js +++ b/src/scripts/postBuilder/MastodonPostBuilder.js @@ -1,22 +1,6 @@ import { PostBuilder } from "./PostBuilder.js"; export class MastodonPostBuilder extends PostBuilder { - // TODO: review this function, remove if not needed - #interleaveArrays(responses) { - const maxLength = Math.max(...responses.map(response => response.length)); - const result = []; - - for (let i = 0; i < maxLength; i++) { - for (let j = 0; j < responses.length; j++) { - if (responses[j].length > i) { - result.push(responses[j][i]); - } - } - } - - return result; - } - /** * * @param {Object} rawPost - The raw json data from the API diff --git a/src/scripts/settings-page.js b/src/scripts/settings-page.js index c399a7e..6a319ea 100644 --- a/src/scripts/settings-page.js +++ b/src/scripts/settings-page.js @@ -31,7 +31,6 @@ addInstBtns.forEach((element) => { // add https:// if the user forgot if (!(url.includes("//"))) { url = "https://".concat(url); - console.log(url); } let success = await addInstance(network, url); if (success) { @@ -43,14 +42,12 @@ addInstBtns.forEach((element) => { input.value = ""; // clear input box after adding to UI } else { - // TODO: don't use an alert alert("Adding instance failed, please try again"); } }); }); // Add event listeners for "reset to default" -// TODO: refactor CSS classes to "button" or "btn". choose one let resetDefaultBtns = Array.from(document.getElementsByClassName("instances-reset-button")); resetDefaultBtns.forEach((element) => { element.addEventListener("click", (event) => { From b49fe8e3a43a6cb78565fba8cc9087a0aba52186 Mon Sep 17 00:00:00 2001 From: Jackson Conte Date: Tue, 12 Dec 2023 21:21:51 -0800 Subject: [PATCH 2/3] forgot one --- src/scripts/pageBuilder.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/scripts/pageBuilder.js b/src/scripts/pageBuilder.js index 4fa181b..debd355 100644 --- a/src/scripts/pageBuilder.js +++ b/src/scripts/pageBuilder.js @@ -19,7 +19,6 @@ export async function buildPage(HANDLERS) { nextPage.disabled = true; prevPage.disabled = true; - // TODO: sane pre-fetching solution that isn't just one instance let postsByNetwork = {}; let maxLengthArray = 0; const instLists = fetchInstanceLists(); From bb724e12343436a38e7de260883142bc9431fd7a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 13 Dec 2023 05:22:14 +0000 Subject: [PATCH 3/3] Generated documentation --- docs/Display.html | 2 +- docs/Fetcher.html | 2 +- docs/InstanceEntry.html | 2 +- docs/Paginator_Paginator.html | 2 +- docs/entity_InstanceEntry.js.html | 6 +----- docs/fetchers_Fetcher.js.html | 2 +- docs/fetchers_LemmyFetcher.js.html | 2 +- docs/fetchers_MastodonFetcher.js.html | 2 +- docs/global.html | 8 ++++---- docs/index.html | 2 +- docs/instanceList.js.html | 10 +--------- docs/pageBuilder.js.html | 3 +-- docs/paginator.js.html | 2 +- docs/postBuilder_LemmyPostBuilder.js.html | 2 +- docs/postBuilder_MastodonPostBuilder.js.html | 18 +----------------- docs/postBuilder_PostBuilder.js.html | 2 +- 16 files changed, 19 insertions(+), 48 deletions(-) diff --git a/docs/Display.html b/docs/Display.html index a28a599..8c07607 100644 --- a/docs/Display.html +++ b/docs/Display.html @@ -121,7 +121,7 @@

Home

Classes

  • diff --git a/docs/Fetcher.html b/docs/Fetcher.html index b227ee1..5e2f9b1 100644 --- a/docs/Fetcher.html +++ b/docs/Fetcher.html @@ -121,7 +121,7 @@

    Home

    Classes

    • diff --git a/docs/InstanceEntry.html b/docs/InstanceEntry.html index fa98d00..7622e3d 100644 --- a/docs/InstanceEntry.html +++ b/docs/InstanceEntry.html @@ -168,7 +168,7 @@

      Home

      Classes

      • diff --git a/docs/Paginator_Paginator.html b/docs/Paginator_Paginator.html index 5664590..c648c38 100644 --- a/docs/Paginator_Paginator.html +++ b/docs/Paginator_Paginator.html @@ -229,7 +229,7 @@

        Home

        Classes

        • diff --git a/docs/entity_InstanceEntry.js.html b/docs/entity_InstanceEntry.js.html index 7f92605..352fc92 100644 --- a/docs/entity_InstanceEntry.js.html +++ b/docs/entity_InstanceEntry.js.html @@ -84,10 +84,6 @@

          Source: entity/InstanceEntry.js

          script.type = "module"; script.textContent = ` import { handleRemoveInstance } from './src/scripts/instanceList.js'; - // document.getElementById('instance-removal-button').addEventListener('click', () => { - // handleRemoveInstance(${this.network}, ${this.url}); - // console.log('removal button clicked'); - // }); window.handleRemoveInstance = handleRemoveInstance; `; this.shadowRoot.appendChild(script); @@ -111,7 +107,7 @@

          Home

          Classes

          • diff --git a/docs/fetchers_Fetcher.js.html b/docs/fetchers_Fetcher.js.html index af9ec7c..0a4384e 100644 --- a/docs/fetchers_Fetcher.js.html +++ b/docs/fetchers_Fetcher.js.html @@ -54,7 +54,7 @@

            Home

            Classes

            • diff --git a/docs/fetchers_LemmyFetcher.js.html b/docs/fetchers_LemmyFetcher.js.html index ec4422c..5eb0a43 100644 --- a/docs/fetchers_LemmyFetcher.js.html +++ b/docs/fetchers_LemmyFetcher.js.html @@ -73,7 +73,7 @@

              Home

              Classes

              • diff --git a/docs/fetchers_MastodonFetcher.js.html b/docs/fetchers_MastodonFetcher.js.html index d4eed92..ba2a977 100644 --- a/docs/fetchers_MastodonFetcher.js.html +++ b/docs/fetchers_MastodonFetcher.js.html @@ -108,7 +108,7 @@

                Home

                Classes

                • diff --git a/docs/global.html b/docs/global.html index e9b4a39..252276d 100644 --- a/docs/global.html +++ b/docs/global.html @@ -661,7 +661,7 @@
                  Parameters:
                  Source:
                  @@ -844,7 +844,7 @@
                  Parameters:
                  Source:
                  @@ -1296,7 +1296,7 @@
                  Parameters:
                  Source:
                  @@ -1370,7 +1370,7 @@

                  Home

                  Classes

                  • diff --git a/docs/index.html b/docs/index.html index daa8486..4b4eac3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -56,7 +56,7 @@

                    Home

                    Classes

                    • diff --git a/docs/instanceList.js.html b/docs/instanceList.js.html index 064102c..ab34f49 100644 --- a/docs/instanceList.js.html +++ b/docs/instanceList.js.html @@ -71,15 +71,7 @@

                      Source: instanceList.js

                      * @returns {Promise<boolean>} Promise which resolves to True if the instance addition was successful, False otherwise */ export async function addInstance(network, url, storage = localStorage) { - // TODO: move validation out of this function? (may separate concerns better) if (!(ALLOWED_NETWORKS.has(network)) || !validUrl(url)) return false; - // Commented out because this creates CORS errors if not done exactly on API - // try { - // let response = await fetch(url); - // if (response.status !== 200) return false; - // } catch (_) { - // return false; - // } let instanceList = fetchInstanceLists(storage); // network is already guaranteed to be in ALLOWED_NETWORKS and thus on the default list @@ -150,7 +142,7 @@

                      Home

                      Classes

                      • diff --git a/docs/pageBuilder.js.html b/docs/pageBuilder.js.html index 8af1f22..e12fa8a 100644 --- a/docs/pageBuilder.js.html +++ b/docs/pageBuilder.js.html @@ -47,7 +47,6 @@

                        Source: pageBuilder.js

                        nextPage.disabled = true; prevPage.disabled = true; - // TODO: sane pre-fetching solution that isn't just one instance let postsByNetwork = {}; let maxLengthArray = 0; const instLists = fetchInstanceLists(); @@ -101,7 +100,7 @@

                        Home

                        Classes

                        • diff --git a/docs/paginator.js.html b/docs/paginator.js.html index e89e533..632f3b7 100644 --- a/docs/paginator.js.html +++ b/docs/paginator.js.html @@ -125,7 +125,7 @@

                          Home

                          Classes

                          • diff --git a/docs/postBuilder_LemmyPostBuilder.js.html b/docs/postBuilder_LemmyPostBuilder.js.html index 2c51d12..e0f5ec3 100644 --- a/docs/postBuilder_LemmyPostBuilder.js.html +++ b/docs/postBuilder_LemmyPostBuilder.js.html @@ -105,7 +105,7 @@

                            Home

                            Classes

                            • diff --git a/docs/postBuilder_MastodonPostBuilder.js.html b/docs/postBuilder_MastodonPostBuilder.js.html index 602e571..9b29401 100644 --- a/docs/postBuilder_MastodonPostBuilder.js.html +++ b/docs/postBuilder_MastodonPostBuilder.js.html @@ -29,22 +29,6 @@

                              Source: postBuilder/MastodonPostBuilder.js

                              import { PostBuilder } from "./PostBuilder.js";
                               
                               export class MastodonPostBuilder extends PostBuilder {
                              -    // TODO: review this function, remove if not needed
                              -    #interleaveArrays(responses) {
                              -        const maxLength = Math.max(...responses.map(response => response.length));
                              -        const result = [];
                              -
                              -        for (let i = 0; i < maxLength; i++) {
                              -            for (let j = 0; j < responses.length; j++) {
                              -                if (responses[j].length > i) {
                              -                    result.push(responses[j][i]);
                              -                }
                              -            }
                              -        }
                              -
                              -        return result;
                              -    }
                              -
                                   /**
                                    *
                                    * @param {Object} rawPost - The raw json data from the API
                              @@ -78,7 +62,7 @@ 

                              Home

                              Classes

                              • diff --git a/docs/postBuilder_PostBuilder.js.html b/docs/postBuilder_PostBuilder.js.html index ca1713d..12aa3e6 100644 --- a/docs/postBuilder_PostBuilder.js.html +++ b/docs/postBuilder_PostBuilder.js.html @@ -57,7 +57,7 @@

                                Home

                                Classes