|
|
|
@ -1,26 +1,69 @@
|
|
|
|
|
var searchSource = $("#search-template").html();
|
|
|
|
|
Handlebars.registerHelper('if_eq', function (a, b, opts) {
|
|
|
|
|
if (a == b)
|
|
|
|
|
return opts.fn(this);
|
|
|
|
|
else
|
|
|
|
|
return opts.inverse(this);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var searchSource = $("#search-template").html();
|
|
|
|
|
var searchTemplate = Handlebars.compile(searchSource);
|
|
|
|
|
var movieTimer = 0;
|
|
|
|
|
var tvimer = 0;
|
|
|
|
|
|
|
|
|
|
$("#movieSearchContent").on("keyup", function (e) {
|
|
|
|
|
$("#movieSearchContent").keypress(function (e) {
|
|
|
|
|
if (movieTimer) {
|
|
|
|
|
clearTimeout(movieTimer);
|
|
|
|
|
}
|
|
|
|
|
movieTimer = setTimeout(movieSearch, 400);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#tvSearchContent").on("keyup", function (e) {
|
|
|
|
|
$("#tvSearchContent").keypress(function (e) {
|
|
|
|
|
if (tvimer) {
|
|
|
|
|
clearTimeout(tvimer);
|
|
|
|
|
}
|
|
|
|
|
tvimer = setTimeout(tvSearch(), 400);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#test").click(function (e) {
|
|
|
|
|
$(document).on("click", ".dropdownTv", function (e) {
|
|
|
|
|
var formData = [];
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
console.log(e.target.id);
|
|
|
|
|
var $form = $('#form'+e.target.id);
|
|
|
|
|
var data = $form.serialize();
|
|
|
|
|
var seasons = $(this).attr("season-select");
|
|
|
|
|
console.log(data);
|
|
|
|
|
formData.push(data);
|
|
|
|
|
if (seasons === "1") {
|
|
|
|
|
formData.push("latest=true");
|
|
|
|
|
} else {
|
|
|
|
|
data.latest = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: $form.prop('method'),
|
|
|
|
|
url: $form.prop('action'),
|
|
|
|
|
data: data,
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (response) {
|
|
|
|
|
console.log(response);
|
|
|
|
|
if (response.result === true) {
|
|
|
|
|
generateNotify("Success!", "success");
|
|
|
|
|
} else {
|
|
|
|
|
generateNotify(response.message, "warning");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
generateNotify("Something went wrong!", "danger");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(document).on("click", ".requesttv", function (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
console.log(e.target.id);
|
|
|
|
|
var $form = $('#form' + e.target.id);
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: $form.prop('method'),
|
|
|
|
@ -29,10 +72,10 @@ $("#test").click(function (e) {
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (response) {
|
|
|
|
|
console.log(response);
|
|
|
|
|
if (response.Result === true) {
|
|
|
|
|
if (response.result === true) {
|
|
|
|
|
generateNotify("Success!", "success");
|
|
|
|
|
} else {
|
|
|
|
|
generateNotify(response.Message, "warning");
|
|
|
|
|
generateNotify(response.message, "warning");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function (e) {
|
|
|
|
|