143 lines
4.1 KiB
HTML
143 lines
4.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>seasoned | verify</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
|
|
|
<!-- Compiled and minified CSS -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">
|
|
|
|
<!-- Compiled and minified JavaScript -->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
</head>
|
|
<body>
|
|
<h3 id='title'></h3>
|
|
|
|
<div class="row formContainer">
|
|
<form action="/" id="searchForm" class="col s12">
|
|
<div class="row">
|
|
<div class="input-field col s12">
|
|
<input placeholder="Parent" id="parent" type="text">
|
|
<label for="parent">Parent</label>
|
|
</div>
|
|
<div class="col s12"></div>
|
|
<div class="input-field col s4">
|
|
<input placeholder="" id="name" type="text">
|
|
<label for="name">Name</label>
|
|
</div>
|
|
<div class="input-field col s4">
|
|
<input placeholder="" id="season" type="text" class="validate">
|
|
<label for="season">Season</label>
|
|
</div>
|
|
<div class="input-field col s4">
|
|
<input placeholder="" id="episode" type="text" class="validate">
|
|
<label for="episode">Episode</label>
|
|
</div>
|
|
<div class="col s12"></div>
|
|
<div class="input-field col s12">
|
|
<input placeholder="" id="video_files" type="text" class="validate">
|
|
<label for="video_files">Video files</label>
|
|
</div>
|
|
<div class="input-field col s12">
|
|
<input placeholder="" id="subtitles" type="text" class="validate">
|
|
<label for="subtitles">Subtitles</label>
|
|
</div>
|
|
<div class="input-field col s12">
|
|
<input placeholder="" id="trash" type="text" class="validate">
|
|
<label for="trash">Trash</label>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit" class="btn waves-effect waves-light" type="submit" name="action">Submit
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
|
|
<script>
|
|
function getURLId() {
|
|
var sPageURL = window.location.search.substring(1);
|
|
var sParameterName = sPageURL.split('=');
|
|
if (sParameterName[0] == 'id') {
|
|
console.log(sParameterName[1]);
|
|
var query_id = document.getElementById('title').innerHTML = sParameterName[1];
|
|
|
|
return query_id;
|
|
}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
getShow();
|
|
});
|
|
|
|
|
|
function objectifyForm(formArray) {//serialize data function
|
|
var returnArray = {};
|
|
for (var i = 0; i < formArray.length; i++){
|
|
returnArray[formArray[i]['name']] = formArray[i]['value'];
|
|
}
|
|
return returnArray;
|
|
}
|
|
|
|
// this is the id of the form
|
|
$("#searchForm").submit(function(e) {
|
|
var formJsonObj = objectifyForm($("#searchForm").serializeArray());
|
|
|
|
formJsonObj['verified'] = 1;
|
|
formJsonObj['id'] = getURLId();
|
|
console.log(formJsonObj);
|
|
|
|
var url = 'https://apollo.kevinmidboe.com/api/seasoned';
|
|
$.ajax({
|
|
url: url,
|
|
dataType: 'json',
|
|
type: 'POST',
|
|
data: JSON.stringify(formJsonObj),
|
|
success: function (data) {
|
|
Materialize.toast('Verification successfully sent!', 4000);
|
|
},
|
|
error: function() {
|
|
console.log('erorr');
|
|
}
|
|
});
|
|
e.preventDefault(); // avoid to execute the actual submit of the form.
|
|
});
|
|
|
|
|
|
function foo(id) {
|
|
var el = $(id);
|
|
if (el.attr('contenteditable') == 'true'){
|
|
el.attr('contenteditable', 'false');
|
|
} else {
|
|
el.attr('contenteditable', 'true')
|
|
}
|
|
}
|
|
|
|
function getShow() {
|
|
var url = 'https://apollo.kevinmidboe.com/api/seasoned?id=' + getURLId();
|
|
$.ajax({
|
|
url: url,
|
|
dataType: "json",
|
|
success: function (data) {
|
|
var episode = data['episode'];
|
|
$('#parent').val(episode['parent']);
|
|
$('#name').val(episode['name']);
|
|
$('#season').val(episode['season']);
|
|
$('#episode').val(episode['episode']);
|
|
$('#video_files').val(episode['video_files']);
|
|
$('#subtitles').val(episode['subtitles']);
|
|
$('#trash').val(episode['trash']);
|
|
|
|
console.log(episode);
|
|
},
|
|
error: function() {
|
|
console.log('erorr');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<script type="text/javascript"></script>
|
|
</html> |