+++ /dev/null
-$(document).ready(function() {
- $('#recaptcha_widget').show();
- $('.submit').click(function() {
- $('#not_human').hide();
- $('#blank_comment').hide();
- $('#comment_text').css('border', '1px solid grey')
- $('#recaptcha_response_field').css('border', '1px solid grey')
- if ($('#comment_text').val() != '') {
- var challenge = Recaptcha.get_challenge();
- var response = Recaptcha.get_response();
- var captcha_data = { "challenge" : challenge,
- "response" : response};
- $.ajax({
- type: "GET",
- url: "/captcha",
- data: captcha_data,
- success: function(data) {
- if (data.split('\n')[0] == 'true') {
- var name = $("#comment_name").val();
- var text = $("#comment_text").val();
- if (name == '') { name = "anon" }
- var comment_data = { "captcha" : "passed",
- "name" : name,
- "text" : text};
- $.ajax({
- type: "POST",
- // the url may need to be adjusted for
- // trailing slashes
- url: "verify",
- data: comment_data,
- success: function() {
- var new_post = "<h3>" + name + "</h3>"
- + text + "<br><br>";
- $('#comments').prepend(new_post);
- $('#comment').hide();
- }
- });
- } else {
- $('#not_human').show();
- $('#recaptcha_response_field').css('border', '2px solid red')
- }
- },
- error: function() {
- console.log('error');
- },
- complete: function() {
- Recaptcha.reload();
- }
- });
- } else {
- $('#blank_comment').show();
- $('#comment_text').css('border', '2px solid red')
- }
- return false;
- });
-});
--- /dev/null
+$(document).ready(function() {
+ $('#recaptcha_widget').show();
+ $('.submit').click(function() {
+ $('#not_human').hide();
+ $('#blank_comment').hide();
+ $('#comment_text').css('border', '1px solid grey')
+ $('#recaptcha_response_field').css('border', '1px solid grey')
+ if ($('#comment_text').val() != '') {
+ var challenge = Recaptcha.get_challenge();
+ var response = Recaptcha.get_response();
+ var captcha_data = { "challenge" : challenge,
+ "response" : response};
+ $.ajax({
+ type: "GET",
+ url: "/captcha",
+ data: captcha_data,
+ success: function(data) {
+ if (data.split('\n')[0] == 'true') {
+ var name = $("#comment_name").val();
+ var text = $("#comment_text").val();
+ if (name == '') { name = "anon" }
+ var comment_data = { "captcha" : "passed",
+ "name" : name,
+ "text" : text};
+ $.ajax({
+ type: "POST",
+ // the url may need to be adjusted for
+ // trailing slashes
+ url: "verify",
+ data: comment_data,
+ success: function() {
+ var new_post = "<h3>" + name + "</h3>"
+ + text + "<br><br>";
+ $('#comments').prepend(new_post);
+ $('#comment').hide();
+ }
+ });
+ } else {
+ $('#not_human').show();
+ $('#recaptcha_response_field').css('border', '2px solid red')
+ }
+ },
+ error: function() {
+ console.log('error');
+ },
+ complete: function() {
+ Recaptcha.reload();
+ }
+ });
+ } else {
+ $('#blank_comment').show();
+ $('#comment_text').css('border', '2px solid red')
+ }
+ return false;
+ });
+});
if (cms::determine_type() == "index") {
$scripts = "<script type='text/javascript' src='/includes/all.js'></script>";
$home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylansserver.com&ucn_task=conformance#";
- } else if ($this->determine_type() == 'note') {
+ } else if ($this->determine_type() == 'note'
+ && isset($_GET['comments'])) {
$scripts = "<script type='text/javascript' src='http://www.google.com/recaptcha/api/js/recaptcha_ajax.js'></script>";
- $scripts .= "<script type='text/javascript' src='/includes/jquery-core.js'></script>";
- $scripts .= "<script type='text/javascript' src='/includes/jquery-all-components.js'></script>";
- $scripts .= "<script type='text/javascript' src='/includes/ajax.js'></script>";
+ $scripts .= "<script type='text/javascript' src='/includes/comment.js'></script>";
}
echo <<<END_OF_HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"