@ -94,35 +94,21 @@ function getResponse(keyword) {
return {
return {
screen : "I'm not sure how to respond. Change your approach." ,
screen : "I'm not sure how to respond. Change your approach." ,
paper : "Unknown" ,
paper : "Unknown" ,
info _layer : "Unknown" ,
} ;
} ;
}
}
}
}
function handleInput ( ) {
function handleInput ( ) {
var userInput = document . getElementById ( "user_input" ) . value . trim ( ) ;
var userInput = document . getElementById ( "user_input" ) . value . trim ( ) ;
var response = getResponse ( userInput ) ;
var response = getResponse ( userInput ) ;
document . getElementById ( "output" ) . innerText = response . screen ;
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 ) ;
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 ( "Paper: " + userInput ) ;
console . log ( "info_layer : " + response . info _layer ) ; // Log info_layer content
console . log ( "info_layer" + userInput ) ;
}
}
function printing ( input ) {
function printing ( input ) {
fetch ( "https://hub.xpub.nl/chopchop/cgi-bin/table.cgi?input=" + input ) ;
fetch ( "https://hub.xpub.nl/chopchop/cgi-bin/table.cgi?input=" + input ) ;
}
}