109 lines
3.0 KiB
JavaScript
109 lines
3.0 KiB
JavaScript
|
$(document).ready(function() {
|
||
|
$('input, textarea').each(function() {
|
||
|
var hasPlaceholder = $(this).attr("data-placeholder") == undefined ? false : true;
|
||
|
if (hasPlaceholder) {
|
||
|
$(this).data("placeholder", $(this).attr("data-placeholder"));
|
||
|
$(this).addClass("placeholder").val($(this).data("placeholder"));
|
||
|
$(this).focus(function() {
|
||
|
var currText = $(this).val();
|
||
|
if (currText == $(this).data("placeholder")) {
|
||
|
$(this).val('').removeClass("placeholder");
|
||
|
}
|
||
|
});
|
||
|
$(this).blur(function() {
|
||
|
var currText = $(this).val();
|
||
|
if (currText == '') {
|
||
|
$(this).val($(this).data("placeholder"));
|
||
|
$(this).addClass("placeholder");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
var Issue = function(json) {
|
||
|
this.id = json.id;
|
||
|
this.title = json.title;
|
||
|
this.summary = json.summary;
|
||
|
}
|
||
|
*/
|
||
|
|
||
|
function renderIssues(data) {
|
||
|
var html = tmpl("tmpl_issue_list", data);
|
||
|
console.log(html);
|
||
|
$('.issueListContainer').html(html);
|
||
|
/*
|
||
|
var hasNext = data.hasNext;
|
||
|
var hasPrev = data.hasPrev;
|
||
|
var issues = data.issues;
|
||
|
var endNo = data.end_no;
|
||
|
var pageSize = data.page_size;
|
||
|
*/
|
||
|
}
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
$.getJSON("issue_list/", {}, function(data) {
|
||
|
renderIssues(data);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('.nextBtn').live("click", function() {
|
||
|
// console.log("clicked next");
|
||
|
var start = $(this).parents('.navBtns').data("end");
|
||
|
console.log(start);
|
||
|
doIssuesLoading();
|
||
|
|
||
|
//FIXME: handle search
|
||
|
$.getJSON("issue_list/", {'start': start}, function(data) {
|
||
|
renderIssues(data);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
function doIssuesLoading() {
|
||
|
$.noop();
|
||
|
}
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
$('#subscribeForm').submit(function(e) {
|
||
|
e.preventDefault();
|
||
|
$('.validation').slideUp("fast");
|
||
|
var $email = $('#email');
|
||
|
var email = $email.val();
|
||
|
if (!isRFC822ValidEmail(email)) {
|
||
|
$('<div />').addClass('validation').html("Invalid Email Address").hide().insertAfter($email).slideDown("slow");
|
||
|
// $email.append(html);
|
||
|
return false;
|
||
|
}
|
||
|
$('#subscribeBtn').attr("disabled", "disabled").text("Subscribing...");
|
||
|
$.post("/erang/subscribe/", {
|
||
|
'email': email
|
||
|
}, function(response) {
|
||
|
$('#subscribe').slideUp("slow", function() {
|
||
|
$(this).addClass("response").html("<b>" + email + "</b>" + " has been subscribed to eRang. Thanks!");
|
||
|
$(this).slideDown("slow");
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
$('#commentForm').submit(function(e) {
|
||
|
e.preventDefault();
|
||
|
$('#commentSubmit').attr("disabled", "disabled").text("Submitting...");
|
||
|
$.post("/erang/postfeedback/", {
|
||
|
'name': $('#commentName').val(),
|
||
|
'email': $('#commentEmail').val(),
|
||
|
'comment': $('#commentComment').val(),
|
||
|
'issue': document.title
|
||
|
}, function(response) {
|
||
|
$('#commentWrapper').slideUp("slow", function() {
|
||
|
$(this).addClass("response").html("Your feedback has been emailed to us at erang" + "@" + "theatreforum.in. Thanks!");
|
||
|
$(this).slideDown("slow", function() {
|
||
|
$(document).scrollTop($(document).height());
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
|
||
|
|
||
|
|