Date picker in angular

I have a problem to get, selected date from datepicker calendar. when I select a date in the calendar it always send current date to the backend. Not the selected date.

This is the method that i implemented in typescript file.
getAttendanceForPeriod(startDate: Date, endDate: Date) {
this.apiService
.getAttendanceForPeriod(startDate, endDate)
.subscribe((result) => {
this.dataSource = result.payload;
});
}

This is the method that i implement in service file.
public getAttendanceForPeriod(startDate: Date, endDate: Date) {
return this.http.post(
‘/attendance/get-attendance-for-period’,
{
params: {
startDate: startDate.toISOString(),
endDate: endDate.toISOString(),
},
}
);
}

I want to fix if there is an error in this.

Hello friends, I’m totally new here

I’ve got a question, maybe it’s easy one, maybe not, but please be merciful with me. I have some great animation done with blender, how can this animation starts when I’m scrolling and stop when i stop scrolling ? what do I need ? It’s like 10-12 seconds 3d animation

I tried to search solution, but i couldn’t find anything with blender animation

All working locally fine but when uploaded some media files/players (mp3) and mp4 background doesn’t work at all

function playMusic() {
  var songs = [
    "pump.mp3",
    "ybwm.mp3",
    "bb.mp3",
  ];

  var randomIndex = Math.floor(Math.random() * songs.length);
  var selectedSong = songs[randomIndex];

  var audio = new Audio(selectedSong);
  audio.addEventListener("ended", playNextSong);
  audio.play();
}

function playNextSong() {
  playMusic();
}

This is the function for music playing in the background once a button has been clicked. “ybwm.mp3” and “bb.mp3” work fine while “pump.mp3” doesn’t.

function changeBackground() {
  var backgroundContainer = document.getElementById("background-container");
  backgroundContainer.style.opacity = 1;
  backgroundContainer.style.pointerEvents = "auto";

  var myvideo = document.createElement("video");
  myvideo.id = "myvideo";
  myvideo.autoplay = true;
  myvideo.muted = true;
  myvideo.loop = true;
  myvideo.style.position = "fixed";
  myvideo.style.top = "0";
  myvideo.style.left = "0";
  myvideo.style.width = "100%";
  myvideo.style.height = "100%";
  myvideo.style.objectFit = "cover";
  myvideo.style.zIndex = "-1";

  var source = document.createElement("source");
  source.src = "DANCE2.mp4";
  source.type = "video/mp4";

  myvideo.appendChild(source);
  backgroundContainer.appendChild(myvideo);
}

This is the code for the background after the button has been clicked, works fine locally but does not work once uploaded online.

I tried to change source type to video/mp4 or specifically tried to make it that. Expecting for the background to show up online but it didn’t.
I also tried to convert the audio/x-generic to video/mp4. Someone had it work for them and it didn’t work for me.
I changed/replaced files. I thought it might’ve been size at first so I changed to lower size mp3 file and that didn’t change anything, it seems like only the two mp3 files work when online.

Share amplify build log file via SNS notification

Can anyone please answer my query – Is there any way to get the build log file of AWS Amplify ?
I’m getting build status (success | fail) email notification via SNS, and I want to add-on the build log attachment with the SNS notification configs .

I am getting an email with body via SNS and looking to add build logs file as an attachment with the same

Is there a method to get the text input and automatically open an external tab with the search result?

I am trying to create a function where the code grabs user text input in the search box, and opens up a new tab with the inputted text. I created a search box for users to insert a name, but the function to search with the inserted name is not available. I am trying to achieve the following: https://opencorporates.com/companies/country/ca?q=Exxon+Mobil&utf8=%E2%9C%93. Below is my code:

