| 1 |
// $Id: comment_info.js,v 1.0 2007/01/29 03:51:25 mfer Exp $ |
// $Id: comment_info.js,v 1.1.2.1 2007/02/23 20:20:50 mfer Exp $ |
| 2 |
|
|
| 3 |
Drupal.comment_info = {}; |
Drupal.comment_info = {}; |
| 4 |
|
|
| 38 |
}; |
}; |
| 39 |
|
|
| 40 |
Drupal.comment_info.autoAttach = function() { |
Drupal.comment_info.autoAttach = function() { |
| 41 |
$('#comment_info').prepend('<div class="form-item"><label class="option"><input type="checkbox" name="optin" id="comment_info_checkbox" value="1" class="form-checkbox" /> Save my Comment Information for next time.</label></div>'); |
var comment_info_x = false; |
| 42 |
|
$("#comment-form input[@name=optin]").show(); |
| 43 |
var comment_info_option = Drupal.comment_info.cookie('comment_info_option'); |
var comment_info_option = Drupal.comment_info.cookie('comment_info_option'); |
| 44 |
if (comment_info_option=='true') { |
if (comment_info_option=='true') { |
| 45 |
$("#comment-form input[@name=name]").val(Drupal.comment_info.cookie('comment_info_name')); |
$("#comment-form input[@name=name]").val(Drupal.comment_info.cookie('comment_info_name')); |
| 46 |
$("#comment-form input[@name=mail]").val(Drupal.comment_info.cookie('comment_info_email')); |
$("#comment-form input[@name=mail]").val(Drupal.comment_info.cookie('comment_info_email')); |
| 47 |
$("#comment-form input[@name=homepage]").val(Drupal.comment_info.cookie('comment_info_homepage')); |
$("#comment-form input[@name=homepage]").val(Drupal.comment_info.cookie('comment_info_homepage')); |
| 48 |
document.getElementById("comment_info_checkbox").checked=true; |
$("#comment-form input[@name=optin]").each( function() { |
| 49 |
|
this.checked = true; |
| 50 |
|
}); |
| 51 |
} |
} |
| 52 |
$("form#comment-form input[@type=submit]").each( function() { |
$("form#comment-form input[@type=submit]").each( function() { |
| 53 |
$(this).click(function() { |
$(this).click(function() { |
| 54 |
var x=document.getElementById("comment_info_checkbox") |
$("#comment-form input[@name=optin]").each( function() { |
| 55 |
if(x.checked) { |
comment_info_x = this.checked; |
| 56 |
|
}); |
| 57 |
|
if(comment_info_x) { |
| 58 |
Drupal.comment_info.cookie('comment_info_option', 'true', { expires: 120 }); |
Drupal.comment_info.cookie('comment_info_option', 'true', { expires: 120 }); |
| 59 |
Drupal.comment_info.cookie('comment_info_name', $("#comment-form input[@name=name]").val(), { expires: 120 }); |
Drupal.comment_info.cookie('comment_info_name', $("#comment-form input[@name=name]").val(), { expires: 120 }); |
| 60 |
Drupal.comment_info.cookie('comment_info_email', $("#comment-form input[@name=mail]").val(), { expires: 120 }); |
Drupal.comment_info.cookie('comment_info_email', $("#comment-form input[@name=mail]").val(), { expires: 120 }); |