File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,7 +58,6 @@ window.addEventListener("load", function () {
5858 const leaderboardCtx = document . querySelector ( "#leaderboard-ctx" ) ;
5959
6060 const newNode = this . document . createElement ( "p" ) ;
61- const nameFromLs = this . localStorage . getItem ( LOCAL_STORAGE_USERNAME_KEY ) ;
6261 newNode . innerHTML = getNameButtonText ( ) ;
6362 newNode . addEventListener ( "click" , leaderboardNamePrompt ) ;
6463 newNode . id = "leaderboard-ctx-name" ;
Original file line number Diff line number Diff line change 8282 < script src ="solver.js "> </ script >
8383 < script src ="draggables.js "> </ script >
8484 < script src ="desktop.js "> </ script >
85+ < script src ="wisdom.js "> </ script >
8586
8687 < div class ="selection-box "> </ div >
8788
@@ -200,7 +201,7 @@ <h2 name="np-search">Search</h2>
200201 < h2 name ="np-help "> Help</ h2 >
201202 </ div >
202203 </ div >
203- < textarea > hello vro </ textarea >
204+ < textarea id =" notebox-text " > </ textarea >
204205 </ div >
205206
206207 < div class ="context-menu ">
@@ -269,6 +270,10 @@ <h2 name="np-help">Help</h2>
269270 </ div >
270271 < hr />
271272 </ div >
273+
274+ < div name ="np-file " onclick ="applyWisdomToNotepad() ">
275+ < p > Restore Daily Wisdom</ p >
276+ </ div >
272277 </ div >
273278
274279 < script type ="text/javascript ">
Original file line number Diff line number Diff line change 1+ let wisdom = "" ;
2+
3+ const loadWisdom = async ( ) => {
4+ wisdom = await getDailyWisdom ( ) ;
5+ applyWisdomToNotepad ( ) ;
6+ } ;
7+
8+ const applyWisdomToNotepad = ( ) => {
9+ const textarea = document . getElementById ( "notebox-text" ) ;
10+ textarea . innerHTML = wisdom ;
11+ textarea . value = wisdom ;
12+ } ;
13+
14+ const getDailyWisdom = async ( ) => {
15+ const results = await fetch ( `${ SERVER_URL } /wisdoms/today` ) ;
16+
17+ return await results . text ( ) ;
18+ } ;
19+
20+ loadWisdom ( ) ;
You can’t perform that action at this time.
0 commit comments