]> git.mxchange.org Git - friendica.git/blob - view/theme/frio/templates/comment_item.tpl
cfc44ceb2ffe8dd6b47350c9fefc38284d9da9eb
[friendica.git] / view / theme / frio / templates / comment_item.tpl
1
2 {{if $threaded}}
3 <div class="comment-wwedit-wrapper threaded dropzone" id="comment-edit-wrapper-{{$id}}">
4 {{else}}
5 <div class="comment-wwedit-wrapper dropzone" id="comment-edit-wrapper-{{$id}}">
6 {{/if}}
7         <form class="comment-edit-form" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="item" method="post">
8                 <input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
9                 <input type="hidden" name="parent" value="{{$parent}}" />
10                 {{*<!--<input type="hidden" name="return" value="{{$return_path}}" />-->*}}
11                 <input type="hidden" name="jsreload" value="{{$jsreload}}" />
12                 <input type="hidden" name="post_id_random" value="{{$rand_num}}" />
13
14                 <p class="comment-edit-bb-{{$id}} comment-icon-list">
15                         <span>
16                                 <button type="button" class="btn btn-sm template-icon bb-img" style="cursor: pointer;" aria-label="{{$edimg}}" title="{{$edimg}}" data-role="insert-formatting" data-bbcode="img" data-id="{{$id}}">
17                                         <i class="fa fa-picture-o"></i>
18                                 </button>
19                                 <button type="button" class="btn btn-sm template-icon bb-attach" style="cursor: pointer;" aria-label="{{$edattach}}" title="{{$edattach}}" ondragenter="return commentLinkDrop(event, {{$id}});" ondragover="return commentLinkDrop(event, {{$id}});" ondrop="commentLinkDropper(event);" onclick="commentGetLink({{$id}}, '{{$prompttext}}');">
20                                         <i class="fa fa-paperclip"></i>
21                                 </button>
22                         </span>
23                         <span>
24                                 <button type="button" class="btn btn-sm template-icon bb-url" style="cursor: pointer;" aria-label="{{$edurl}}" title="{{$edurl}}" onclick="insertFormatting('url',{{$id}});">
25                                         <i class="fa fa-link"></i>
26                                 </button>
27                                 <button type="button" class="btn btn-sm template-icon underline" style="cursor: pointer;" aria-label="{{$eduline}}" title="{{$eduline}}" onclick="insertFormatting('u',{{$id}});">
28                                         <i class="fa fa-underline"></i>
29                                 </button>
30                                 <button type="button" class="btn btn-sm template-icon italic" style="cursor: pointer;" aria-label="{{$editalic}}" title="{{$editalic}}" onclick="insertFormatting('i',{{$id}});">
31                                         <i class="fa fa-italic"></i>
32                                 </button>
33                                 <button type="button" class="btn btn-sm template-icon bold" style="cursor: pointer;" aria-label="{{$edbold}}" title="{{$edbold}}" onclick="insertFormatting('b',{{$id}});">
34                                         <i class="fa fa-bold"></i>
35                                 </button>
36                                 <button type="button" class="btn btn-sm template-icon quote" style="cursor: pointer;" aria-label="{{$edquote}}" title="{{$edquote}}" onclick="insertFormatting('quote',{{$id}});">
37                                         <i class="fa fa-quote-left"></i>
38                                 </button>
39                         </span>
40                 </p>
41                 <p>
42                         <textarea id="comment-edit-text-{{$id}}" class="comment-edit-text-empty form-control text-autosize" name="body" placeholder="{{$comment}}" rows="3" data-default="{{$default}}" dir="auto">{{$default}}</textarea>
43                 </p>
44 {{if $qcomment}}
45                 <p>
46                         <select id="qcomment-select-{{$id}}" name="qcomment-{{$id}}" class="qcomment" onchange="qCommentInsert(this,{{$id}});">
47                                 <option value=""></option>
48         {{foreach $qcomment as $qc}}
49                                 <option value="{{$qc}}">{{$qc}}</option>
50         {{/foreach}}
51                         </select>
52                 </p>
53 {{/if}}
54
55                 <p class="comment-edit-submit-wrapper">
56 {{if $preview}}
57                         <button type="button" class="btn btn-default comment-edit-preview" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}"><i class="fa fa-eye"></i> {{$preview}}</button>
58 {{/if}}
59                         <button type="submit" class="btn btn-primary comment-edit-submit" id="comment-edit-submit-{{$id}}" name="submit" data-loading-text="{{$loading}}"><i class="fa fa-envelope"></i> {{$submit}}</button>
60                 </p>
61
62                 <div class="comment-edit-end clear"></div>
63         </form>
64         <div id="dz-preview-{{$id}}" class="dropzone-preview"></div>
65         <div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
66 </div>
67
68 <script>
69         Dropzone.autoDiscover = false;
70         console.log('comment_item.tpl', {{$max_imagesize}} / 100000);
71         var maxis = {{$max_imagesize}} / 100000;
72         var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
73                 paramName: "userfile", // The name that will be used to transfer the file
74                 maxFilesize: maxis, // MB
75                 previewsContainer: '#dz-preview-{{$id}}',
76                 preventDuplicates: true,
77                 clickable: true,
78                 thumbnailWidth: 100,
79                 thumbnailHeight: 100,
80                 url: "/media/photo/upload?response=url&album=",
81                 accept: function(file, done) {
82                         done();
83                 },
84                 init: function() {
85                         this.on("success", function(file, serverResponse) {
86                                 var target = $('#comment-edit-text-{{$id}}')
87                                 var resp = $(serverResponse).find('div#content').text()
88                                 if (target.setRangeText) {
89                                         //if setRangeText function is supported by current browser
90                                         target.setRangeText(" " + $.trim(resp) + " ")
91                                 } else {
92                                         target.focus()
93                                         document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
94                                 }
95                         });
96                 },
97         });
98         
99         $('#comment-edit-wrapper-{{$id}}').on('paste', function(event){
100                 const items = (event.clipboardData || event.originalEvent.clipboardData).items;
101                 items.forEach((item) => {
102                         if (item.kind === 'file') {
103                                 // adds the file to your dropzone instance
104                                 dropzone{{$id}}.addFile(item.getAsFile())
105                         }
106                 })
107         });
108 </script>