These are the most common questions about Pet Triangle — from browser compatibility to customizing the source.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mr-sunset/pet-triangle/llms.txt
Use this file to discover all available pages before exploring further.
Does Pet Triangle save my pet's state?
Does Pet Triangle save my pet's state?
No. Pet Triangle has no persistence layer. The
#pet-name and #pet-color inputs hold their values only for the lifetime of the current browser tab — closing or refreshing resets them to defaults (empty name, browser-default colour). The action counters (#food-count, #drink-count, #play-count) always display 0 because the event-handler logic has not been implemented yet (see “Why is the counter not incrementing when I click?” below).To add persistence, use the Web Storage API in script.js. Call localStorage.setItem each time a value changes, and read it back with localStorage.getItem inside the DOMContentLoaded callback:Which browsers are supported?
Which browsers are supported?
Any modern browser that supports inline SVG and
<input type="color"> will work. That includes:- Chrome / Chromium (desktop and Android)
- Firefox (desktop and Android)
- Safari (macOS and iOS)
- Edge (Chromium-based)
document.getElementById and document.addEventListener, so compatibility is extremely broad. The ontouchstart="" attribute on <body> enables CSS :active states on iOS Safari.Does it work offline?
Does it work offline?
Yes. Pet Triangle is entirely static and loads no external resources — no CDN scripts, no web fonts, no remote images. Once the three files (
index.html, style.css, script.js) are loaded into the browser, the app works with no network connection.This also means it can be opened directly from the local filesystem via a file:// URL without any local server.How do I change the triangle's shape?
How do I change the triangle's shape?
Edit the SVG draws an equilateral triangle within the
<path> element inside index.html. The current path data:0 0 2048 2048 viewBox. Each M/L command is an absolute coordinate. Change the three L points (and the closing M) to any polygon you like — a square, pentagon, or freeform shape — and the SVG will update immediately on the next page load.The <g transform="matrix(2.443914,0,0,2.443914,-1478.568019,-1478.568019)"> wrapper scales and translates the path into the visible area. If you draw a shape with very different coordinates you may need to adjust or remove this transform.How do I add persistence?
How do I add persistence?
Use the Apply the same pattern to the three counters (
localStorage API inside script.js. The general pattern is:- On every state change, call
localStorage.setItem(key, value). - On page load (inside
DOMContentLoaded), calllocalStorage.getItem(key)and apply the stored value if it exists.
foodCount, drinkCount, playCount).Can I deploy this to a static host?
Can I deploy this to a static host?
Yes. Upload all three files to any static hosting service and they will work immediately — no server-side configuration, no build step, no
Make sure all three files are in the same directory so the relative
package.json.Popular options:| Host | Method |
|---|---|
| GitHub Pages | Push the repo and enable Pages in repository settings |
| Netlify | Drag-and-drop the folder onto the Netlify dashboard |
| Vercel | vercel CLI or import from GitHub — zero config needed |
| Cloudflare Pages | Connect the repo; framework preset set to “None” |
href="style.css" reference in index.html resolves correctly. If you add a <script src="script.js"> tag to wire up the JavaScript, keeping all three files together ensures that reference resolves too.Why is the counter not incrementing when I click?
Why is the counter not incrementing when I click?
The event listener bodies in Repeat the same pattern for
script.js are intentionally empty scaffolding. The element references are all declared, but no logic has been written yet. Clicking a button does nothing until you add a handler yourself.To wire up the feed counter, add this inside the DOMContentLoaded callback:drinkBtn/drinkCount and playBtn/playCount:How do I contribute or fork the project?
How do I contribute or fork the project?
The project has no build tooling, so the contribution workflow is as simple as it gets:
- Fork the repository on GitHub.
- Edit any of the three source files (
index.html,style.css,script.js) directly — in your editor, in the GitHub web UI, or via Codespaces. - Test by opening
index.htmlin a browser (no local server needed). - Open a pull request against the original repo.