// script.js // 1️⃣ Your Mapbox access token mapboxgl.accessToken = 'pk.eyJ1IjoiY2FiYmJ5eSIsImEiOiJjbWRpYzY1MGgwYzA5Mm1xM25udDUzbGtpIn0.RX6zv4VI6r2vpj7IWidz0w'; // 2️⃣ Initialize the map zoomed fully out (globe‑like) const map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/streets-v12', center: [0, 0], zoom: 1, attributionControl: false }); // 3️⃣ Define your companies ([lat, lng], zoom, imageUrl, description) const companies = [ { id: 'overview', name: 'Overview', coords: [40.14010599415405, -107.69483342077913], zoom: 3, imageUrl: 'images/wip.jpg', description: `
Use the controls in the top left corner to jump to a spot!
` }, { id: 'tancha', name: 'Tan‑Cha', coords: [37.325382569107695, -122.01149036275054], zoom: 9, imageUrl: 'images/tancha.jpg', description: `Wip.
` }, { id: 'pokehouse', name: 'Poke House', coords: [37.301113384436285, -121.9493462690826], zoom: 9, imageUrl: 'images/wip.jpg', description: `Wip.
` }, { id: 'nanobase', name: 'NanoBase', coords: [34.68104506798117, 135.49167196036512], zoom: 9, imageUrl: 'images/work.jpg', description: `Developed automated payroll processing scripts in Python, reducing errors by 85%.
NanoBase Blog ` }, { id: 'lanner', name: 'Lanner Electronics', coords: [43.69824981965482, -79.62570806485385], zoom: 9, imageUrl: 'images/wip.jpg', description: `Wip.
` } ]; // 4️⃣ Populate the company list const listEl = document.getElementById('company-list'); companies.forEach((company, idx) => { const btn = document.createElement('button'); btn.textContent = company.name; btn.id = company.id; btn.addEventListener('click', () => selectCompany(idx)); listEl.appendChild(btn); }); // Holder for mapboxgl.Marker instances const markers = []; // Reference to the .map-wrapper for our fixed popups const mapWrapper = document.querySelector('.map-wrapper'); /** * Renders a fixed-position popup (does not move with the map) */ function showFixedPopup(company, [lng, lat]) { // Remove any existing fixed popups document.querySelectorAll('.fixed-popup').forEach(el => el.remove()); // Build the popup element const popupEl = document.createElement('div'); popupEl.className = 'fixed-popup'; popupEl.innerHTML = `