File tree Expand file tree Collapse file tree 3 files changed +32
-16
lines changed Expand file tree Collapse file tree 3 files changed +32
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Version History
4
4
5
+ ### v0.0.11
6
+
7
+ - Added a fix for the "Mixed content" error from the quotable API. Changed it to
8
+ The Quotes Hub.
9
+ - Added extra interactions for for the gibberish chat.
10
+
5
11
### v0.0.10
6
12
7
13
- Added the ` <GibberishChat/> ` island.
Original file line number Diff line number Diff line change @@ -81,26 +81,35 @@ export default function () {
81
81
) ) }
82
82
</ div >
83
83
< div class = "p-1-2 bg-base-200" >
84
- < div class = "join" >
84
+ < form
85
+ class = "join"
86
+ onSubmit = { ( ev ) => {
87
+ ev . preventDefault ( ) ;
88
+ const input = document
89
+ . getElementById ( "gibberish-input" ) as HTMLInputElement ;
90
+
91
+ setMessages ( [ {
92
+ user : 2 ,
93
+ content : input . value ,
94
+ } , ...messages ] ) ;
95
+
96
+ input . value = "" ;
97
+ } }
98
+ >
85
99
< input
86
100
id = "gibberish-input"
87
101
class = "join-item input input-sm"
88
102
type = "text"
103
+ tabindex = { 0 }
89
104
/>
90
105
< button
91
- type = "button "
106
+ type = "submit "
92
107
class = "join-item btn btn-sm"
93
- onClick = { ( ) =>
94
- setMessages ( [ {
95
- user : 2 ,
96
- content : ( document . getElementById (
97
- "gibberish-input" ,
98
- ) as HTMLInputElement ) . value ,
99
- } , ...messages ] ) }
108
+ tabindex = { 0 }
100
109
>
101
110
Send
102
111
</ button >
103
- </ div >
112
+ </ form >
104
113
</ div >
105
114
</ div >
106
115
) ;
Original file line number Diff line number Diff line change 1
1
import { useState } from "preact/hooks" ;
2
2
import { handleKeyboard , Key } from "@carcajada/teclas" ;
3
3
4
- const quotableUrl = "http ://api.quotable.io/ random" ;
4
+ const quoteUrl = "https ://thequoteshub.com/api/ random-quote " ;
5
5
6
6
async function fetchQuote ( ) {
7
- const res = await ( await fetch ( quotableUrl ) )
7
+ const res = await ( await fetch ( quoteUrl ) )
8
8
. json ( ) ;
9
- return `${ res . content } - ${ res . author } ` ;
9
+ console . log ( res ) ;
10
+ return `${ res . text } - ${ res . author } ` ;
10
11
}
11
12
12
13
export default function ( ) {
@@ -20,9 +21,9 @@ export default function () {
20
21
< h2 class = "mb-1-4" > Random quote generator</ h2 >
21
22
< p class = "mb-1-1" >
22
23
This feed is brought to you by the{ " " }
23
- < a href = "quotable.io" > Quotable </ a > public API of random quotes: { " " }
24
- < code > { quotableUrl } </ code > click on quotes or press the { " " }
25
- < kbd class = "kbd" > Enter</ kbd > { " " }
24
+ < a href = "https://thequoteshub.com" > The Quotes Hub </ a > { " " }
25
+ public API of random quotes: < code > /api/random-quote </ code > { " " }
26
+ click on a quote or press the < kbd class = "kbd" > Enter</ kbd > { " " }
26
27
key when focusing on a quote to remove it.
27
28
</ p >
28
29
</ div >
You can’t perform that action at this time.
0 commit comments