first commit

master
gtitov 5 years ago
commit 3fc928a282

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<title>Photo voter</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-12 col-sm-10">
<img id="candidate" src="art.jpg" alt="art" class="img-fluid">
<div id="loading" class="text-center m-5" style="display: none;">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
<div class="d-none d-sm-block col-sm-2">
<div class="row mb-1">
<button id="like" type="button" class="btn btn-success btn-lg vote-option">like</button>
</div>
<div class="row mb-1">
<button id="dislike" type="button" class="btn btn-danger btn-lg vote-option">dislike</button>
</div>
<div class="row mb-1">
<button id="next" type="button" class="btn btn-secondary btn-lg vote-option">next</button>
</div>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>

@ -0,0 +1,39 @@
const vote = function(markValue) {
const candidateImage = document.querySelector("#candidate")
candidateImage.style.display = "none"
const loadingDiv = document.querySelector("#loading")
loadingDiv.style.display = "block"
const response = {
photo: candidateImage.src,
mark: markValue
}
// надо отправить в API оценку и отметить, что это фото уже оценено
console.log(response)
// а потом запросить новое фото
candidateImage.src = "photo.jpg"
loadingDiv.style.display = "none"
candidateImage.style.display = "block"
}
document.querySelector("#dislike").onclick = function() {
vote(1)
}
document.querySelector("#like").onclick = function() {
vote(2)
}
document.querySelector("#next").onclick = function() {
candidateImage.src = "photo.jpg"
}
// Get a reference to an element.
const candidateImage = document.querySelector("#candidate")
// Create an instance of Hammer with the reference.
var candidateHammer = new Hammer(candidateImage)
candidateHammer.on('swipeleft', function(ev) {
vote(1)
})
candidateHammer.on('swiperight', function(ev) {
vote(2)
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
Loading…
Cancel
Save