Big and early commit, need to clean up and seperate JS to external file.

This commit is contained in:
Kevin Midboe
2017-04-07 11:29:57 +02:00
parent ede006c370
commit 972bbc1f0f

View File

@@ -2,40 +2,63 @@
<html> <html>
<head> <head>
<title>seasoned | verify</title> <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> <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> </head>
<body> <body>
<h1 id='title'></h1> <h3 id='title'></h3>
<div>
<!-- <span>path:</span> <div class="row formContainer">
<span id="path"></span><button onclick="foo('#path')">Edit</button><br> <form action="/" id="searchForm" class="col s12">
<span>name:</span> <div class="row">
<span id="name"></span><button onclick="foo('#name')">Edit</button><br> <div class="input-field col s12">
<span>season:</span> <input placeholder="Parent" id="parent" type="text">
<span id="season"></span><button onclick="foo('#season')">Edit</button><br> <label for="parent">Parent</label>
<span>episode:</span> </div>
<span id="episode"></span><button onclick="foo('#episode')">Edit</button><br> <div class="col s12"></div>
<span>videoFiles:</span> <div class="input-field col s4">
<span id="video_files"></span><button onclick="foo('#video_files')">Edit</button><br> <input placeholder="" id="name" type="text">
<span>subtitles:</span> <label for="name">Name</label>
<span id="subtitles"></span><button onclick="foo('#subtitles')">Edit</button><br> </div>
<span>trash:</span> <div class="input-field col s4">
<span id="trash"></span><button onclick="foo('#trash')">Edit</button><br> --> <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> </div>
<form action="/" id="searchForm">
<span>Parent:</span><input type="text" size="100" name="parent" id="parent"><br>
<span>Name:</span><input type="text" size="100" name="name" id="name"><br>
<span>Season:</span><input type="text" size="100" name="season" id="season"><br>
<span>Episode:</span><input type="text" size="100" name="episode" id="episode"><br>
<span>Video_files:</span><input type="text" size="100" name="video_files" id="video_files"><br>
<span>Subtitles:</span><input type="text" size="100" name="subtitles" id="subtitles"><br>
<span>Trash:</span><input type="text" size="100" name="trash" id="trash"><br>
<input type="submit" value="Search" /><br>
</form>
</body> </body>
<script> <script>
function getEpisodeId() { function getURLId() {
var sPageURL = window.location.search.substring(1); var sPageURL = window.location.search.substring(1);
var sParameterName = sPageURL.split('='); var sParameterName = sPageURL.split('=');
if (sParameterName[0] == 'id') { if (sParameterName[0] == 'id') {
@@ -64,7 +87,7 @@
var formJsonObj = objectifyForm($("#searchForm").serializeArray()); var formJsonObj = objectifyForm($("#searchForm").serializeArray());
formJsonObj['verified'] = 1; formJsonObj['verified'] = 1;
formJsonObj['id'] = getEpisodeId(); formJsonObj['id'] = getURLId();
console.log(formJsonObj); console.log(formJsonObj);
var url = 'https://apollo.kevinmidboe.com/api/seasoned'; var url = 'https://apollo.kevinmidboe.com/api/seasoned';
@@ -74,7 +97,7 @@
type: 'POST', type: 'POST',
data: JSON.stringify(formJsonObj), data: JSON.stringify(formJsonObj),
success: function (data) { success: function (data) {
console.log(episode); Materialize.toast('Verification successfully sent!', 4000);
}, },
error: function() { error: function() {
console.log('erorr'); console.log('erorr');
@@ -94,7 +117,7 @@
} }
function getShow() { function getShow() {
var url = 'https://apollo.kevinmidboe.com/api/seasoned?id=' + getEpisodeId(); var url = 'https://apollo.kevinmidboe.com/api/seasoned?id=' + getURLId();
$.ajax({ $.ajax({
url: url, url: url,
dataType: "json", dataType: "json",