function displayPersonOrCompanySearchFields(){
    let person = document.getElementById("person-subject");
    let company = document.getElementById("company-subject");
    let person_states = document.getElementById("person-search-states");
    let company_states = document.getElementById("company-search-states");
    let person_field = document.getElementById("person-search-field");
    let company_field = document.getElementById("company-search-field");
    
    if(person.checked === true){
      person_states.style.display = "block";
      person_field.style.display = "block";
      company_states.style.display = "none";
      company_field.style.display = "none";
    }else{
      company_states.style.display = "block";
      company_field.style.display = "block";
      person_states.style.display = "none";
      person_field.style.display = "none";
    }
  }

function buildQuery(){
  
}  

const openCorporateRecordTabs = () => {
  const selectedStateName = document.querySelectorAll('input[name="state-name"]:checked');
  // populate array selectedStateUrls
  const selectedStateUrls = Array.from(selectedStateName, x => corporaterecordsUrls[x.value]);

  selectedStateUrls.forEach(url => {
    win = window.open(url);
    if (win) {
      //Browser has allowed it to be opened
      win.focus();
    } else {
      //Browser has blocked it
      alert(`trying to open ${url} - Please allow popups for this website`);
    }
  });
}


const firstName = document.querySelector('input[name="first-name"]').value;
const lastName = document.querySelector('input[name="last-name"]').value;


const corporaterecordsUrls = {
    "federal-level": ["https://www.ic.gc.ca/app/scr/cc/CorporationsCanada/fdrlCrpSrch.html?locale=en_CA"],
    "alberta": [`https://beta.canadasbusinessregistries.ca/search/results?search=%7B${firstName}%20${lastName}%7D&status=Active`],
    "british-columbia": ["https://beta.canadasbusinessregistries.ca/search", "https://www.bccourts.ca/search_judgments.aspx", "https://www.provincialcourt.bc.ca/judgments.php?link=https://www.canlii.org/en/bc/bcpc/"],
    "manitoba": ["https://beta.canadasbusinessregistries.ca/search", "https://companiesonline.gov.mb.ca/"],
    "new-brunswick": ["https://opencorporates.com/", "https://www.pxw2.snb.ca/"],
    "newfoundland-and-labrador": ["https://opencorporates.com/"],
    "nova-scotia": ["https://opencorporates.com/", "https://rjsc.novascotia.ca/?__cf_chl_jschl_tk__=c123b354ac59e279f1af733e938177f6c5426b4a-1618521288-0-AUxWaXpKmCqfw-_YAUdjtk9Q2Cbm53t55RP0T100hw2a-m7_3UjG_TDZ-Om5CGN9UH6sEha24sil5RRjdqN2Pbasm6aYHl-j71DEpm6LtYb3nGs3QeAcHtzo4c01CRDqUPYwGLqDqIoX7C3PQU6OigVbBEOCD9-gOgBNI8bqNTqV7LEQZ1nKpbwhqOdF7RpW5EfMA4r7fCDWekXEjsNRdUxOOmLCI2oUMhF4PlclYnaRp7FmMr4FrdNCOm9Ch5O2YUogg6qxaT0GmrMVTUz8Y1rbdAH4VKcANUaK6x9HXjzveieEkSd65Dcrn7ezVPTP12S3r43_J9O1eDlIYb961XlVfsHPB2I9K1rG_2c8S-H97YS4gKEpI4M4uu_CqfF0L0l_PamEKWc-pG-yuqhsNPxLIfa9YrVkLUBJs-BHQ_Hhyt9YB6F0YrP8NNs6rTvraw"],
    "ontario": ["https://beta.canadasbusinessregistries.ca/search", "https://www.eservicecorp.ca/"],
    "prince-edward-island": ["https://opencorporates.com/", "https://www.princeedwardisland.ca/en/feature/pei-business-corporate-registry#/home/BusinessAPI/BusinessAPI"],
    "quebec": ["https://beta.canadasbusinessregistries.ca/search", "http://www.registreentreprises.gouv.qc.ca/en/"],
    "saskatchewan": ["https://beta.canadasbusinessregistries.ca/search", "https://corporateregistry.isc.ca/"],
    "northwest-territories": ["https://decisia.lexum.com/nwtcourts-courstno/en/nav.do"],
    "nunavut": ["https://nni.gov.nu.ca/business/search/name"],
    "yukon": ["https://ycor-reey.gov.yk.ca/search"],
}

