]> git.mxchange.org Git - friendica.git/commitdiff
facebook style comments
authorMike Macgirvin <mike@macgirvin.com>
Mon, 12 Jul 2010 07:49:06 +0000 (00:49 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 12 Jul 2010 07:49:06 +0000 (00:49 -0700)
include/main.js
mod/profile.php
view/comment_item.tpl

index 4fb92c774a14166656c52cb6a405ab9b67f12478..8d364ebcebcb7b4b2b007d90cb7f421f87f8e2b0 100644 (file)
@@ -7,6 +7,14 @@
       document.getElementById(theID).style.display = "block" 
     } 
   }
+
   function openMenu(theID) {
       document.getElementById(theID).style.display = "block" 
   }
+
+  function closeMenu(theID) {
+      document.getElementById(theID).style.display = "none" 
+  }
+
+
+
index 832618c9111f614936b927538ac035fc77b55a9a..45bac146efcb1f07e465039274e460d68ed982ef 100644 (file)
@@ -216,16 +216,17 @@ dbg(2);
 
        $tpl = file_get_contents('view/wall_item.tpl');
        if(count($r)) {
-               foreach($r as $rr) {
+               for($x = 0; $x < count($r); $x ++) {
+                       $rr = $r[$x];
+                       $comment = '';
                        if(can_write_wall($a,$a->profile['profile_uid'])) {
-                               $comment = replace_macros($template,array(
-                                       '$id' => $rr['item_id'],
-                                       '$parent' => $rr['parent'],
-                                       '$profile_uid' =>  $a->profile['profile_uid']
-                               ));
-                       }
-                       else {
-                               $comment = '';
+                               if((($x + 1) < count($r)) && ($r[$x+1]['parent'] != $rr['parent'])) {
+                                       $comment = replace_macros($template,array(
+                                               '$id' => $rr['item_id'],
+                                               '$parent' => $rr['parent'],
+                                               '$profile_uid' =>  $a->profile['profile_uid']
+                                       ));
+                               }
                        }
                        $o .= item_display($a,$rr,$tpl,$comment);
                }
index 3ca190ba5be953db291b94fdf047a56ed2f9e6a4..f617bc1a0e7e1b45338b4c24b1120d57ea84ea0d 100644 (file)
@@ -1,14 +1,14 @@
 
 <div class="comment-edit" id="comment-edit-$id" onclick="openClose('comment-edit-wrapper-$id');" >Comments</div>
-<div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: none;">
+<div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
        <form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" >
                <input type="hidden" name="type" value="jot" />
                <input type="hidden" name="profile_uid" value="$profile_uid" />
                <input type="hidden" name="parent" value="$parent" />
-               <textarea rows="3" cols="40" id="comment-edit-text-$id" name="body" ></textarea>
+               <textarea rows="2" cols="24" id="comment-edit-text-$id" name="body" onFocus="this.rows=5; this.cols=40; openMenu('comment-edit-submit-$id');" onBlur="this.rows=2; this.cols=24; closeMenu('comment-edit-submit-$id'); this.value='';"></textarea>
 
 
-               <div id="comment-edit-submit-wrapper" >
+               <div class="comment-edit-submit-wrapper" id="comment-edit-submit-$id" style="display: none;" >
                        <input type="submit" id="comment-edit-submit" name="submit" value="Submit" />
                </div>
                <div id="comment-edit-end"></div>