-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewer.html
108 lines (90 loc) · 4.31 KB
/
viewer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="icon.png"/>
<title>Image Atheneum</title>
<link type="text/css" rel="stylesheet" href="main.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bungee+Spice&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
async function createImages() {
try {
$(".topsection").toggleClass("up");
$(".bg").toggleClass("up");
console.log("Grabbing images...")
document.getElementById('NewImages').innerHTML = "<h1>Grabbing images...</h1> <div class='loader4'><span></span><span></span><span></span><span></span></div>"
engine = document.getElementById("engine").value
amount = document.getElementById("amount").value
search = document.getElementById("searchBar").value
query = engine + "///" + amount + "///" + search
url="http://127.0.0.1:8080/" + query
const response = await fetch(url);
var images = await response.json();
//document.getElementById('NewImages').innerHTML = "<h1>You are viewing "+amount+" images of<br>"+search+"<br>on "+engine+"</h1>"
document.getElementById('NewImages').innerHTML =""
console.log(images);
for (var image of images) {
var img = document.createElement('img');
img.src = image;
img.innerHTML = "<center><div class='img-text'>Go To Website<br>Download Full Image</div></center>";
// img.height = 200
document.getElementById('NewImages').appendChild(img);
await new Promise(resolve => setTimeout(resolve, 30));
}
} catch(error) {
document.getElementById('NewImages').innerHTML = "<h1>An error occurred while trying to fetch: <br>'"+error.message+"'</h1>"
}
}
</script>
</head>
<body style="text-align: center; font-family: 'Bungee Spice', cursive;">
<div class="bg" style="background-image: url('https://picsum.photos/1920/1080.jpg')"></div>
<section class="topsection" >
<div id="ts"></div>
<input id="searchBar" onchange="createImages()" placeholder="What would you like to see?"></input>
<br><br>
<center><nav role="navigation" id="nav">
<div id="menuToggle" >
<input type="checkbox" />
<span style="mix-blend-mode: difference"></span>
<span style="mix-blend-mode: difference"></span>
<span style="mix-blend-mode: difference"></span>
<ul id="menu" >
<div style="margin-left: -40px;">
<br><br>
<p>Filters</p>
<select id="engine">
<option value="google">Search Engine</option>
<option value="mix">Mix</option>
<option value="google">Google</option>
<option value="bing">Bing</option>
<option value="duckduckgo">DuckDuckGo</option>
<option value="yahoo">Yahoo!</option>
</select>
<br><br>
<select id="imgtype">
<option value="df">Image Type</option>
<option value="df">Default</option>
<option value="tb">Transparent Background</option>
<option value="wl">Wallpaper</option>
<option value="mwl">Mobile Wallpaper</option>
</select>
<input type="number" value="60" id="amount" min="1" max="100">
</div>
</ul>
</div>
</nav></center>
<p></p>
</section>
<section id="main-sec">
<div id="NewImages" style="z-index: 20;width:auto;height:auto;">
<!-- <a href="https://i.ytimg.com/vi/O-xJs-fNCyI/maxresdefault.jpg"><img src="https://i.ytimg.com/vi/O-xJs-fNCyI/maxresdefault.jpg" height="200"></a> -->
</div>
</section>
</body>
</html>