@ -94,23 +94,35 @@ function getResponse(keyword) {
return {
screen : "I'm not sure how to respond. Change your approach." ,
paper : "Unknown" ,
info _layer : "Unknown" ,
} ;
}
}
function handleInput ( ) {
var userInput = document . getElementById ( "user_input" ) . value . trim ( ) ;
var response = getResponse ( userInput ) ;
document . getElementById ( "output" ) . innerText = response . screen ;
document . querySelector ( ".info_layer" ) . innerText = response . info _layer ; // Update info_layer content
document . querySelector ( "h1" ) . innerText = userInput ; // Update h1 text to user input
document . querySelector ( "h1" ) . className = "response-heading" ; // Assign suitable class to h1
printing ( response . paper ) ;
// Toggle flip-card visibility
var flipCard = document . querySelector ( ".flip-card" ) ;
if ( userInput ) {
flipCard . classList . add ( "visible" ) ;
} else {
flipCard . classList . remove ( "visible" ) ;
}
console . log ( "Paper: " + userInput ) ;
console . log ( "info_layer" + userInput ) ;
console . log ( "info_layer : " + response . info _layer ) ; // Log info_layer content
}
function printing ( input ) {
fetch ( "https://hub.xpub.nl/chopchop/cgi-bin/table.cgi?input=" + input ) ;
}
printing ( "test test test" ) ;