1 /* Sone JavaScript functions. */
3 function registerInputTextareaSwap(inputSelector, defaultText) {
4 $(inputSelector).each(function() {
5 $(this).focus(function() {
6 if ($(this).hasClass("default")) {
7 $(this).removeClass("default").val("");
10 if ($(this).val() == "") {
11 $(this).val(defaultText).addClass("default");
13 }).addClass("default").val(defaultText);
14 var inputField = $(this);
15 $(this.form).submit(function() {
16 if (inputField.hasClass("default")) {
23 /* hide all the “create reply” forms until a link is clicked. */
24 function addCommentLinks() {
25 $("#sone .post").each(function() {
26 postId = $(this).attr("id");
27 commentElement = (function(postId) {
28 var commentElement = $("<div><span>Comment</span></div>").addClass("show-reply-form").click(function() {
29 replyElement = $("#sone .post#" + postId + " .create-reply");
30 replyElement.removeClass("hidden");
31 replyElement.removeClass("light");
32 (function(replyElement) {
33 replyElement.find("input.reply-input").blur(function() {
34 if ($(this).hasClass("default")) {
35 replyElement.addClass("light");
38 replyElement.removeClass("light");
41 replyElement.find("input.reply-input").focus();
43 return commentElement;
45 $(this).find(".create-reply").addClass("hidden");
46 $(this).find(".status-line .time").each(function() {
47 $(this).after(commentElement.clone(true));