-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,40 @@ | |||
/** The function that calls the two functions below */ | |||
function callsotherfunctions(){ | |||
function loadgetmovement(); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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));
}
src/main/webapp/movement.js
Outdated
/** 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'); |
There was a problem hiding this comment.
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
src/main/webapp/movement.js
Outdated
} | ||
|
||
|
||
function creategetmovementElement(movement) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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';
}
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review comments,
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.