const openSelectedStateTabs = () => {
    const selectedStateName = document.querySelector('input[name="state-name"]:checked').value;
    const selectedStateUrls = litigationstatesUrls[selectedStateName];
    selectedStateUrls.forEach(url => window.open(url));
}

const litigationstatesUrls = {
    "federal-level": ["https://www.scc-csc.ca/case-dossier/rec-doc/request-demande-eng.aspx#tab_form", "https://decisions.fct-cf.gc.ca/fc-cf/en/nav.do", "https://decisions.fca-caf.gc.ca/fca-caf/en/d/s/index.do?col=53", "https://decisions.cmac-cacm.ca/cmac-cacm/en/d/s/index.do", "https://decision.tcc-cci.gc.ca/tcc-cci/en/d/s/index.do?col=52", "https://secure.tritoncanada.ca/Eiv/PersonalInfo?userVerifiedId=82889f40-66e9-4637-9803-d4d4652b4fa7&firstload=1", "https://search-recherche.gc.ca/rGs/s_r?langs=eng&st1rt=0&num=10&cdn=rcmp&st=s"],
    "alberta": ["https://www.canlii.org/en/ab/abpc/", "https://www.canlii.org/en/ab/abca/index.html", "https://www.canlii.org/en/ab/abqb/", "https://cfr.forms.gov.ab.ca/Form/CTS3859.pdf", "https://albertacourts.ca/docs/default-source/pc/search-request-(criminal—traffic).pdf?sfvrsn=7e9d280_10"],
    "british-columbia": ["https://justice.gov.bc.ca/cso/index.do", "https://www.bccourts.ca/search_judgments.aspx", "https://www.provincialcourt.bc.ca/judgments.php?link=https://www.canlii.org/en/bc/bcpc/"],
    "manitoba": ["https://web43.gov.mb.ca/Registry/NameSearch"],
    "new-brunswick": ["https://www1.gnb.ca/nota/Default.aspx", "https://www.canlii.org/en/"],
    "newfoundland-and-labrador": ["https://www.canlii.org/en/", "https://court.nl.ca/supreme/general/accessproceedings.html", "https://apps.gov.nl.ca/pc-forms/court/home/SelectRecordCheck/"],
    "nova-scotia": ["https://decisia.lexum.com/nsc/en/nav.do"],
    "ontario": ["https://www.ontario.ca/page/search-court-cases-online", "https://www.ontariocourts.ca/ocj/search/", "https://www.canlii.org/en/", "https://coadecisions.ontariocourts.ca/coa/en/d/s/index.do"],
    "prince-edward-island": [, "https://www.canlii.org/en/"],
    "quebec": ["https://soquij.qc.ca/a/fr/404"],
    "saskatchewan": ["https://www.canlii.org/en/", "https://sasklawcourts.ca/images/documents/Resources/Request_for_Access_to_Court_Records_2020.pdf"],
    "northwest-territories": ["https://decisia.lexum.com/nwtcourts-courstno/en/nav.do"],
    "nunavut": ["http://dockets.nunavutcourts.ca/NameSearch/Index"],
    "yukon": ["https://www.canlii.org/en/"],
}

const openBankruptcyUrls = () => {
  const bankruptcyurls = ["https://www.ic.gc.ca/app/scr/bsf-osb/ins/login.html?lang=eng"]

  for (let i = 0; i < bankruptcyurls.length; i++) {
    window.open(bankruptcyurls[i])
  }
}

