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

Change to connect to the correct javascript #16

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

CParker-dotcom
Copy link
Collaborator

@CParker-dotcom CParker-dotcom commented Apr 13, 2021

I noticed that the newindex.html was linked to the incorrect javascript. Therefore, I corrected that error. I have added the functions, but I would like the functions to be reviewed. In addition, I was confused how to incorporate the for loop for the twitterbot sections.

@@ -0,0 +1,40 @@
/** The function that calls the two functions below */
function callsotherfunctions(){
function loadgetmovement();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to add function.



/** Fetches movement hashtags from the server and adds them to the DOM. */
function loadgetmovement() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm the get movement doesnt have the same type of body as the hashtags, it is a dictionary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following is what I changed, but I do not know if it is correct:

function loadgetmovement() {
fetch('/get-movement').then(response => response.json()).then((movements));
const movementListElement = document.getElementById('movement-list');
movementListElement.appendChild(getMovementElement(movement));

}

/** Fetches movement hashtags from the server and adds them to the DOM. */
function loadgetmovement() {
fetch('/get-movement').then(response => response.json()).then((movements) => {
const movementListElement = document.getElementById('movement-list');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its only one movement, we dont need a loop

}


function creategetmovementElement(movement) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you want to take our template from StopAsianHate and fill out those fields instead of starting from scratch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to the following, but I do not know if it is correct:
function getmovementElement(movement) {
getmovementElement.name = 'name';
getmovementElement.description = 'description';
getmovementElement.hashtag = 'hashtag';
getmovementElement.video = 'video';
getmovementElement.image = 'image';
getmovementElement.donatation = 'donatation';
getmovementElement.resources = 'resources';
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, I also added the twitter bot function that was previously on there, but I do not know what to do with the for loop:
for (var i = 0, keys = Object.keys(LinkedHashMap), ii = keys.length; i < ii; i++) {
console.log('key : ' + keys[i] + ' val : ' + LinkedHashMap[keys[i]]);
}

async function getBot() {
const responseFromServer = await fetch('/twitter-bot' + new URLSearchParams({
hashtag: '#stopasianhate',

}));
const textFromResponse = await responseFromServer.text();

const botContainer = document.getElementById('bot');
botContainer.innerText = textFromResponse;
}

Copy link
Owner

@enriquejosepadilla enriquejosepadilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review comments,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants