Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove TODOs and console.logs and commented out code #70

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Display.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/Fetcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/InstanceEntry.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/Paginator_Paginator.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
6 changes: 1 addition & 5 deletions docs/entity_InstanceEntry.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ <h1 class="page-title">Source: entity/InstanceEntry.js</h1>
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);
Expand All @@ -111,7 +107,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/fetchers_Fetcher.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/fetchers_LemmyFetcher.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/fetchers_MastodonFetcher.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
8 changes: 4 additions & 4 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line69">line 69</a>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line61">line 61</a>
</li></ul></dd>


Expand Down Expand Up @@ -844,7 +844,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line85">line 85</a>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line77">line 77</a>
</li></ul></dd>


Expand Down Expand Up @@ -1296,7 +1296,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line100">line 100</a>
<a href="instanceList.js.html">instanceList.js</a>, <a href="instanceList.js.html#line92">line 92</a>
</li></ul></dd>


Expand Down Expand Up @@ -1370,7 +1370,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
10 changes: 1 addition & 9 deletions docs/instanceList.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,7 @@ <h1 class="page-title">Source: instanceList.js</h1>
* @returns {Promise&lt;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
Expand Down Expand Up @@ -150,7 +142,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
3 changes: 1 addition & 2 deletions docs/pageBuilder.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ <h1 class="page-title">Source: pageBuilder.js</h1>
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();
Expand Down Expand Up @@ -101,7 +100,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/paginator.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/postBuilder_LemmyPostBuilder.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
18 changes: 1 addition & 17 deletions docs/postBuilder_MastodonPostBuilder.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@ <h1 class="page-title">Source: postBuilder/MastodonPostBuilder.js</h1>
<pre class="prettyprint source linenums"><code>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 &lt; maxLength; i++) {
for (let j = 0; j &lt; 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
Expand Down Expand Up @@ -78,7 +62,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/postBuilder_PostBuilder.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="InstanceE
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:09:01 GMT+0000 (Coordinated Universal Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 13 2023 05:22:14 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
10 changes: 1 addition & 9 deletions specs/project specifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions src/scripts/entity/InstanceEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions src/scripts/instanceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ export function saveLists(instanceLists, storage = localStorage) {
* @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
Expand Down
1 change: 0 additions & 1 deletion src/scripts/pageBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 0 additions & 16 deletions src/scripts/postBuilder/MastodonPostBuilder.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/scripts/settings-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) => {
Expand Down
Loading