]> git.mxchange.org Git - friendica.git/commitdiff
head.tpl move strings to js strings into the html <head> so we can move the js script...
authorrabuzarus <>
Sat, 7 May 2016 23:31:30 +0000 (01:31 +0200)
committerrabuzarus <>
Sat, 7 May 2016 23:31:30 +0000 (01:31 +0200)
js/textedit.js
templates/comment_item.tpl
templates/head.tpl
templates/js_strings.tpl [new file with mode: 0644]

index f7d5ee57f6b021c67b8071ef0c286de181862b3d..be4cd770a8a2f0c580679bb167d38c1caa67cac1 100644 (file)
@@ -63,7 +63,7 @@ function commentExpand(id) {
 
 function commentClose(obj,id) {
        if(obj.value == '') {
-               obj.value = '{{$comment}}';
+               obj.value = aStr.comment;
                $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
                $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
                $("#mod-cmnt-wrap-" + id).hide();
@@ -81,3 +81,83 @@ function showHideCommentBox(id) {
                $('#comment-edit-form-' + id).show();
        }
 }
+
+function commentOpenUI(obj, id) {
+       $(document).unbind( "click.commentOpen", handler );
+
+       var handler = function() {
+               if(obj.value == aStr.comment) {
+                       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
+                       $("#comment-edit-text-" + id).attr('tabindex','9');
+                       $("#comment-edit-submit-" + id).attr('tabindex','10');
+                       $("#comment-edit-submit-wrapper-" + id).show();
+               }
+       };
+
+       $(document).bind( "click.commentOpen", handler );
+}
+
+function commentCloseUI(obj, id) {
+       $(document).unbind( "click.commentClose", handler );
+
+       var handler = function() {
+               if(obj.value === '') {
+               obj.value = aStr.comment;
+                       $("#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');
+                       $("#comment-edit-submit-wrapper-" + id).hide();
+               }
+       };
+
+       $(document).bind( "click.commentClose", handler );
+}
+function commentOpen(obj,id) {
+       if(obj.value == aStr.comment) {
+               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();
+               openMenu("comment-edit-submit-wrapper-" + id);
+               return true;
+       }
+       return false;
+}
+
+function commentInsert(obj,id) {
+       var tmpStr = $("#comment-edit-text-" + id).val();
+       if(tmpStr == aStr.comment) {
+               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);
+       }
+       var ins = $(obj).html();
+       ins = ins.replace('&lt;','<');
+       ins = ins.replace('&gt;','>');
+       ins = ins.replace('&amp;','&');
+       ins = ins.replace('&quot;','"');
+       $("#comment-edit-text-" + id).val(tmpStr + ins);
+}
+
+function qCommentInsert(obj,id) {
+       var tmpStr = $("#comment-edit-text-" + id).val();
+       if(tmpStr == aStr.comment) {
+               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);
+       }
+       var ins = $(obj).val();
+       ins = ins.replace('&lt;','<');
+       ins = ins.replace('&gt;','>');
+       ins = ins.replace('&amp;','&');
+       ins = ins.replace('&quot;','"');
+       $("#comment-edit-text-" + id).val(tmpStr + ins);
+       $(obj).val('');
+}
+
+function confirmDelete() { return confirm(aStr.delitem); }
index b430ff7e61e76490ec8e5e4cd825fce02e42704d..116a7b7d4d4dfd83ba6bd0d4c6202a30345c8361 100644 (file)
@@ -1,39 +1,3 @@
-<script>
-       function commentOpenUI(obj, id) {
-               $(document).unbind( "click.commentOpen", handler );
-
-               var handler = function() {
-                       if(obj.value == '{{$comment}}') {
-                               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
-                               $("#comment-edit-text-" + id).attr('tabindex','9');
-                               $("#comment-edit-submit-" + id).attr('tabindex','10');
-                               $("#comment-edit-submit-wrapper-" + id).show();
-                       }
-               };
-
-               $(document).bind( "click.commentOpen", handler );
-}
-
-       function commentCloseUI(obj, id) {
-               $(document).unbind( "click.commentClose", handler );
-
-               var handler = function() {
-                       if(obj.value === '') {
-                       obj.value = '{{$comment}}';
-                               $("#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');
-                               $("#comment-edit-submit-wrapper-" + id).hide();
-                       }
-               };
-
-               $(document).bind( "click.commentClose", handler );
-       }
-
-</script>
 
 {{if $threaded}}
 <div class="comment-wwedit-wrapper threaded" id="comment-edit-wrapper-{{$id}}" style="display: block;">
index ba48228b984b5da137066fddfcb5cbb460d0682b..afdfaa7857cfd946a32f49f7bd7e7daefb2d0e82 100644 (file)
 <script type="text/javascript" src="view/theme/frio/js/textedit.js"></script>
 
 <script>
-
-       var updateInterval = {{$update_interval}};
-       var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
-
-       function confirmDelete() { return confirm("{{$delitem}}"); }
-
-       function commentOpen(obj,id) {
-               if(obj.value == '{{$comment}}') {
-                       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();
-                       openMenu("comment-edit-submit-wrapper-" + id);
-                       return true;
-               }
-               return false;
-       }
-
-       function commentInsert(obj,id) {
-               var tmpStr = $("#comment-edit-text-" + id).val();
-               if(tmpStr == '{{$comment}}') {
-                       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);
-               }
-               var ins = $(obj).html();
-               ins = ins.replace('&lt;','<');
-               ins = ins.replace('&gt;','>');
-               ins = ins.replace('&amp;','&');
-               ins = ins.replace('&quot;','"');
-               $("#comment-edit-text-" + id).val(tmpStr + ins);
-       }
-
-       function qCommentInsert(obj,id) {
-               var tmpStr = $("#comment-edit-text-" + id).val();
-               if(tmpStr == '{{$comment}}') {
-                       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);
-               }
-               var ins = $(obj).val();
-               ins = ins.replace('&lt;','<');
-               ins = ins.replace('&gt;','>');
-               ins = ins.replace('&amp;','&');
-               ins = ins.replace('&quot;','"');
-               $("#comment-edit-text-" + id).val(tmpStr + ins);
-               $(obj).val('');
-       }
-
        window.showMore = "{{$showmore}}";
        window.showFewer = "{{$showfewer}}";
 </script>
+
+{{* Include the strings which are needed for some js functions (e.g. translation)
+They are loaded into the html <head> so that js functions can use them *}}
+{{include file="js_strings.tpl"}}
diff --git a/templates/js_strings.tpl b/templates/js_strings.tpl
new file mode 100644 (file)
index 0000000..0535c70
--- /dev/null
@@ -0,0 +1,13 @@
+
+
+{{* Strings which are needed for some js functions (e.g. translation or the interval for page update)
+They are loaded into the html <head> so that js functions can use them *}}
+<script>
+       var updateInterval = {{$update_interval}};
+
+       var localUser = {{if $local_user}}{{$local_user}}{{else}}false{{/if}};
+       var aStr = {
+               'delitem'     : "{{$delitem}}",
+               'comment'     : "{{$comment}}"
+       };
+</script>