ወደ ትምህርቱ ይመለሱ

የመጀመሪያው የሚሠራ ፋይል

public/app.js

ኮዱ እና የሚሠሩ ምሳሌ ገጾች የመጀመሪያ መለያዎቻቸውንና የምሳሌ ጽሑፋቸውን ይይዛሉ። ትምህርቱ እና የፋይል መመሪያዎች በእርስዎ ቋንቋ ያብራሯቸዋል።

import { BOOKING_URL } from "./config.js";
const a = document.querySelector("#booking"),
  status = document.querySelector("[role=status]");
try {
  const u = new URL(BOOKING_URL);
  if (
    u.protocol !== "https:" ||
    u.hostname !== "calendly.com" ||
    u.pathname.includes("YOUR-")
  )
    throw Error();
  a.href = u.href;
  a.hidden = false;
  status.textContent =
    "Booking opens on Calendly. Check the time zone before confirming.";
} catch {
  status.textContent = "Set your own public event link in config.js first.";
}