Initial commit.
This commit is contained in:
211
template/add.html
Normal file
211
template/add.html
Normal file
@@ -0,0 +1,211 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Basic Page Needs
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8" />
|
||||
<title>OpenMovieDB - Bookshelf</title>
|
||||
<meta name="description" content="OpenMovieDB - Bookshelf" />
|
||||
<meta name="author" content="TheGreydiamond" />
|
||||
|
||||
<!-- Mobile Specific Metas
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- FONT
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link
|
||||
href="//fonts.googleapis.com/css?family=Raleway:400,300,600"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="css/normalize.css" />
|
||||
<link rel="stylesheet" href="css/skeleton.css" />
|
||||
<style>
|
||||
|
||||
/* In order to place the tracking correctly */
|
||||
canvas.drawing, canvas.drawingBuffer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<!-- Favicon
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="icon" type="image/png" href="images/favicon.png" />
|
||||
<script src="https://kit.fontawesome.com/d7b80a780b.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.rawgit.com/serratus/quaggaJS/0420d5e0/dist/quagga.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="one-half column" style="margin-top: 15%" id="mainCont">
|
||||
<h4>OpenMovieDB - Add a new movie</h4>
|
||||
<!-- Div to show the scanner -->
|
||||
<% if(it.isDisplay == true) { %>
|
||||
<%= it.titleByAPI %><br>
|
||||
<%= it.id %><br>
|
||||
<img src="<%= it.cover %>" alt="Cover image" style="height: 200px;"></img><br>
|
||||
<button onclick="saveToLibary()"> Add to libary</button>
|
||||
<% } else{ %>
|
||||
<div id="scanner-container"></div>
|
||||
<input type="button" id="btn" value="Start/Stop the scanner" />
|
||||
<div id="currentEAN">EAN: Waiting for valid EAN...</div>
|
||||
<button onclick="sendEanConvRequest()" disabled id="searchBtn"> <i class="fas fa-search"></i>Search</button>
|
||||
<button onclick="window.location.href = '/'"><i class="fas fa-home"></i> Back to home</button>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Include the image-diff library -->
|
||||
|
||||
<script>
|
||||
setTimeout(function(){
|
||||
document.getElementById("btn").style.backgroundColor = "rgba(255, 0, 0, 0.5)";
|
||||
document.getElementById("searchBtn").style.backgroundColor = "rgba(10, 10, 10, 0.5);"
|
||||
}, 20)
|
||||
|
||||
var _scannerIsRunning = false;
|
||||
|
||||
function startScanner() {
|
||||
Quagga.init({
|
||||
inputStream: {
|
||||
name: "Live",
|
||||
type: "LiveStream",
|
||||
target: document.querySelector('#scanner-container'),
|
||||
constraints: {
|
||||
width: 480,
|
||||
height: 320,
|
||||
facingMode: "environment"
|
||||
},
|
||||
},
|
||||
decoder: {
|
||||
readers: [
|
||||
"code_128_reader",
|
||||
"ean_reader",
|
||||
"ean_8_reader",
|
||||
"code_39_reader",
|
||||
"code_39_vin_reader",
|
||||
"codabar_reader",
|
||||
"upc_reader",
|
||||
"upc_e_reader",
|
||||
"i2of5_reader"
|
||||
],
|
||||
debug: {
|
||||
showCanvas: false,
|
||||
showPatches: false,
|
||||
showFoundPatches: false,
|
||||
showSkeleton: false,
|
||||
showLabels: false,
|
||||
showPatchLabels: false,
|
||||
showRemainingPatchLabels: false,
|
||||
boxFromPatches: {
|
||||
showTransformed: false,
|
||||
showTransformedBox: false,
|
||||
showBB: false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Initialization finished. Ready to start");
|
||||
Quagga.start();
|
||||
|
||||
// Set flag to is running
|
||||
_scannerIsRunning = true;
|
||||
});
|
||||
|
||||
/*Quagga.onProcessed(function (result) {
|
||||
//var drawingCtx = Quagga.canvas.ctx.overlay,
|
||||
//drawingCanvas = Quagga.canvas.dom.overlay;
|
||||
|
||||
/*if (result) {
|
||||
if (result.boxes) {
|
||||
drawingCtx.clearRect(0, 0, parseInt(drawingCanvas.getAttribute("width")), parseInt(drawingCanvas.getAttribute("height")));
|
||||
result.boxes.filter(function (box) {
|
||||
return box !== result.box;
|
||||
}).forEach(function (box) {
|
||||
Quagga.ImageDebug.drawPath(box, { x: 0, y: 1 }, drawingCtx, { color: "green", lineWidth: 2 });
|
||||
});
|
||||
}
|
||||
|
||||
if (result.box) {
|
||||
Quagga.ImageDebug.drawPath(result.box, { x: 0, y: 1 }, drawingCtx, { color: "#00F", lineWidth: 2 });
|
||||
}
|
||||
|
||||
if (result.codeResult && result.codeResult.code) {
|
||||
Quagga.ImageDebug.drawPath(result.line, { x: 'x', y: 'y' }, drawingCtx, { color: 'red', lineWidth: 3 });
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
|
||||
Quagga.onDetected(function (result) {
|
||||
console.log("Barcode detected and processed : [" + result.codeResult.code + "]", result);
|
||||
if(String(result.codeResult.code).length == 13){
|
||||
document.getElementById("currentEAN").innerHTML = "EAN: " + result.codeResult.code
|
||||
console.log(result.codeResult.code)
|
||||
document.getElementById("searchBtn").style.backgroundColor = "color: #555;"
|
||||
document.getElementById("searchBtn").disabled = false;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Start/stop scanner
|
||||
document.getElementById("btn").addEventListener("click", function () {
|
||||
if (_scannerIsRunning) {
|
||||
document.getElementById("btn").style.backgroundColor = "rgba(255, 0, 0, 0.5)";
|
||||
Quagga.stop();
|
||||
} else {
|
||||
document.getElementById("btn").style.backgroundColor = "rgba(0, 255, 0, 0.5)";
|
||||
startScanner();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function sendEanConvRequest(){
|
||||
curEan = document.getElementById("currentEAN").innerHTML
|
||||
curEan = curEan.replace("EAN: ", "")
|
||||
document.getElementById("mainCont").innerHTML = "<h4>OpenMovieDB - Add a new movie</h4><center><div class=\"lds-grid\"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div><br><i>Searching database...</i></center>";
|
||||
if(curEan[0] == "0"){
|
||||
curEan = curEan.substring(1);
|
||||
}
|
||||
url = "/apiCallBack?ean=" + curEan;
|
||||
//window.open(url)
|
||||
$.get(url,function(data,status) {
|
||||
var respon = JSON.parse(data)
|
||||
if(respon.state == "OK"){
|
||||
url = "/returnSaveResult?reponseID=" + respon.reponseID;
|
||||
window.location.href = url
|
||||
}else{
|
||||
// alert("An error with the api occured.")
|
||||
document.getElementById("mainCont").innerHTML = "<h4>OpenMovieDB - Add a new movie</h4><center><i style='color: #cc0000; font-size: 100px;' class=\"fas fa-exclamation-circle\"></i><br>Ohno, the API returned an error. Errorcode: <br> <code>" + respon.state + "</code><br><br><button onclick=\"window.location.href = '/'\"><i class=\"fas fa-home\"></i> Back to home</button></center>"
|
||||
}
|
||||
console.log(data);
|
||||
},'html');
|
||||
//alert(curEan)
|
||||
}
|
||||
|
||||
function saveToLibary(){
|
||||
url = "/save?ean=<%= it.ean %>";
|
||||
|
||||
$.get(url,function(data,status) { console.log(data); console.log(status) },'html');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
133
template/addToShelf.html
Normal file
133
template/addToShelf.html
Normal file
@@ -0,0 +1,133 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Basic Page Needs
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8" />
|
||||
<title>OpenMovieDB - Bookshelf</title>
|
||||
<meta name="description" content="OpenMovieDB - Bookshelf" />
|
||||
<meta name="author" content="TheGreydiamond" />
|
||||
|
||||
<!-- Mobile Specific Metas
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- FONT
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link
|
||||
href="//fonts.googleapis.com/css?family=Raleway:400,300,600"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="css/normalize.css" />
|
||||
<link rel="stylesheet" href="css/skeleton.css" />
|
||||
<style>
|
||||
#overlay {
|
||||
position: fixed;
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
#overlay2 {
|
||||
position: fixed;
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#text{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
font-size: 50px;
|
||||
color: white;
|
||||
transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Favicon
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="icon" type="image/png" href="images/favicon.png" />
|
||||
<script src="https://kit.fontawesome.com/d7b80a780b.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.rawgit.com/serratus/quaggaJS/0420d5e0/dist/quagga.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div id="overlay" onclick="off()">
|
||||
<div id="text"><svg class='checkmark' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'><circle class='checkmark__circle ' cx='26' cy='26' r='25' fill='none'/><path class='checkmark__check' fill='none' d='M14.1 27.2l7.1 7.2 16.7-16.8'/></svg><style>.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2; stroke-miterlimit: 10; stroke: #7ac142; fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;}.checkmark { width: 56px; height: 56px; border-radius: 50%; display: block; stroke-width: 2; stroke: #fff; stroke-miterlimit: 10; margin: 10% auto; box-shadow: inset 0px 0px 0px #7ac142; animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;}.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;}@keyframes stroke { 100% { stroke-dashoffset: 0; }}@keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); }}@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 30px #7ac142; }}</style></div>
|
||||
</div>
|
||||
<div id="overlay2" onclick="off()">
|
||||
<div id="text"><h1>!</h1><red>This movie already exists in the DB.</red></div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="one-half column" style="margin-top: 15%" id="mainCont">
|
||||
<h4>OpenMovieDB - Add a new movie</h4>
|
||||
<div style="width: 300px;">
|
||||
<img src="<%= it.cover %>" alt="Cover image" style="width: 100%;"></img><br>
|
||||
<center><%= it.titleByAPI %><br><i><%= it.id %></i></center>
|
||||
</div>
|
||||
<button onclick="saveToLibary()" class="button-primary" id="addToBtn"> Add to libary</button>
|
||||
<button onclick="window.location.href = '/'"><i class="fas fa-home"></i> Back to home</button>
|
||||
<button
|
||||
|
||||
onclick="window.location.href = '/add'"
|
||||
>
|
||||
<i class="fas fa-plus"></i> Add new movie</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Include the image-diff library -->
|
||||
|
||||
<script>
|
||||
function on() {
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
}
|
||||
function on2() {
|
||||
document.getElementById("overlay2").style.display = "block";
|
||||
}
|
||||
|
||||
function off() {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
document.getElementById("overlay2").style.display = "none";
|
||||
}
|
||||
|
||||
function saveToLibary(){
|
||||
url = "/save?reponseID=<%= it.ean %>";
|
||||
document.getElementById("addToBtn").remove();
|
||||
$.get(url,function(data,status) {
|
||||
console.log(JSON.parse(data))
|
||||
if(JSON.parse(data).status == "OK"){
|
||||
on();
|
||||
}else{
|
||||
console.log("exist")
|
||||
on2()
|
||||
}
|
||||
},'html');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
90
template/bookshelf.html
Normal file
90
template/bookshelf.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Basic Page Needs
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8" />
|
||||
<title>OpenMovieDB - Bookshelf</title>
|
||||
<meta name="description" content="OpenMovieDB - Bookshelf" />
|
||||
<meta name="author" content="TheGreydiamond" />
|
||||
|
||||
<!-- Mobile Specific Metas
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- FONT
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link
|
||||
href="//fonts.googleapis.com/css?family=Raleway:400,300,600"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="css/normalize.css" />
|
||||
<link rel="stylesheet" href="css/skeleton.css" />
|
||||
|
||||
<!-- Favicon
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="icon" type="image/png" href="images/favicon.png" />
|
||||
<script
|
||||
src="https://kit.fontawesome.com/d7b80a780b.js"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Primary Page Layout
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<div class="eleven column" style="margin-top: 15%">
|
||||
<h4>OpenMovieDB - Bookshelf</h4>
|
||||
<div style="float: right; top: -20px;">
|
||||
<input class="u-full-width" type="text" placeholder="Search" id="search">
|
||||
</div>
|
||||
<button
|
||||
class="button-primary"
|
||||
onclick="window.location.href = '/add'"
|
||||
>
|
||||
<i class="fas fa-plus"></i> Add new movie</button
|
||||
><br />
|
||||
<div id="listOfMovies"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
ser = document.getElementById("search");
|
||||
ser.addEventListener("input", updateValue);
|
||||
json = <%~ it.jsonRespo %>;
|
||||
function updateValue(e) {
|
||||
console.log(e.target.value)
|
||||
outList = [];
|
||||
i = 0;
|
||||
elem = document.getElementById("listOfMovies");
|
||||
elem.innerHTML = ""
|
||||
while(i < json.length){
|
||||
currenElm = json[i]
|
||||
if(currenElm.movieTitel.toLowerCase().replace("(", "").replace(")", "").includes(e.target.value.toLowerCase())){
|
||||
console.log(currenElm.movieID)
|
||||
elem.innerHTML += "<a href='/showDetails?id=" + currenElm.movieID + "'><div style='width: 150px; float: left; padding: 5px;'><img src='" + currenElm.posterUrl + '\' style="width: 100%;"><br><center><b>' + currenElm.movieTitel + "</b></center></div></a>"
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
}
|
||||
i = 0;
|
||||
elem = document.getElementById("listOfMovies")
|
||||
while(i < json.length){
|
||||
currenElm = json[i]
|
||||
elem.innerHTML += "<a href='/showDetails?id=" + currenElm.movieID + "'><div style='width: 150px; float: left; padding: 5px;'><img src='" + currenElm.posterUrl + '\' style="width: 100%;"><br><center><b>' + currenElm.movieTitel + "</b></center></div></a>"
|
||||
i++;
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- End Document
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
</body>
|
||||
</html>
|
||||
138
template/index.html
Normal file
138
template/index.html
Normal file
@@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<script src="https://cdn.rawgit.com/serratus/quaggaJS/0420d5e0/dist/quagga.min.js"></script>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
/* In order to place the tracking correctly */
|
||||
canvas.drawing, canvas.drawingBuffer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= it.titleByAPI %><br>
|
||||
<%= it.id %><br>
|
||||
<img src="<%= it.cover %>" alt="Cover image" style="height: 200px;"></img>
|
||||
<!-- Div to show the scanner -->
|
||||
<div id="scanner-container"></div>
|
||||
<input type="button" id="btn" value="Start/Stop the scanner" />
|
||||
<div id="currentEAN">Waiting for proper EAN..</div>
|
||||
<button onclick="sendEanConvRequest()"> Search</button>
|
||||
|
||||
<!-- Include the image-diff library -->
|
||||
|
||||
<script>
|
||||
var _scannerIsRunning = false;
|
||||
|
||||
function startScanner() {
|
||||
Quagga.init({
|
||||
inputStream: {
|
||||
name: "Live",
|
||||
type: "LiveStream",
|
||||
target: document.querySelector('#scanner-container'),
|
||||
constraints: {
|
||||
width: 480,
|
||||
height: 320,
|
||||
facingMode: "environment"
|
||||
},
|
||||
},
|
||||
decoder: {
|
||||
readers: [
|
||||
"code_128_reader",
|
||||
"ean_reader",
|
||||
"ean_8_reader",
|
||||
"code_39_reader",
|
||||
"code_39_vin_reader",
|
||||
"codabar_reader",
|
||||
"upc_reader",
|
||||
"upc_e_reader",
|
||||
"i2of5_reader"
|
||||
],
|
||||
debug: {
|
||||
showCanvas: true,
|
||||
showPatches: true,
|
||||
showFoundPatches: true,
|
||||
showSkeleton: true,
|
||||
showLabels: true,
|
||||
showPatchLabels: true,
|
||||
showRemainingPatchLabels: true,
|
||||
boxFromPatches: {
|
||||
showTransformed: true,
|
||||
showTransformedBox: true,
|
||||
showBB: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Initialization finished. Ready to start");
|
||||
Quagga.start();
|
||||
|
||||
// Set flag to is running
|
||||
_scannerIsRunning = true;
|
||||
});
|
||||
|
||||
Quagga.onProcessed(function (result) {
|
||||
var drawingCtx = Quagga.canvas.ctx.overlay,
|
||||
drawingCanvas = Quagga.canvas.dom.overlay;
|
||||
|
||||
if (result) {
|
||||
if (result.boxes) {
|
||||
drawingCtx.clearRect(0, 0, parseInt(drawingCanvas.getAttribute("width")), parseInt(drawingCanvas.getAttribute("height")));
|
||||
result.boxes.filter(function (box) {
|
||||
return box !== result.box;
|
||||
}).forEach(function (box) {
|
||||
Quagga.ImageDebug.drawPath(box, { x: 0, y: 1 }, drawingCtx, { color: "green", lineWidth: 2 });
|
||||
});
|
||||
}
|
||||
|
||||
if (result.box) {
|
||||
Quagga.ImageDebug.drawPath(result.box, { x: 0, y: 1 }, drawingCtx, { color: "#00F", lineWidth: 2 });
|
||||
}
|
||||
|
||||
if (result.codeResult && result.codeResult.code) {
|
||||
Quagga.ImageDebug.drawPath(result.line, { x: 'x', y: 'y' }, drawingCtx, { color: 'red', lineWidth: 3 });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Quagga.onDetected(function (result) {
|
||||
console.log("Barcode detected and processed : [" + result.codeResult.code + "]", result);
|
||||
if(String(result.codeResult.code).length == 13){
|
||||
document.getElementById("currentEAN").innerHTML = result.codeResult.code
|
||||
console.log(result.codeResult.code)
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Start/stop scanner
|
||||
document.getElementById("btn").addEventListener("click", function () {
|
||||
if (_scannerIsRunning) {
|
||||
Quagga.stop();
|
||||
} else {
|
||||
startScanner();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function sendEanConvRequest(){
|
||||
url = "/apiCallBack?ean=" + document.getElementById("currentEAN").innerHTML;
|
||||
window.open(url)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
126
template/movieDetails.html
Normal file
126
template/movieDetails.html
Normal file
@@ -0,0 +1,126 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Basic Page Needs
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8" />
|
||||
<title>OpenMovieDB - Bookshelf</title>
|
||||
<meta name="description" content="OpenMovieDB - Bookshelf" />
|
||||
<meta name="author" content="TheGreydiamond" />
|
||||
|
||||
<!-- Mobile Specific Metas
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<!-- FONT
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link
|
||||
href="//fonts.googleapis.com/css?family=Raleway:400,300,600"
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
|
||||
<!-- CSS
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="stylesheet" href="css/normalize.css" />
|
||||
<link rel="stylesheet" href="css/skeleton.css" />
|
||||
<style>
|
||||
#overlay {
|
||||
position: fixed;
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#overlay2 {
|
||||
position: fixed;
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
z-index: 2;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#text{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
font-size: 50px;
|
||||
color: white;
|
||||
transform: translate(-50%,-50%);
|
||||
-ms-transform: translate(-50%,-50%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Favicon
|
||||
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<link rel="icon" type="image/png" href="images/favicon.png" />
|
||||
<script src="https://kit.fontawesome.com/d7b80a780b.js" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.rawgit.com/serratus/quaggaJS/0420d5e0/dist/quagga.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<div id="overlay" onclick="off()">
|
||||
<div id="text"><svg class='checkmark' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'><circle class='checkmark__circle ' cx='26' cy='26' r='25' fill='none'/><path class='checkmark__check' fill='none' d='M14.1 27.2l7.1 7.2 16.7-16.8'/></svg><style>.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2; stroke-miterlimit: 10; stroke: #7ac142; fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;}.checkmark { width: 56px; height: 56px; border-radius: 50%; display: block; stroke-width: 2; stroke: #fff; stroke-miterlimit: 10; margin: 10% auto; box-shadow: inset 0px 0px 0px #7ac142; animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;}.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;}@keyframes stroke { 100% { stroke-dashoffset: 0; }}@keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); }}@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 30px #7ac142; }}</style></div>
|
||||
</div>
|
||||
|
||||
<div id="overlay2" onclick="off()">
|
||||
<div id="text">Do you really want to remove this movie?<br>
|
||||
<button onclick="sureDelete()" style="background-color: rgba(174, 255, 128, 0.699)"><i class="fas fa-trash"></i> Yes</button>
|
||||
<button onclick="off()" style="background-color: rgba(255, 95, 95, 0.719)"><i class="fas fa-times"></i> No</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="one-half column" style="margin-top: 10%" id="mainCont">
|
||||
<h4>OpenMovieDB - Moviedetails</h4>
|
||||
<div style="width: 300px;">
|
||||
<img src="<%= it.cover %>" alt="Cover image" style="width: 100%;"></img><br>
|
||||
<center><%= it.titleByAPI %><br><i><%= it.id %></i></center>
|
||||
</div>
|
||||
<button onclick="handelDelete()" id="delBtn"><i class="fas fa-trash"></i> Delete</button>
|
||||
<button onclick="window.location.href = '/'"><i class="fas fa-home"></i> Back to home</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function on() {
|
||||
document.getElementById("overlay").style.display = "block";
|
||||
}
|
||||
|
||||
function off() {
|
||||
document.getElementById("overlay").style.display = "none";
|
||||
document.getElementById("overlay2").style.display = "none";
|
||||
}
|
||||
|
||||
function sureDelete(){
|
||||
console.log("Deleting movie")
|
||||
url = "/delete?id=<%= it.internalID %>";
|
||||
document.getElementById("delBtn").remove();
|
||||
$.get(url,function(data,status) { console.log(data); console.log(status); on(); setTimeout(function(){window.location.href = '/';}, 1000); },'html');
|
||||
}
|
||||
|
||||
function handelDelete(){
|
||||
document.getElementById("overlay2").style.display = "block";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user