Skip to content

Commit 9718463

Browse files
committed
added notes in side bar
1 parent 5bf3ace commit 9718463

7 files changed

Lines changed: 67 additions & 8 deletions

File tree

dist/content.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/content.js.LICENSE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

dist/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "I Notes",
4-
"version": "1.6.1",
4+
"version": "1.6.9",
55
"description": "i Notes is a lightweight, easy-to-use extension for taking quick notes, saving developer commands",
66
"permissions": [
77
"storage",

dist/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!doctype html><html><head><title>i Notes</title><link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet"/><link rel="stylesheet" href="popup.css"/><script defer="defer" src="popup.js"></script></head><body data-size="small"><div id="popup-target"></div></body></html>
1+
<!doctype html><html><head><title>i Notes</title><link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet"/><script defer="defer" src="popup.js"></script></head><body data-size="small"><div id="popup-target"></div></body></html>

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "I Notes",
4-
"version": "1.6.1",
4+
"version": "1.6.9",
55
"description": "i Notes is a lightweight, easy-to-use extension for taking quick notes, saving developer commands",
66
"permissions": [
77
"storage",

src/content.js

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ document.body.appendChild(openBtn);
3333
const sidebar = createElement('div', {
3434
position: 'fixed',
3535
top: '0',
36-
right: '-300px',
36+
right: '-400px',
3737
width: '300px',
3838
height: '100vh',
3939
display: 'none', // Initially hidden
@@ -64,11 +64,68 @@ const closeBtn = createElement('button', {
6464
sidebar.appendChild(closeBtn);
6565

6666
// Content
67-
const content = createElement('div', {}, {
68-
innerHTML: '<p>Coming Soon</p>'
67+
const content = createElement('h3', {
68+
marginBottom: '10px',
69+
color: '#684993'
70+
}, {
71+
innerText: 'i Notes'
6972
});
7073
sidebar.appendChild(content);
7174

75+
76+
// Notes list container
77+
const notesList = createElement('ul', {
78+
listStyle: 'none',
79+
padding: '0',
80+
margin: '0'
81+
}, {
82+
id: 'notes-list'
83+
});
84+
sidebar.appendChild(notesList);
85+
86+
// Function to load notes from Chrome storage
87+
function loadNotes() {
88+
if (typeof chrome !== 'undefined' && chrome.storage) {
89+
chrome.storage.local.get(["notes"], (result) => {
90+
if (result.notes) {
91+
displayNotes(result.notes);
92+
}
93+
});
94+
}
95+
}
96+
97+
// Function to display notes in the list
98+
function displayNotes(notes) {
99+
notesList.innerHTML = '';
100+
101+
if (notes.length === 0) {
102+
const emptyMsg = createElement('li', {
103+
padding: '10px',
104+
textAlign: 'center',
105+
color: '#666',
106+
fontStyle: 'italic'
107+
}, {
108+
innerText: 'No notes yet'
109+
});
110+
notesList.appendChild(emptyMsg);
111+
return;
112+
}
113+
114+
notes.forEach(note => {
115+
const noteText = createElement('li', {
116+
fontSize: '14px',
117+
lineHeight: '1.4',
118+
marginBottom: '5px',
119+
wordWrap: 'break-word'
120+
}, {
121+
innerText: note.text
122+
});
123+
124+
sidebar.appendChild(noteText);
125+
});
126+
}
127+
128+
72129
// Toggle logic
73130
openBtn.addEventListener('click', () => {
74131
sidebar.style.display = 'block';
@@ -80,3 +137,5 @@ closeBtn.addEventListener('click', () => {
80137
sidebar.style.display = 'none';
81138
}, 300);
82139
});
140+
141+
loadNotes();

src/popup.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<title>i Notes</title>
66
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet"/>
77
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet"/>
8-
<link rel="stylesheet" href="popup.css" />
98
</head>
109
<body data-size="small">
1110
<div id="popup-target"></div>

0 commit comments

Comments
 (0)