@@ -33,7 +33,7 @@ document.body.appendChild(openBtn);
3333const 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', {
6464sidebar . 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} ) ;
7073sidebar . 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
73130openBtn . 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 ( ) ;
0 commit comments