diff --git a/submissions/Places to Visit Wishlist/manifest.json b/submissions/Places to Visit Wishlist/manifest.json new file mode 100644 index 00000000..1c53650f --- /dev/null +++ b/submissions/Places to Visit Wishlist/manifest.json @@ -0,0 +1,16 @@ +{ + "manifest_version": 3, + "name": "Places to Visit Wishlist", + "version": "1.0", + "description": "Save and manage a wishlist of places you want to visit.", + "action": { + "default_popup": "popup.html", + "default_icon": "icon.png" + }, + "permissions": ["storage"], + "icons": { + "16": "icon.png", + "48": "icon.png", + "128": "icon.png" + } +} diff --git a/submissions/Places to Visit Wishlist/popup.css b/submissions/Places to Visit Wishlist/popup.css new file mode 100644 index 00000000..982a728f --- /dev/null +++ b/submissions/Places to Visit Wishlist/popup.css @@ -0,0 +1,36 @@ +body { + width: 300px; + font-family: Arial, sans-serif; + padding: 10px; +} + +h1 { + font-size: 18px; + text-align: center; +} + +input { + width: 70%; + padding: 5px; + margin-right: 5px; +} + +button { + padding: 5px 10px; +} + +ul { + list-style-type: none; + padding: 0; +} + +li { + display: flex; + justify-content: space-between; + padding: 5px 0; +} + +.delete-btn { + color: red; + cursor: pointer; +} diff --git a/submissions/Places to Visit Wishlist/popup.html b/submissions/Places to Visit Wishlist/popup.html new file mode 100644 index 00000000..585fd1cb --- /dev/null +++ b/submissions/Places to Visit Wishlist/popup.html @@ -0,0 +1,15 @@ + + + + Places Wishlist + + + +

Places Wishlist

+ + + + + + + diff --git a/submissions/Places to Visit Wishlist/popup.js b/submissions/Places to Visit Wishlist/popup.js new file mode 100644 index 00000000..abe755b9 --- /dev/null +++ b/submissions/Places to Visit Wishlist/popup.js @@ -0,0 +1,44 @@ +document.addEventListener('DOMContentLoaded', () => { + const placeInput = document.getElementById('placeInput'); + const addButton = document.getElementById('addButton'); + const wishlist = document.getElementById('wishlist'); + + function renderList(places) { + wishlist.innerHTML = ''; + places.forEach((place, index) => { + const li = document.createElement('li'); + li.textContent = place; + + const deleteBtn = document.createElement('span'); + deleteBtn.textContent = '❌'; + deleteBtn.className = 'delete-btn'; + deleteBtn.addEventListener('click', () => { + places.splice(index, 1); + chrome.storage.sync.set({ places }); + renderList(places); + }); + + li.appendChild(deleteBtn); + wishlist.appendChild(li); + }); + } + + chrome.storage.sync.get(['places'], (result) => { + const places = result.places || []; + renderList(places); + }); + + addButton.addEventListener('click', () => { + const newPlace = placeInput.value.trim(); + if (newPlace) { + chrome.storage.sync.get(['places'], (result) => { + const places = result.places || []; + places.push(newPlace); + chrome.storage.sync.set({ places }, () => { + renderList(places); + placeInput.value = ''; + }); + }); + } + }); +});