@@ -12,10 +12,8 @@ import {
1212 stopAudio ,
1313 createAudio ,
1414 createUserRecipe ,
15- cacheData ,
16- CACHE_NAME_AUDIO ,
1715 audioElement ,
18- alert_message
16+ alert_message ,
1917} from "./js_utilities/functions_and_variables.js" ;
2018
2119import {
@@ -49,7 +47,7 @@ import {
4947 pictureEmailSection ,
5048 previousPage ,
5149 sendToUserInbox ,
52- wrapper
50+ wrapper ,
5351} from "./js_utilities/query_selector.js" ;
5452
5553let currentCameraIndex = 0 ;
@@ -190,25 +188,14 @@ recipeButtons.forEach((button) => {
190188 if ( eventData . image ) {
191189 data . image = eventData . image ;
192190 }
193-
191+
194192 console . log ( "data.audio" , eventData . audio ) ;
195193 console . log ( "data.image" , eventData . image ) ;
196194
197195 if ( data . audio && data . image ) {
196+ createImage ( data ) ;
198197
199- createImage ( data )
200-
201-
202-
203-
204-
205- ///
206-
207- // await cacheData(imageUrl, CACHE_NAME_URL, "image");
208-
209- // const audio_data = createAudio(data.audio);
210- // await cacheData(audio_data, CACHE_NAME_AUDIO, "audio");
211- const { speedBtn, speechBtns } = createTextToSpeech ( data ) ;
198+ const { speedBtn, speechBtns } = createTextToSpeech ( data ) ;
212199
213200 userWantAnotherRecipe . addEventListener ( "click" , ( ) => {
214201 displayElements ( [ headline , allergies , ...recipeButtons , mainElement ] ) ;
@@ -241,7 +228,6 @@ recipeButtons.forEach((button) => {
241228 } ) ;
242229} ) ;
243230
244-
245231function createImage ( param ) {
246232 removeElements ( [ loadingContainer ] ) ;
247233 const imageUrl = param . image . data [ 0 ] . url ;
@@ -259,7 +245,7 @@ function createTextToSpeech(param) {
259245 this . pause ( ) ;
260246 this . currentTime = 0 ;
261247 } ;
262- return { speedBtn, speechBtns } ;
248+ return { speedBtn, speechBtns } ;
263249}
264250
265251// Picture section
@@ -313,7 +299,6 @@ async function initializeCamera() {
313299
314300initializeCamera ( ) ;
315301
316-
317302function capturePhoto ( ) {
318303 context . drawImage ( video , 0 , 0 , 400 , 100 ) ;
319304}
@@ -352,7 +337,6 @@ takePicture.addEventListener("click", () => {
352337// Menu icon toggle
353338const menuIcon = document . querySelector ( ".menu-icon" ) ;
354339
355-
356340menuIcon . addEventListener ( "click" , ( ) => {
357- wrapper . classList . toggle ( "change" ) ;
341+ wrapper . classList . toggle ( "change" ) ;
358342} ) ;
0 commit comments