Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
874 B
3
Indexable
Never
function sleep (time) {
  return new Promise((resolve) => setTimeout(resolve, time));
}

const refreshInterval = setInterval(() => {
    let refreshDone = false
          sleep(500).then(() => {
  const buySection = document.querySelectorAll('.js-event-listing-buy');
  if (buySection && buySection.length != 0) {
    console.log('Znaleziono sekcję js-event-listing-buy:', buySection);
    clearInterval(refreshInterval);
    // szukanie elementu "Bilety" wewnątrz diva i kliknięcie
    const ticketLink = buySection[0].querySelector('a');
    if (ticketLink) {
      console.log('Znaleziono link do biletów:', ticketLink);
      ticketLink.click();
     refreshDone = true
    }
  } else if (refreshDone == false){
    console.log('Nie znaleziono sekcji js-event-listing-buy. Odświeżanie...');
    location.reload();
  }
});
          }, 1000);