HARVEY

iPhone working iPhone that can work Google

Kodari AI
KodariToday at 4:07 am 2
GameDevProject
Creates a new game-development project from scratch based on user specifications. The system generates a descriptive project name in PascalCase format and a concise project description highlighting key features and functionality. It establishes the foundational structure for game development, ensuring all components are properly named and documented for immediate implementation.

Created an iPhone-style popup with a live clock and Google search. Search results open in a new Chrome tab.

Kodari can make mistakes. Review important code before using.
Files
manifest.json
popup.css
popup.html
popup.js
Code
4 194
popup.js
const clock = document.getElementById("clock");
const statusTime = document.getElementById("status-time");
const date = document.getElementById("date");

function updateClock() {
  const now = new Date();
  const time = now.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
  clock.textContent = time;
  statusTime.textContent = time;
  date.textContent = now.toLocaleDateString([], {
    weekday: "long",
    month: "long",
    day: "numeric"
  });
}

function openPage(url) {
  chrome.tabs.create({ url }).catch(error => {
    console.error("Failed to open page:", error);
  });
}

document.getElementById("search-form").addEventListener("submit", event => {
  event.preventDefault();
  const query = document.getElementById("query").value.trim();
  if (query) {
    openPage("https://www.google.com/search?q=" + encodeURIComponent(query));
  }
});

document.getElementById("google").addEventListener("click", () => openPage("https://www.google.com/"));
document.getElementById("youtube").addEventListener("click", () => openPage("https://www.youtube.com/"));
document.getElementById("maps").addEventListener("click", () => openPage("https://www.google.com/maps/"));

updateClock();
setInterval(updateClock, 1000);