Changes so the lists are printed out more nicely.
This commit is contained in:
@@ -1,9 +1,14 @@
|
|||||||
|
function getUrlParameter(name) {
|
||||||
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||||
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
||||||
|
var results = regex.exec(location.search);
|
||||||
|
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||||
|
};
|
||||||
|
|
||||||
function getURLId() {
|
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') {
|
||||||
console.log(sParameterName[1]);
|
|
||||||
var query_id = document.getElementById('title').innerHTML = sParameterName[1];
|
var query_id = document.getElementById('title').innerHTML = sParameterName[1];
|
||||||
|
|
||||||
return query_id;
|
return query_id;
|
||||||
@@ -17,15 +22,16 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// this is the id of the form
|
// this is the id of the form
|
||||||
$("#searchForm").submit(function(e) {
|
$("#searchForm").submit(function(e) {
|
||||||
var url = env_variables.url + 'verify/' + getURLId();
|
var url = env_variables.url + 'verify/' + getUrlParameter('id');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
Materialize.toast('Verification successfully sent!', 4000);
|
Materialize.toast('Verification successfully sent!', 4000);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function(data) {
|
||||||
console.log('erorr');
|
console.log(data.responseJSON.error);
|
||||||
|
e.preventDefault(); // avoid to execute the actual submit of the form.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
e.preventDefault(); // avoid to execute the actual submit of the form.
|
e.preventDefault(); // avoid to execute the actual submit of the form.
|
||||||
@@ -41,8 +47,12 @@ function foo(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var toType = function(obj) {
|
||||||
|
return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
|
||||||
|
}
|
||||||
|
|
||||||
function getShow() {
|
function getShow() {
|
||||||
var url = env_variables.url + getURLId();
|
var url = env_variables.url + getUrlParameter('id');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@@ -51,14 +61,26 @@ function getShow() {
|
|||||||
$('#name').val(data['name']);
|
$('#name').val(data['name']);
|
||||||
$('#season').val(data['season']);
|
$('#season').val(data['season']);
|
||||||
$('#episode').val(data['episode']);
|
$('#episode').val(data['episode']);
|
||||||
$('#video_files').val(data['video_files']);
|
var itemList= JSON.parse(data['video_files']);
|
||||||
$('#subtitles').val(data['subtitles']);
|
for (item in itemList) {
|
||||||
$('#trash').val(data['trash']);
|
$('#video_files').append('<p>' + itemList[item][0] + '</p>');
|
||||||
|
$('#video_files').append('<p>' + itemList[item][1] + '</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
var itemList= JSON.parse(data['subtitles']);
|
||||||
|
for (item in itemList) {
|
||||||
|
$('#subtitles').append('<p>' + itemList[item][0] + '</p>');
|
||||||
|
$('#subtitles').append('<p>' + itemList[item][1] + '</p>');
|
||||||
|
}
|
||||||
|
|
||||||
|
var itemList= JSON.parse(data['trash']);
|
||||||
|
for (item in itemList) {
|
||||||
|
$('#trash').append('<p>' + itemList[item] + '</p>');
|
||||||
|
}
|
||||||
console.log(data);
|
console.log(data);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function(data) {
|
||||||
console.log('erorr');
|
console.log(data.responseJSON.error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -38,16 +38,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col s12"></div>
|
<div class="col s12"></div>
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<input placeholder="" id="video_files" type="text" class="validate">
|
<!-- <input placeholder="" id="video_files" type="text" class="validate">
|
||||||
<label for="video_files">Video files</label>
|
<label for="video_files">Video files</label> -->
|
||||||
|
<span id='video_files'>
|
||||||
|
<label>Video files</label><br>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<input placeholder="" id="subtitles" type="text" class="validate">
|
<!-- <input placeholder="" id="subtitles" type="text" class="validate">
|
||||||
<label for="subtitles">Subtitles</label>
|
<label for="subtitles">Subtitles</label> -->
|
||||||
|
<span id='subtitles'>
|
||||||
|
<label>Subtitles</label><br>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<input placeholder="" id="trash" type="text" class="validate">
|
<!-- <input placeholder="" id="trash" type="text" class="validate">
|
||||||
<label for="trash">Trash</label>
|
<label for="trash">Trash</label> -->
|
||||||
|
<span id='trash'>
|
||||||
|
<label>Trash</label><br>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user