This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. Ported for vimjoyer.com from the Firefox 157.0 New Tab page: https://searchfox.org/mozilla-release/source/browser/extensions/newtab import { For } from "solid-js"; import wikipediaIcon from "../../assets/firefox/tippytop-wikipedia-org@2x.png"; import youtubeIcon from "../../assets/firefox/tippytop-youtube-com@2x.png"; import redditIcon from "../../assets/firefox/tippytop-reddit-com@2x.png"; import addonsIcon from "../../assets/firefox/tippytop-addons-mozilla@2x.png"; import "./firefox-newtab.css"; import { fill } from "../sim/fact.ts"; import { NEW_TAB, NEW_TAB_SHORTCUTS, NEW_TAB_SITE_MENU } from "../sim/facts/firefox.ts"; const [LOGO, SEARCH, SHORTCUTS, MENU, ADD_SHORTCUT, CUSTOMIZE] = NEW_TAB.text; const SHORTCUT = NEW_TAB_SHORTCUTS.text.map(line => line.split(" https://")[0] ?? line); export type FirefoxNewTabSearch = "idle" | "focused" | "disabled"; type FirefoxNewTabProps = { onSearchFocus: () => void; onUnavailable: (what: string) => void; search?: FirefoxNewTabSearch; }; const FIREFOX_NEWTAB_SHORTCUTS = [ { title: SHORTCUT[0], url: "https://www.wikipedia.org/", icon: wikipediaIcon.src, fallback: "W" }, { title: SHORTCUT[1], url: "https://www.youtube.com/", icon: youtubeIcon.src, fallback: "Y" }, { title: SHORTCUT[2], url: "https://www.reddit.com/", icon: redditIcon.src, fallback: "R" }, { title: SHORTCUT[3], url: "https://addons.mozilla.org/", icon: addonsIcon.src, fallback: "A" }, ] as const; const FIREFOX_NEWTAB_TEXT = { logo: LOGO, search: SEARCH, shortcuts: SHORTCUTS, menu: MENU, menuFor: (title: string) => fill(NEW_TAB_SITE_MENU, { title }), addShortcut: ADD_SHORTCUT, customize: CUSTOMIZE, } as const; export default function FirefoxNewTab(props: FirefoxNewTabProps) { const unavailable = (what: string) => (event: MouseEvent) => { event.preventDefault(); props.onUnavailable(what); }; return (