@@ -23,7 +23,7 @@ const booksInfo = {
2323 enma_the_immortal : {
2424 properties : {
2525 title : 'Enma the Immortal' ,
26- language : 'English ' ,
26+ language : 'Japanese ' ,
2727 author : 'Fumi Nakamura' ,
2828 } ,
2929 } ,
@@ -65,7 +65,7 @@ const booksInfo = {
6565 the_next_continent : {
6666 properties : {
6767 title : 'The Next Continent' ,
68- language : 'english ' ,
68+ language : 'English ' ,
6969 author : 'Issui Ogawa' ,
7070 } ,
7171 } ,
@@ -79,7 +79,7 @@ const booksInfo = {
7979 after_dark : {
8080 properties : {
8181 title : 'After Dark' ,
82- language : 'japanese ' ,
82+ language : 'Japanese ' ,
8383 author : 'Haruki Murakami' ,
8484 } ,
8585 } ,
@@ -102,14 +102,33 @@ const booksInfo = {
102102// };
103103
104104window . onload = ( ) => {
105+ const quotes = [
106+ 'If you only read the books that everyone else is reading, you can only think what everyone else is thinking. ― Haruki Murakami' ,
107+ 'Memories warm you up from the inside. But they also tear you apart. ― Haruki Murakami' ,
108+ "If you remember me, then I don't care if everyone else forgets. ― Haruki Murakami" ,
109+ "There's no such thing as perfect writing, just like there's no such thing as perfect despair. - Haruki Murakami" ,
110+ 'They were words that came out of nothing, but they seemed to him somehow significant.He muttered them over again. - Yasunari Kawabata' ,
111+ 'Remember the good things; write the bad ones down in here and forget about them.― Kanae Minato' ,
112+ "Just because I've written this book, don't think I've changed. I'm like I was back then, really. - Ryu Murakami" ,
113+ ] ;
114+ console . log ( quotes ) ;
115+ const rand = quotes [ Math . floor ( Math . random ( ) * quotes . length ) ] ;
116+
117+ const quoteSpace = document . querySelector ( '#quoteSpace' ) ;
118+ const quoteDiv = document . createElement ( 'div' ) ;
119+ quoteDiv . innerText = rand ;
120+ quoteSpace . appendChild ( quoteDiv ) ;
121+
105122 const myBookSpot = document . querySelector ( '#bookList' ) ;
106123
107124 const div = document . createElement ( 'div' ) ;
108- div . innerText = "This is a list of Catt's favourite books" ;
125+ div . setAttribute ( 'class' , 'wrapper' ) ;
109126
127+ // eslint-disable-next-line guard-for-in
110128 for ( book in booksInfo ) {
111129 const eachBookDiv = document . createElement ( 'div' ) ;
112130 eachBookDiv . id = book ;
131+ eachBookDiv . setAttribute ( 'class' , 'box' ) ;
113132 const name = document . createElement ( 'h4' ) ;
114133 name . innerText = booksInfo [ book ] . properties . title ;
115134 eachBookDiv . appendChild ( name ) ;
@@ -129,36 +148,39 @@ window.onload = () => {
129148
130149 myBookSpot . appendChild ( div ) ;
131150 }
151+ console . log ( 'loaded' ) ;
152+
153+ const bookImages = [
154+ { memoirs_of_a_geisha : 'book_covers/memoirs_of_a_geisha_img.jpg' } ,
155+ { enma_the_immortal : 'book_covers/enma_the_immortal_img.jpg' } ,
156+ { confessions : 'book_covers/confessions_img.jpg' } ,
157+ { coin_locker_babies : 'book_covers/coin_locker_babies_img.jpg' } ,
158+ { beauty_and_sadness : 'book_covers/beauty_and_sadness_img.jpg' } ,
159+ { house_of_sleeping_beauties : 'book_covers/house_of_sleeping_beauties_img.jpg' } ,
160+ { empress : 'book_covers/empress_img.jpg' } ,
161+ { the_next_continent : 'book_covers/the_next_continent_img.jpg' } ,
162+ { underground : 'book_covers/underground_img.jpg' } ,
163+ { after_dark : 'book_covers/after_dark_img.jpg' } ,
164+ ] ;
165+
166+ // function addBookImages(bookPics) {
167+ // const length = bookPics.length;
168+ // for (let i = 0; i < length; i++) {
169+ // console.log(i);
170+ // // document.querySelector(bookPics.pic)
171+ // }
172+ // }
173+ // addBookImages(bookImages);
174+ // console.log(bookImages);
175+
176+ // eslint-disable-next-line guard-for-in
177+ for ( image in bookImages ) {
178+ const imageID = Object . keys ( bookImages [ image ] ) [ 0 ] ;
179+ const lookFor = document . querySelector ( `#${ imageID } ` ) ;
180+ const picture = document . createElement ( 'IMG' ) ;
181+ picture . src = bookImages [ image ] [ imageID ] ;
182+ lookFor . appendChild ( picture ) ;
183+
184+ console . log ( imageID , lookFor ) ;
185+ }
132186} ;
133- console . log ( 'loaded' ) ;
134-
135- const bookImages = [
136- { memoirs_of_a_geisha : 'book_covers/memoirs_of_a_geisha_img.jpg' } ,
137- { enma_the_immortal : 'book_covers/enma_the_immortal_img.jpg' } ,
138- { confessions : 'book_covers/confessions_img.jpg' } ,
139- { coin_locker_babies : 'book_covers/coin_locker_babies_img.jpg' } ,
140- { beauty_and_sadness : 'book_covers/beauty_and_sadness_img.jpg' } ,
141- { house_of_sleeping_beauties : 'book_covers/house_of_sleeping_beauties_img.jpg' } ,
142- { empress : 'book_covers/empress_img.jpg' } ,
143- { the_next_continent : 'book_covers/the_next_continent_img.jpg' } ,
144- { underground : 'book_covers/underground_img.jpg' } ,
145- { after_dark : 'book_covers/after_dark_img.jpg' } ,
146- ] ;
147-
148- // function addBookImages(bookPics) {
149- // const length = bookPics.length;
150- // for (let i = 0; i < length; i++) {
151- // console.log(i);
152- // // document.querySelector(bookPics.pic)
153- // }
154- // }
155- // addBookImages(bookImages);
156- // console.log(bookImages);
157-
158- for ( image in bookImages ) {
159- const imageID = Object . keys ( bookImages [ image ] ) [ 0 ] ;
160- const queryID = '#' + imageID ;
161- const lookFor = document . querySelector ( queryID ) ;
162-
163- console . log ( imageID , lookFor , queryID , document . querySelector ( '#confessions' ) ) ;
164- }
0 commit comments