124 lines
3.2 KiB
HTML
124 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="/static/css/bulma.min.css">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<style>
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
body {
|
|
font: 16px Arial;
|
|
background-color: black;
|
|
}
|
|
input {
|
|
background-color: #f1f1f1;
|
|
}
|
|
input[type=text] {
|
|
background-color: gray;
|
|
width: 100%;
|
|
}
|
|
input[type=submit] {
|
|
background-color: gray;
|
|
color: black;
|
|
cursor: pointer;
|
|
}
|
|
.winds {
|
|
width: 90%;
|
|
height: 90%;
|
|
text-align: center;
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
margin: auto;
|
|
}
|
|
.buttonclose {
|
|
width: 80px;
|
|
height: 30px;
|
|
color: black;
|
|
background-color: white;
|
|
padding: 0px;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<input class="input is-primary" id="myInput" type="text" placeholder="Поиск" list="tagnameac">
|
|
<datalist id="tagnameac"></datalist>
|
|
</br>
|
|
<div style="display: none;" id="windss" class="winds">
|
|
<button class="buttonclose" onclick="close_full()">X</button>
|
|
</br>
|
|
<img height="90%" id="imagef" src="http://127.0.0.1:5000/hentai/file/full/abb965fb45f2078dc8af89f3319fa71c.jpg"></img>
|
|
</br>
|
|
<button class="buttonclose" onclick="close_full()">X</button>
|
|
</div>
|
|
<div id="imagesr"></div>
|
|
<script>
|
|
var tagBox = document.getElementById("myInput");
|
|
function httpGet(theUrl)
|
|
{
|
|
var xmlHttp = new XMLHttpRequest();
|
|
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
|
|
xmlHttp.send( null );
|
|
return JSON.parse(xmlHttp.responseText);
|
|
}
|
|
function onchange(e){
|
|
var val = e.target.value;
|
|
console.log(val);
|
|
val_pars = val.split(" ");
|
|
val_end = val_pars[val_pars.length - 1];
|
|
url_req = location.origin + "/autoc/" + val_end;
|
|
resp_res = httpGet(url_req)["list"];
|
|
var tagsac = document.getElementById("tagnameac");
|
|
tagsac.innerHTML = '';
|
|
resp_res.forEach(function(item, i, resp_res) {
|
|
var add_elem = document.createElement("option");
|
|
add_elem.value = val.replace(val_end, item);
|
|
tagsac.appendChild(add_elem);
|
|
});
|
|
}
|
|
function search(e){
|
|
if (e.keyCode === 13) {
|
|
var tagsac = document.getElementById("myInput");
|
|
var val = tagsac.value;
|
|
replacec = 1
|
|
while (replacec == 1) {
|
|
val = val.replace(" ", "+");
|
|
if(val.includes(" ")==false) {
|
|
replacec = 0
|
|
}
|
|
}
|
|
url_req = location.origin + "/search/" + val;
|
|
resp_res = httpGet(url_req)["list"];
|
|
console.log(resp_res);
|
|
var imgc = document.getElementById("imagesr");
|
|
imgc.innerHTML = '';
|
|
resp_res.forEach(function(item, i, resp_res) {
|
|
var add_elem_img = document.createElement("img");
|
|
add_elem_img.src = item["url_thumb"];
|
|
add_elem_img.style = "padding: 2px;";
|
|
add_elem_img.setAttribute("onclick", "see_full('"+item["url_full"]+"')");
|
|
imgc.appendChild(add_elem_img);
|
|
});
|
|
}
|
|
}
|
|
tagBox.addEventListener("input", onchange);
|
|
tagBox.addEventListener("keydown", search);
|
|
function see_full(url){
|
|
var tagsac = document.getElementById("imagef");
|
|
tagsac.src = url;
|
|
var fulldata = document.getElementById("windss");
|
|
fulldata.style = "display: block;";
|
|
}
|
|
function close_full(){
|
|
var fulldata = document.getElementById("windss");
|
|
fulldata.style = "display: none;";
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html> |