CDC Booking Page Reload every 15m

Refresh the page

目前為 2025-04-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         CDC Booking Page Reload every 15m
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  Refresh the page
// @author       afjw
// @match        https://bookingportal.cdc.com.sg/*
// @grant        none
// @license      MIT
// ==/UserScript==

function isTargetPage() {
  return location.href === 'https://bookingportal.cdc.com.sg/NewPortal/Booking/BookingPL.aspx';
}
  // Only activate the reloader if we are on the correct page
const observer = new MutationObserver((mutationsList, observer) => {
  // Your logic to respond to DOM changes
  if (isTargetPage()) {
    setInterval(() => {
      location.reload();
    }, 5 * 60 * 1000); // 5 minutes in milliseconds
  }
});

// Start observing the body (or any other node you care about)
observer.observe(document.body, {
  childList: true,
  subtree: true
});


if (isTargetPage()) {
  (function () {
    setInterval(() => {
      location.reload();
    }, 5 * 60 * 1000); // 5 minutes in milliseconds
  })();
}