const openRegulatoryUrls = () => {
  const regulatoryurls = ["https://info.securities-administrators.ca/disciplinedpersons.aspx", "https://www.iiroc.ca/industry/enforcement/Pages/Search-Disciplinary-Cases.aspx", "https://www.canada.ca/", "https://www.securities-administrators.ca/nrs/nrsIndvSearchResults.aspx?mode=QS&type=I&indv=Matt"]

  for (let i = 0; i < regulatoryurls.length; i++) {
    window.open(regulatoryurls[i])
  }
}

var personNameParams = new URLSearchParams(window.location.hash.split('?')[1]);
if(personNameParams.get('first-name') && ('last-name')) {
  value = personNameParams.get('first-name') + '' + personNameParams.get('last-name')
}

var companyNameParams = new URLSearchParams(window.location.hash.split('?')[1]);
if(companyNameParams.get('company-name')) {
  value = companyNameParams.get('company-name') + ''
}

window.onkeyup = keyup;

var inputTextValue;

function keyup(e) {
  inputTextValue = e.target.value;

  $('#first-name')+$('#last-name').url(corporaterecordsUrls)+inputTextValue;

  if (e.keyCode == 13){
    window.location = corporaterecordsUrls + inputTextValue;
  }
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="/canada.css"> 
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
        <script defer src="/canada.js"></script>
        <title>MESA Canada</title>
    </head>
    <body>
        <div class="container">
            <p class="title">MESA Canada</p>
        </div>
        <div id="company-search-field">
          <input id="company-name" name="company-name" style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="Insert company name here" />
        </div>
        <div id="person-search-field" style="display: none;">
          <input id="first-name" name="first-name" style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="Insert person first name here" />
          <input id="last-name" name="last-name" style="background-color: white; margin-left: 1rem; width: 300px; line-height: 5;" placeholder="Insert person last name here" />
        </div>
        <br>
        <div class="search-subject" style="margin-left: 1rem;">
          <input type="radio" onclick="displayPersonOrCompanySearchFields()" id="company-subject" name="subject-type" value="company-subject" checked>
          <label for="company-subject">Company</label>
          <input type="radio" onclick="displayPersonOrCompanySearchFields()" id="person-subject" name="subject-type" value="person-subject">
          <label for="person-subject">Person</label>
        </div>
        <br></br>
        <!-- WHEN COMPANY IS SELECTED -->
        <div id="company-search-states">
          <div class="states-dropdown-list">
            <form action="" onsubmit="return false;" style="width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;">
                <b style="margin-left: 1rem;"><span style="color: darkgreen;">Corporate Records</span> and <span style="color: darkgreen;">Litigation</span> Research</b>
                <div style="border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 26rem; background-color: black;">
                    <svg style="color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z" fill="white"></path> 
                    </svg>
                </div>
                <ul class="states-dropdown" style="list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;">
                    <li><label><input type="checkbox" name="state-name" class="state" value="federal-level" checked>Federal Level</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="alberta">Alberta<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="british-columbia">British Columbia<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="manitoba">Manitoba<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="new-brunswick">New Brunswick<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="newfoundland-and-labrador">Newfoundland and Labrador<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="nova-scotia">Nova Scotia<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="ontario">Ontario<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="prince-edward-island">Prince Edward Island<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="quebec">Quebec<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="saskatchewan">Saskatchewan<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="northwest-territories">Northwest Territories</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="nunavut">Nunavut</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="yukon">Yukon</label></li>
                </ul>
                <span style="font-size: x-small; position: absolute; padding: 0.5rem;">*OpenCorporates will open</span>
                <br>
                <span style="font-size: x-small; position: absolute; padding: 0.5rem;">**Canada's Business Registries will open</span>
                <br></br>
                <button style="background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;" onclick="openCorporateRecordTabs();">
                    <svg class="svg-icon" viewBox="0 -3 20 20" style="width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;">
                        <path fill="white" d="M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z"></path>
                    </svg>
                    Search Corporate Records</button>
                <br></br>
                <button style="background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;" onclick="openSelectedStateTabs();">
                    <svg class="svg-icon" viewBox="0 -3 20 20" style="width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;">
                        <path fill="white" d="M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z"></path>
                    </svg>
                    Search Litigation Cases</button>
            </form>
          </div>
        </div>
        <!-- WHEN PERSON IS SELECTED -->
        <div id="person-search-states" style="display: none;">
          <div class="states-dropdown-list">
            <form action="" onsubmit="return false;" style="width: 620px; border-right: solid; line-height: 2rem; border-color: darkgreen;;">
                <b style="margin-left: 1rem;"><span style="color: darkgreen;">Corporate Affiliations</span> and <span style="color: darkgreen;">Litigation</span> Research</b>
                <div style="border-radius: 25px; width: 30px; height: 30px; flex: auto; margin-top: -2rem; margin-left: 28rem; background-color: black;">
                    <svg style="color: white; background-color: transparent; margin-left: 0.4rem; margin-top: 0.4rem;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-geo" viewBox="0 0 16 16"> <path fill-rule="evenodd" d="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6zM4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.319 1.319 0 0 0-.37.265.301.301 0 0 0-.057.09V14l.002.008a.147.147 0 0 0 .016.033.617.617 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 0 0 .146-.15.148.148 0 0 0 .015-.033L12 14v-.004a.301.301 0 0 0-.057-.09 1.318 1.318 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411z" fill="white"></path> 
                    </svg>
                </div>
                <ul class="states-dropdown" id="provinces-list" style="list-style: none; margin-left: -1.5rem; column-count: 2; -webkit-column-count: 2; -moz-column-count: 2; width: 600px;">
                    <li><label><input type="checkbox" name="state-name" class="state" value="federal-level" checked>Federal Level</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="alberta">Alberta<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="british-columbia">British Columbia<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="manitoba">Manitoba<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="new-brunswick">New Brunswick<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="newfoundland-and-labrador">Newfoundland and Labrador<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="nova-scotia">Nova Scotia<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="ontario">Ontario<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="prince-edward-island">Prince Edward Island<sup style="font-size: x-small;">*</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="quebec">Quebec<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="saskatchewan">Saskatchewan<sup style="font-size: x-small;">**</sup></label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="northwest-territories">Northwest Territories</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="nunavut">Nunavut</label></li>
                    <li><label><input type="checkbox" name="state-name" class="state" value="yukon">Yukon</label></li>
                </ul>
                <span style="font-size: x-small; position: absolute; padding: 0.5rem;">*OpenCorporates will open</span>
                <br>
                <span style="font-size: x-small; position: absolute; padding: 0.5rem;">**Canada's Business Registries will open</span>
                <br></br>
                <button style="background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 220px; cursor: pointer; margin-left: 1rem;" onclick="openCorporateRecordTabs();">
                    <svg class="svg-icon" viewBox="0 -3 20 20" style="width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;">
                        <path fill="white" d="M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z"></path>
                    </svg>
                    Search Corporate Records</button>
                <br></br>
                <button style="background-color: darkgreen; color: white; border: none; border-radius: 4px; height: 34px; width: 210px; cursor: pointer; margin-top: -4.15rem; float: right; margin-right: 5rem;" onclick="openSelectedStateTabs();">
                    <svg class="svg-icon" viewBox="0 -3 20 20" style="width: 15px; height: 15px; margin-left: 2px; background-color: transparent; padding-top: 6px;">
                        <path fill="white" d="M18.109,17.776l-3.082-3.081c-0.059-0.059-0.135-0.077-0.211-0.087c1.373-1.38,2.221-3.28,2.221-5.379c0-4.212-3.414-7.626-7.625-7.626c-4.212,0-7.626,3.414-7.626,7.626s3.414,7.627,7.626,7.627c1.918,0,3.665-0.713,5.004-1.882c0.006,0.085,0.033,0.17,0.098,0.234l3.082,3.081c0.143,0.142,0.371,0.142,0.514,0C18.25,18.148,18.25,17.918,18.109,17.776zM9.412,16.13c-3.811,0-6.9-3.089-6.9-6.9c0-3.81,3.089-6.899,6.9-6.899c3.811,0,6.901,3.09,6.901,6.899C16.312,13.041,13.223,16.13,9.412,16.13z"></path>
                    </svg>
                    Search Litigation Cases</button>
            </form>
          </div>
        </div>

Duplicate Firestore subcollection created upon updating existing records with Google App Script Extension

I am using Google App Script extension to import my existing Data/rows from Google sheet by using this well-written library – https://github.com/grahamearley/FirestoreGoogleAppsScript

I tried to use firestore.updateDocument function to update existing documents within the Firestore that are identified by a set of primary keys, after comparing them to the existing rows in googlesheets.

The code, which is based on Javascript, I believe, works to identify existing documents before the update function runs, but it actually – results in creating a “subcollection project” in the target collection instead. This results in an issue where my app is not able to retrieve latest updated records but only the original outdated Firestore documents.

Kindly refer to the screenshot.

enter image description here

I followed library instructions and everything, could someone who is good at javascript look into my code and guide me?

   var collectionName = "collectionNameTest"

       // Check if a document with the same primary keys exists in the existing Firestore collection
       var duplicateDocs = firestore.query(collectionName)
       .Where(primaryKey1Column,"==",primaryKey1)
       .Where(primaryKey2Column,"==",primaryKey2)
       .Execute();

 if (duplicateDocs.length > 0) {
         // A document with the same primary key already exists in the collection

        const name = duplicateDocs[0].name

         console.log(`Documents with primaryKey1 '${primaryKey1}' and with primaryKey2 '${primaryKey2}'  already exists. Updating existing record with new record...`);

         try { var result = firestore.updateDocument(`${collectionName}/${name}`, data);
                console.log("Firestore document updated, Firestore result: ", result);
              } catch (e) {
                console.error("Firestore update failed: ", e);
              }                 

       } else {
         // No document with the same primary key exists, so create a new document
         var result = firestore.createDocument(collectionName, data);
         console.log("New Firestore document created, Firestore result: ", result);
       }


How do I get the innerText of elements with a certain class name in my current tab using a chrome extension?

Suppose there is a website with the following index.html:

<!DOCTYPE html>
<html>
    <body>
        <div class="test">Result</div>
    </body>
</html>

How do I create a chome extension so that I can retrieve “Result” from the class test whenever I click on the extension and display “Result” in its popup?

This is what I’ve tried so far:

manifest.json

{
    "manifest_version": 3,
    "name": "Test",
    "version": "1.0.0",
    "permissions": ["activeTab"],
    "action": {
        "default_popup": "popup.html"
    }
}

popup.html

<!DOCTYPE html>
<html>
    <body>
        <div id="result"></div>
    </body>
    <script src="popup.js"></script>
</html>

popup.js

function main() {
    var q = document.getElementsByClassName("test");
    var res = "";
    for(let i = 0; i < q.length; i++) {
        res += q[i].innerText + "n";
    }
    document.getElementById("result").innerText = res;
}

main();

When I run this, q.length is always zero. So it would appear that the script cannot find any class named test.

How “access” a newly created div element in a script which ran before the element creation?

Suppose I have an html page

<html> 
    </form>
    <button onclick="add_product()">
        ADD 
    </button>

    <script type="text/javascript" src="static/script1.js"></script>
    <script type="text/javascript" src="static/script2.js"></script>
</html>

where script1.js is

function add_product(){
    const add_product_div = document.createElement("div");
    add_product_div.id = "add_product";
    add_product_div.className = "draggable_box";
    add_product_div.innerHTML="<h1> hey </h1> <p> whatevea </p> ";
    document.body.appendChild(add_product_div);
}

Now how can I access the newly created div draggable_box in script2.js

div = document.getElementsByClassName("draggable_box");
console.log(div)

console.log(div)
Gives a empty list as script2.js had already run before I added the element draggable_box.

I am new to web development! Essentially I want to use script2.js to make all the div I create draggable, I know how to do this when the script is run after the div is created. Please suggest the correct way to do this!

Cannot read properties of undefined (reading ‘0’ or ’19’)

So i have 2 functions, one that randomly assign 19 or 0 to posPlongeurX
The second one is supposed to read it in order to locate the case in an array
However it seems like it can’t read it except 0 and 19 are in the 2d array (14×20)
posPlongeurX is defined outside of both of the function.

function that assign posPlongeurX :



function Plongeur() {
     //Génère un nombre random entre 3 et 10
    
    var NageurVersDroite = Math.round(Math.random())
    var posPlongeurY = PlongeurY;
    if (NageurVersDroite == 0) {
        NageurVersLaDroite = false;
        posPlongeurX = 19;
        plateau[posPlongeurY][posPlongeurX].style.backgroundImage = "url('./img/nadador2.png')";
    }
    else {
        NageurVersLaDroite = true;
        posPlongeurX = 0;
        plateau[posPlongeurY][posPlongeurX].style.backgroundImage = "url('./img/nadador2.png')";
    }
}

a bit of the function that read the X value in the array:

plateau[posPlongeurY][posPlongeurX].name = "Plongeur";

The code of the array :

function initPlateau() {
  plateau = new Array(hauteur);
  for (let i = 0; i < hauteur; i++) {
    plateau[i] = new Array(largeur);
  }
  let contenu = document.querySelector("#contenu");
  let monTableau = document.createElement("table");
  // lignes 
  for (let i = 0; i < hauteur; i++) {
    let uneLigne = document.createElement("tr");
    for (let j = 0; j < largeur; j++) {
      let uneColonne = document.createElement("td");
      uneLigne.appendChild(uneColonne);
      uneColonne.style.backgroundSize = "contain";
      plateau[i][j] = uneColonne;
    }
    monTableau.appendChild(uneLigne);
  }
  contenu.appendChild(monTableau);

  // Set dynamic background image size based on largeur and hauteur
  contenu.style.backgroundImage = "url('./img/header.png'), url('./img/footer.png'), url('./img/middle-image.png')";
  contenu.style.backgroundRepeat = "no-repeat";
  contenu.style.backgroundPosition = "top center, bottom center, top center";
  contenu.style.backgroundColor = "#000b8f";
  contenu.style.backgroundSize = `${largeur * 45}px ${hauteur * 9.5}px`;
}

i tried changing the variable or changing name etc can’t do it

How to send data NextJS and MongoDB

I am trying to send data from a form to mongo DB but the data comes back as undefined using nextJS and MongoDB.

NewPlayerPage component:

const newPlayerPage = (props) => {
    console.log('props: ' + props);

    const handleAddPlayer = async (enteredPlayerData) => {
        
        const response = await fetch('/api/new-player', {
            method: 'POST',
            body: JSON.stringify(enteredPlayerData),
            headers: { 'Content-Type': 'application/json' },
        });

        const data = response.json();
        router.replace('/teams/' + router.query.teamId);

        alert('Player ' + enteredPlayerData.playerFName + ' created!');
    };

    const router = useRouter();
    return (
        <Fragment>
            <h2>New player page</h2>
            <h3>TeamID: {router.query.teamId}</h3>
            <NewPlayer teamId={router.query.teamId} onAddPlayer={handleAddPlayer} />
        </Fragment>
    );
};

NewPlayer component:

const newPlayer = (props) => {
    const playerFNameInput = useRef();
    const playerLNameInput = useRef();
    const teamId = props.teamId;

    const handleSubmit = (event) => {
        event.preventDefault();

        const enteredPlayerFName = playerFNameInput.current.value;
        const enteredPlayerLName = playerLNameInput.current.value;

        const playerData = {
            teamId: teamId,

            playerName: {
                playerFName: enteredPlayerFName,
                playerLName: enteredPlayerLName,
            },
        };
        props.onAddPlayer(playerData);
    };
    return (
            <form onSubmit={handleSubmit}>
                <h3>Team: {props.teamName}</h3>
                <div className={classes.control}>
                    <label htmlFor='playerFName'>Player First Name</label>
            <input type='text' required id='playerFName' ref {playerFNameInput} />
                    <label htmlFor='playerLName'>Player Last Name</label>
            <input type='text' required id='playerLName' ref={playerLNameInput} />
                </div>
                <h3>TeamId: {props.teamId}</h3>
                <div className={classes.actions}>
                    <button>Create Player</button>
                </div>
            </form>
    );
};

I want to send data from the form to the mongoDB backend but the data keeps being sent as undefined.

Capture ScreenShoot navigator.mediaDevices.getDisplayMedia

I have this code that makes perfect screenshots. No tabs, no toolbars.
The only problem is the notice at the bottom. View image.

I added a one second delay before capturing. Hide the permissions window, but not the bottom window.

Is there a way to hide that little bottom window?
And by the way, hide the mouse icon.

Highlight the window that should not appear in red.

const capture = async () => {
        const canvas = document.createElement("canvas");
        const context = canvas.getContext("2d");
        const video = document.createElement("video");
      
        try {
          const captureStream = await navigator.mediaDevices.getDisplayMedia();
          video.srcObject = captureStream;
          await new Promise((resolve) => {
            video.onloadedmetadata = resolve;
          });
      
          await new Promise((resolve) => setTimeout(resolve, 1000)); // Esperar 1 segundo
          video.play();
      
          const displayWidth = window.innerWidth;
          const displayHeight = window.innerHeight;
          const screenLeft = window.screenLeft;
          const screenTop = window.screenTop;
          const windowLeft = window.outerWidth - window.innerWidth - screenLeft;
          const windowTop = window.outerHeight - window.innerHeight - screenTop;
      
          canvas.width = displayWidth;
          canvas.height = displayHeight;
          context.drawImage(video, windowLeft, windowTop, displayWidth, displayHeight, 0, 0, displayWidth, displayHeight);
      
          const frame = canvas.toDataURL("image/png");
          captureStream.getTracks().forEach(track => track.stop());
      
          if (window === window.top) {
            const link = document.createElement("a");
            link.href = frame;
            link.download = "screenshot.png";
            link.click();
          } else {
            console.error("Error: La ventana de permisos fue capturada. No se guarda la captura.");
          }
        } catch (err) {
          console.error("Error: " + err);
        }
      };

      capture();

Trying to pass URL variables into an iFrame on GoDaddy-hosted site

we are currently using CognitoForms to host a form on our public-facing website. We have a need to pass a unique field called “barcode” on a per-user basis. I was hoping we could do something like https://ourwebsite.com/client?barcode=921371 but that doesn’t seem to work at all.

After discussing with CognitoForms support, they provided the below script. However, it doesn’t work from any browser. The browser console doesn’t show any notable errors either. Is there something obviously incorrect here?

<iframe src="https://www.cognitoforms.com/f/ourformid/1" style="border:0;width:100%;" height="576"> </iframe>

<script src="https://www.cognitoforms.com/f/iframe.js"></script>

<script>
function getQueryStringParam(parameter) {
var queryString = window.location.search;

var urlParams = new URLSearchParams(queryString);

return urlParams.get(parameter);
}
Cognito.prefill({ "Barcode": getQueryStringParam('Barcode') });
</script>

I tried passing the parameters in different formats including JSON. I have also checked browser debug logs but can’t find any errors – the field simply won’t fill.

How to recreate YouTube video Queue

I have been working on a browser extension which lets you add YouTube notifications to the YouTube video queue. I recreated the fetch requests which occur when adding a video to queue which respond perfectly. I just need help figuring out is how to get the miniplayer to activate. Is this even really possible? Thanks 🙂

I made fetch requests and looked in desktop_polymer.js, I know I am missing something but cannot figure out what.