Mercurial > defr > drupal > core
comparison modules/comment/comment.js @ 1:c1f4ac30525a 6.0
Drupal 6.0
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:28:28 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:5a113a1c4740 | 1:c1f4ac30525a |
---|---|
1 // $Id: comment.js,v 1.5 2007/09/12 18:29:32 goba Exp $ | |
2 | |
3 Drupal.behaviors.comment = function (context) { | |
4 var parts = new Array("name", "homepage", "mail"); | |
5 var cookie = ''; | |
6 for (i=0;i<3;i++) { | |
7 cookie = Drupal.comment.getCookie('comment_info_' + parts[i]); | |
8 if (cookie != '') { | |
9 $("#comment-form input[name=" + parts[i] + "]:not(.comment-processed)", context) | |
10 .val(cookie) | |
11 .addClass('comment-processed'); | |
12 } | |
13 } | |
14 }; | |
15 | |
16 Drupal.comment = {}; | |
17 | |
18 Drupal.comment.getCookie = function(name) { | |
19 var search = name + '='; | |
20 var returnValue = ''; | |
21 | |
22 if (document.cookie.length > 0) { | |
23 offset = document.cookie.indexOf(search); | |
24 if (offset != -1) { | |
25 offset += search.length; | |
26 var end = document.cookie.indexOf(';', offset); | |
27 if (end == -1) { | |
28 end = document.cookie.length; | |
29 } | |
30 returnValue = decodeURIComponent(document.cookie.substring(offset, end).replace(/\+/g, '%20')); | |
31 } | |
32 } | |
33 | |
34 return returnValue; | |
35 }; |