diff --git a/CodeSnippetExtension/parinaB/README.md b/CodeSnippetExtension/parinaB/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/CodeSnippetExtension/parinaB/manifest.json b/CodeSnippetExtension/parinaB/manifest.json new file mode 100644 index 000000000..7d289d620 --- /dev/null +++ b/CodeSnippetExtension/parinaB/manifest.json @@ -0,0 +1,12 @@ +{ + "manifest_version": 3, + "name": "Code Snippet Saver", + "version": "1.0", + "description": "Save, search and manage your favorite code snippets instantly!", + "action": { + "default_popup": "popup.html", + "default_title": "Code Snippet Saver" + }, + + "permissions": ["storage"] +} \ No newline at end of file diff --git a/CodeSnippetExtension/parinaB/popup.html b/CodeSnippetExtension/parinaB/popup.html new file mode 100644 index 000000000..4f4401b81 --- /dev/null +++ b/CodeSnippetExtension/parinaB/popup.html @@ -0,0 +1,24 @@ + + + + + + Code Snippet Saver + + + +
+

Code Snippet Saver

+ + + + + + + + +
+ + + + \ No newline at end of file diff --git a/CodeSnippetExtension/parinaB/popup.js b/CodeSnippetExtension/parinaB/popup.js new file mode 100644 index 000000000..532e0b3a8 --- /dev/null +++ b/CodeSnippetExtension/parinaB/popup.js @@ -0,0 +1,45 @@ +const titleInp = document.getElementById('title'); +const codeInp = document.getElementById('code'); +const saveBtn = document.getElementById('save'); +const searchInp = document.getElementById('search'); +const list = document.getElementById('snippets'); + +function render(filter = '') { + chrome.storage.sync.get(null, items => { + list.innerHTML = ''; + Object.keys(items) + .filter(key => key.toLowerCase().includes(filter.toLowerCase())) + .reverse() + .forEach(key => { + const data = items[key]; + const li = document.createElement('li'); + li.innerHTML = ` + ${key} + +
${data.code}
+ Saved: ${new Date(data.time).toLocaleString()} + `; + li.querySelector('.delete').onclick = () => { + chrome.storage.sync.remove(key, () => render(searchInp.value)); + }; + list.appendChild(li); + }); + }); +} + +saveBtn.onclick = () => { + const title = titleInp.value.trim(); + const code = codeInp.value.trim(); + if (!title || !code) return alert("Please fill both title and code!"); + + chrome.storage.sync.set({ + [title]: { code, time: Date.now() } + }, () => { + titleInp.value = ''; + codeInp.value = ''; + render(searchInp.value); + }); +}; + +searchInp.oninput = () => render(searchInp.value); +render(); \ No newline at end of file diff --git a/CodeSnippetExtension/parinaB/screenshot.png b/CodeSnippetExtension/parinaB/screenshot.png new file mode 100644 index 000000000..d7d8f5c61 Binary files /dev/null and b/CodeSnippetExtension/parinaB/screenshot.png differ diff --git a/CodeSnippetExtension/parinaB/style.css b/CodeSnippetExtension/parinaB/style.css new file mode 100644 index 000000000..f007b6003 --- /dev/null +++ b/CodeSnippetExtension/parinaB/style.css @@ -0,0 +1,69 @@ +* { box-sizing: border-box; margin: 0; padding: 0; } +body { + font-family: system-ui, sans-serif; + width: 380px; + background: #0f0f1e; + color: #e0e0e0; +} +.container { padding: 16px; } +h2 { + text-align: center; + margin-bottom: 16px; + color: #00d0ff; +} +input, textarea, button { + width: 100%; + padding: 10px; + margin: 8px 0; + border: none; + border-radius: 8px; + font-size: 14px; +} +input, textarea { + background: #16213e; + color: #fff; +} +button { + background: #00d0ff; + color: #000; + font-weight: bold; + cursor: pointer; +} +button:hover { background: #00a8cc; } +.search { margin: 16px 0 8px; } +ul { + list-style: none; + max-height: 420px; + overflow-y: auto; + padding-right: 8px; +} +li { + background: #16213e; + padding: 12px; + margin: 8px 0; + border-radius: 8px; + position: relative; +} +.code { + background: #0d0d1a; + padding: 10px; + border-radius: 6px; + margin: 8px 0; + white-space: pre-wrap; + font-family: 'Courier New', monospace; + font-size: 12px; + color: #8ff0a4; +} +.delete { + position: absolute; + top: 8px; + right: 8px; + background: #ff4444; + color: white; + border: none; + width: 26px; + height: 26px; + border-radius: 50%; + cursor: pointer; + font-size: 16px; +} \ No newline at end of file