Skip to content
Snippets Groups Projects
Commit 7d0de006 authored by Maxime's avatar Maxime
Browse files

bugfix: math script bug when starting off on listing page - change launch & add event listener

parent 7b3e0e25
No related branches found
No related tags found
1 merge request!20bugfix: math script bug when starting off on listing page - change launch & add event listener
......@@ -13,7 +13,7 @@
firstLoad();
function firstLoad(){
let elementsLoaded = document.querySelector("solid-display");
let elementsLoaded = document.querySelector("solid-poll,solid-display");
//console.log("elements loaded are",elementsLoaded);
if (!elementsLoaded){
......@@ -26,10 +26,14 @@ function firstLoad(){
const dataSourceURI = elementsLoaded.dataset.src;
const urlComponents = new URL(dataSourceURI);
const dataSourceDomain = urlComponents.origin;
////console.log("the data domain is",dataSourceDomain);
//console.log("the data domain is",dataSourceDomain);
//console.log("elements are there, updating id's");
////console.log("elements are there, updating id's");
getPollTotalInfo(dataSourceDomain);
document.querySelector("div#polls solid-display").addEventListener("populate",()=> {
//when populate of a poll
//console.log("poll page");
getPollTotalInfo(dataSourceDomain);
});
document.querySelector("solid-form[name=addPoll]").addEventListener("populate",()=> {
//console.log("populating add form");
......@@ -40,14 +44,14 @@ function firstLoad(){
Updates on navigate
*/
document.querySelector("solid-router").addEventListener("navigate",()=> {
console.log("navigating");
//console.log("navigating");
getPollTotalInfo(dataSourceDomain);
updateFormSource();
});
//refresh display of total votes on a poll
document.querySelector("#poll-votes-values").addEventListener("populate",() => {
console.log("populating");
//console.log("populating");
refreshTotalVotes();
});
......@@ -74,8 +78,8 @@ function firstLoad(){
else{
//get the data src node of first sib display & extract the url
const dataSrc = pageTitle[i].dataset.src;
console.log("data src is",dataSrc,"and title page is", pageTitle[i]);
console.log(pageTitle[i].dataset.src);
//console.log("data src is",dataSrc,"and title page is", pageTitle[i]);
//console.log(pageTitle[i].dataset.src);
//extract current poll ID from the data src
const pollId = dataSrc.match(/\/([0-9]+)\/$/)[1];
/*push to function that will take the value of ID
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment