bitte verwendet nur noch addressen die https beginnen! Siehe wiki https://wiki.mediacube.at/wiki/index.php?title=Repositories#ssh-_vs._https_repository_adressen

alle von MMT haben hier Zugriff. Du willst Deine Freunde von MMA auch dabei haben? Mail mit den usernamen an Brigitte Jellinek

Commit 281219d5 authored by Christoph Mayr's avatar Christoph Mayr

shortened code for sending query and processing results, description can be...

shortened code for sending query and processing results, description can be searched now and all results are shown
parent 3aa4500c
This diff is collapsed.
......@@ -46,48 +46,42 @@ function search(e) {
// })
function sendNameQuery(q){
var query = "q=poke_txt_en:(" + q +")&rows=100" //rows ist nötig, sonst nur 10 results
var query = "q=about_txt_en:(" + q +")&rows=100" //rows ist nötig, sonst nur 10 results
console.log(query);
client.search(query,function(err,obj){
if(err){
console.log(err);
}else{
results = obj.response.docs
if (results.length == 0) {
document.getElementById("results").innerHTML = "No results"
}
for(var i = 0; i < results.length; i++){
let item = document.createElement("p")
results = obj.response.docs
if (results.length == 0) {
document.getElementById("results").innerHTML = "No results"
}
else{
obj.response.docs.forEach(function(entry){
let item = document.createElement("p")
item.innerHTML =
"<li>Id: <strong>" + results[i].id + "</strong></li>" +
"<li>Name: <strong>" + results[i].poke_txt_en + "</strong></li>" +
"<li>Gen: " + results[i].gen_txt_en + "</li>" +
"<li>HP: " + results[i].maxHP_txt_en + "</li>" +
"<li>Types:</li>" +
"<ul id='test'></ul>"
item.innerHTML =
"<li>Id: <strong>" + entry.id + "</strong></li>" +
"<li>Name: <strong>" + entry.poke_txt_en + "</strong></li>" +
"<li>Gen: " + entry.gen_txt_en + "</li>" +
"<li>MaxHP: " + entry.maxHP_txt_en + "</li>" +
"<li>Types:</li>" +
`<ul id='${entry.id}'></ul>`;
document.getElementById('results').appendChild(item)
document.getElementById('results').appendChild(item)
entry.types_features.forEach(function(type){
let item3 = document.createElement("li")
item3.innerHTML = type;
document.getElementById(entry.id).appendChild(item3)
})
let types = results[i].types_features
console.log(types)
// let item2 = document.createElement("ul")
// item2.setAttribute("id", "test");
// document.getElementById('results').appendChild(item2)
for (var i = 0; i < types.length; i++) {
let item3 = document.createElement("li")
// console.log(types[i])
item3.innerHTML = types[i];
document.getElementById('test').appendChild(item3)
// item2.appendChild(item3);
}
console.log(entry);
})
}
}
console.log(obj);
}
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment