Use placeholder attribute for Comment message
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 7 Jan 2017 15:13:55 +0000 (02:13 +1100)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 7 Jan 2017 15:13:55 +0000 (02:13 +1100)
- Remove global aStr.comment
- Remove global window.commentEmptyText
- Remove head.tpl $comment parameter

20 files changed:
boot.php
view/templates/comment_item.tpl
view/templates/head.tpl
view/templates/moderated_comment.tpl
view/theme/duepuntozero/templates/comment_item.tpl
view/theme/duepuntozero/templates/moderated_comment.tpl
view/theme/frio/js/filebrowser.js
view/theme/frio/js/textedit.js
view/theme/frio/templates/comment_item.tpl
view/theme/frio/templates/js_strings.tpl
view/theme/frost-mobile/js/theme.js
view/theme/frost-mobile/templates/comment_item.tpl
view/theme/frost-mobile/templates/head.tpl
view/theme/frost-mobile/templates/moderated_comment.tpl
view/theme/frost/js/theme.js
view/theme/frost/templates/comment_item.tpl
view/theme/frost/templates/head.tpl
view/theme/frost/templates/moderated_comment.tpl
view/theme/quattro/templates/comment_item.tpl
view/theme/vier/templates/comment_item.tpl

index aad8813..2dce765 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -971,7 +971,6 @@ class App {
                        '$local_user' => local_user(),
                        '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
                        '$delitem' => t('Delete this item?'),
-                       '$comment' => t('Comment'),
                        '$showmore' => t('show more'),
                        '$showfewer' => t('show fewer'),
                        '$update_interval' => $interval,
index a0fd805..63ec5d7 100644 (file)
@@ -17,7 +17,7 @@
                                        <a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
                                </div>
                                <div class="comment-edit-photo-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});" >{{$comment}}</textarea>
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});" >
                                        <option value=""></option>
index 0f22362..3dd1bc7 100644 (file)
@@ -72,8 +72,7 @@
                return true;
        }
        function commentOpen(obj,id) {
-               if(obj.value == '{{$comment}}') {
-                       obj.value = '';
+               if (obj.value == "") {
                        $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                        $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                        $("#mod-cmnt-wrap-" + id).show();
@@ -83,8 +82,7 @@
                return false;
        }
        function commentClose(obj,id) {
-               if(obj.value == '') {
-                       obj.value = '{{$comment}}';
+               if (obj.value == "") {
                        $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
                        $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
                        $("#mod-cmnt-wrap-" + id).hide();
@@ -97,8 +95,7 @@
 
        function commentInsert(obj,id) {
                var tmpStr = $("#comment-edit-text-" + id).val();
-               if(tmpStr == '{{$comment}}') {
-                       tmpStr = '';
+               if (tmpStr == "") {
                        $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                        $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                        openMenu("comment-edit-submit-wrapper-" + id);
 
        function qCommentInsert(obj,id) {
                var tmpStr = $("#comment-edit-text-" + id).val();
-               if(tmpStr == '{{$comment}}') {
-                       tmpStr = '';
+               if (tmpStr == "") {
                        $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                        $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                        openMenu("comment-edit-submit-wrapper-" + id);
index a8f1c6b..1fc4df3 100644 (file)
@@ -20,7 +20,7 @@
                                        <div id="mod-cmnt-url-lbl-{{$id}}" class="mod-cmnt-url-lbl">{{$lbl_modurl}}</div>
                                        <input type="text" id="mod-cmnt-url-{{$id}}" class="mod-cmnt-url" name="mod-cmnt-url" value="{{$modurl|escape:'html'}}" />
                                </div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});" >{{$comment}}</textarea>
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
 
                                <div class="comment-edit-text-end"></div>
                                <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
index 9452c01..b7158f4 100644 (file)
@@ -44,7 +44,7 @@
                                                data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
                                </ul>
                                <div class="comment-edit-bb-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});" >{{$comment}}</textarea>                       
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen(this, {{$id}});" onBlur="commentClose(this,{{$id}});cmtBbClose(this,{{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
                                        <option value=""></option>
index 563abd4..ede0875 100644 (file)
@@ -47,7 +47,7 @@
                                                onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
                                </ul>
                                <div class="comment-edit-bb-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});" >{{$comment}}</textarea>                      
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
 
                                <div class="comment-edit-text-end"></div>
                                <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
index db5a125..6856d12 100644 (file)
@@ -121,8 +121,7 @@ var FileBrowser = {
                        // work as expected (we need a way to wait until commentOpenUI would be finished).\r
                        // As for now we insert pieces of this function here\r
                        if ((commentElm !== null) && (typeof commentElm !== "undefined")) {\r
-                               if (commentElm.value == aStr.comment){\r
-                                       commentElm.value = "";\r
+                               if (commentElm.value == "") {\r
                                        $("#comment-edit-text-" + FileBrowser.id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");\r
                                        $("#comment-edit-submit-wrapper-" + FileBrowser.id).show();\r
                                        $("#comment-edit-text-" + FileBrowser.id).attr('tabindex','9');\r
index 73f7c9e..ccb0511 100644 (file)
@@ -61,8 +61,7 @@ function commentExpand(id) {
 }
 
 function commentClose(obj,id) {
-       if(obj.value == '') {
-               obj.value = aStr.comment;
+       if (obj.value == '') {
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).hide();
@@ -85,8 +84,7 @@ function commentOpenUI(obj, id) {
        $(document).unbind( "click.commentOpen", handler );
 
        var handler = function() {
-               if(obj.value == aStr.comment) {
-                       obj.value = '';
+               if (obj.value == '') {
                        $("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
                        // Choose an arbitrary tab index that's greater than what we're using in jot (3 of them)
                        // The submit button gets tabindex + 1
@@ -105,8 +103,7 @@ function commentCloseUI(obj, id) {
        $(document).unbind( "click.commentClose", handler );
 
        var handler = function() {
-               if(obj.value === '') {
-               obj.value = aStr.comment;
+               if (obj.value === '') {
                        $("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty");
                        $("#comment-edit-text-" + id).removeAttr('tabindex');
                        $("#comment-edit-submit-" + id).removeAttr('tabindex');
@@ -136,8 +133,7 @@ function jotTextCloseUI(obj) {
 }
 
 function commentOpen(obj,id) {
-       if(obj.value == aStr.comment) {
-               obj.value = '';
+       if (obj.value == '') {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).show();
@@ -149,8 +145,7 @@ function commentOpen(obj,id) {
 
 function commentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == aStr.comment) {
-               tmpStr = '';
+       if (tmpStr == '') {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
@@ -165,8 +160,7 @@ function commentInsert(obj,id) {
 
 function qCommentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == aStr.comment) {
-               tmpStr = '';
+       if (tmpStr == '') {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
index c7d225e..440d5f0 100644 (file)
@@ -14,7 +14,7 @@
                <input type="hidden" name="post_id_random" value="{{$rand_num}}" />
 
                <div class="bb form-group">
-                       <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty form-control text-autosize" name="body" onFocus="commentOpenUI(this,{{$id}});" onBlur="commentCloseUI(this,{{$id}});">{{$comment}}</textarea>
+                       <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty form-control text-autosize" name="body" placeholder="{{$comment}}" onFocus="commentOpenUI(this,{{$id}});" onBlur="commentCloseUI(this,{{$id}});"></textarea>
                </div>
                {{if $qcomment}}
                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
index 3bec57a..2576ced 100644 (file)
@@ -8,7 +8,6 @@ They are loaded into the html <head> so that js functions can use them *}}
        var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
        var aStr = {
                'delitem'     : "{{$delitem}}",
-               'comment'     : "{{$comment}}"
        };
 
        {{* Create an object with the data which is needed for infinite scroll.
index fc42d92..dfc272e 100644 (file)
@@ -376,8 +376,7 @@ function itemFiler(id) {
  * Comments
  */
 function commentOpen(obj,id) {
-       if(obj.value == window.commentEmptyText) {
-               obj.value = "";
+       if (obj.value == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).show();
@@ -385,8 +384,7 @@ function commentOpen(obj,id) {
        }
 }
 function commentClose(obj,id) {
-       if(obj.value == "") {
-               obj.value = window.commentEmptyText;
+       if (obj.value == "") {
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).hide();
@@ -397,8 +395,7 @@ function commentClose(obj,id) {
 
 function commentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == window.commentEmptyText) {
-               tmpStr = "";
+       if (tmpStr == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
@@ -413,8 +410,7 @@ function commentInsert(obj,id) {
 
 function qCommentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == window.commentEmptyText) {
-               tmpStr = "";
+       if (tmpStr == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
index 439ea9d..13fcfeb 100644 (file)
@@ -25,8 +25,8 @@
                                        <li><a class="editicon codebb shadow"
                                                style="cursor: pointer;" title="{{$edcode}}"
                                                data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="code" data-id="{{$id}}"></a></li>
-                               </ul>   
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" >{{$comment}}</textarea>
+                               </ul>
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
                                        <option value=""></option>
index 759efb2..b60a2a4 100644 (file)
@@ -17,7 +17,6 @@
 
 <script>
        window.delItem = "{{$delitem}}";
-       window.commentEmptyText = "{{$comment}}";
        window.showMore = "{{$showmore}}";
        window.showFewer = "{{$showfewer}}";
        var updateInterval = {{$update_interval}};
index 563abd4..ede0875 100644 (file)
@@ -47,7 +47,7 @@
                                                onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
                                </ul>
                                <div class="comment-edit-bb-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});" >{{$comment}}</textarea>                      
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
 
                                <div class="comment-edit-text-end"></div>
                                <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
index ca0d143..5597247 100644 (file)
@@ -835,8 +835,7 @@ function cmtBbClose(id) {
 }
 
 function commentOpen(obj,id) {
-       if(obj.value == window.commentEmptyText) {
-               obj.value = "";
+       if (obj.value == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).show();
@@ -844,8 +843,7 @@ function commentOpen(obj,id) {
        }
 }
 function commentClose(obj,id) {
-       if(obj.value == "") {
-               obj.value = window.commentEmptyText;
+       if (obj.value == "") {
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).hide();
@@ -856,8 +854,7 @@ function commentClose(obj,id) {
 
 function commentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == window.commentEmptyText) {
-               tmpStr = "";
+       if (tmpStr == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
@@ -872,8 +869,7 @@ function commentInsert(obj,id) {
 
 function qCommentInsert(obj,id) {
        var tmpStr = $("#comment-edit-text-" + id).val();
-       if(tmpStr == window.commentEmptyText) {
-               tmpStr = "";
+       if (tmpStr == "") {
                $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
                openMenu("comment-edit-submit-wrapper-" + id);
index 995bd9d..a30b7ba 100644 (file)
@@ -34,8 +34,8 @@
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
                                                data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
-                               </ul>   
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" >{{$comment}}</textarea>
+                               </ul>
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
                                        <option value=""></option>
index 496aba8..21144eb 100644 (file)
@@ -19,7 +19,6 @@
 
 <script>
        window.delItem = "{{$delitem}}";
-       window.commentEmptyText = "{{$comment}}";
        window.showMore = "{{$showmore}}";
        window.showFewer = "{{$showfewer}}";
        var updateInterval = {{$update_interval}};
index 563abd4..ede0875 100644 (file)
@@ -47,7 +47,7 @@
                                                onclick="insertFormatting('{{$comment}}','video', {{$id}});"></a></li>
                                </ul>
                                <div class="comment-edit-bb-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});" >{{$comment}}</textarea>                      
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});cmtBbOpen({{$id}});" onBlur="commentClose(this,{{$id}});"></textarea>
 
                                <div class="comment-edit-text-end"></div>
                                <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-{{$id}}" style="display: none;">
index c7eef70..18b1a51 100644 (file)
                                        <li><a class="editicon videobb shadow"
                                                style="cursor: pointer;" title="{{$edvideo}}"
                                                data-role="insert-formatting" data-comment="{{$comment}}" data-bbcode="video" data-id="{{$id}}"></a></li>
-                               </ul>   
-                               <textarea id="comment-edit-text-{{$id}}" 
-                                       class="comment-edit-text-empty" 
-                                       name="body" 
-                                       onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});" >{{$comment}}</textarea>
+                               </ul>
+                               <textarea id="comment-edit-text-{{$id}}"
+                                       class="comment-edit-text-empty"
+                                       name="body"
+                                       placeholder="{{$comment}}"
+                                       onFocus="commentOpen(this,{{$id}}) && cmtBbOpen({{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
                                        <option value=""></option>
index 8515001..2621b03 100644 (file)
@@ -17,7 +17,7 @@
                                        <a class="comment-edit-photo-link" href="{{$mylink}}" title="{{$mytitle}}"><img class="my-comment-photo" src="{{$myphoto}}" alt="{{$mytitle}}" title="{{$mytitle}}" /></a>
                                </div>
                                <div class="comment-edit-photo-end"></div>
-                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,{{$id}});">{{$comment}}</textarea>
+                               <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty" name="body" placeholder="{{$comment}}" onFocus="commentOpen(this,{{$id}});"></textarea>
                                {{if $qcomment}}
                                        <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
                                        <option value=""></option>