Remote Work-Friendly Cafés Locator

Remote Work-Friendly Cafés Locator

Find the perfect spot for your next remote work session.

Customize Café Data

Edit the JSON data for the cafés below. Click "Save Data" to apply changes and update the city list.

${cafe.notes}

`; cafesListDiv.appendChild(cafeCard); }); } function downloadPDF() { const { jsPDF } = window.jspdf; const content = document.getElementById('pdf-content'); if (!content) return; html2canvas(content, { scale: 2 }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF('p', 'mm', 'a4'); const pdfWidth = pdf.internal.pageSize.getWidth(); const canvasWidth = canvas.width; const canvasHeight = canvas.height; const ratio = canvasWidth / canvasHeight; const width = pdfWidth - 20; const height = width / ratio; pdf.addImage(imgData, 'PNG', 10, 10, width, height); pdf.save(`Remote-Work-Cafes-${citySelect.value}.pdf`); }); } function saveData() { try { const newData = JSON.parse(cafeDataEditor.value); if (typeof newData === 'object' && newData !== null) { cafeData = newData; populateCities(); // Repopulate dropdown with potentially new cities alert('Café data saved successfully!'); } else { throw new Error("Data is not a valid object."); } } catch (e) { showError('Invalid JSON format. Please check the data structure.'); } } function showError(message) { if (errorText) errorText.textContent = message; if (errorMessageDiv) errorMessageDiv.classList.remove('hidden'); } function hideError() { if (errorMessageDiv) errorMessageDiv.classList.add('hidden'); } // --- EVENT LISTENERS --- tabs.forEach(tab => { if (tab) tab.addEventListener('click', () => goToTab(tab.dataset.tab)); }); if (findCafesBtn) findCafesBtn.addEventListener('click', findCafes); if (downloadPdfBtn) downloadPdfBtn.addEventListener('click', downloadPDF); if (saveCafeDataBtn) saveCafeDataBtn.addEventListener('click', saveData); });
Scroll to Top