]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/templates/jot-header.tpl
Merge pull request #12501 from MarekBenjamin/improve-registraiton-text-input
[friendica.git] / view / theme / smoothly / templates / jot-header.tpl
1
2
3 <script language="javascript" type="text/javascript">
4
5 var editor = false;
6 var textlen = 0;
7
8 function initEditor(callback) {
9         if (editor == false){
10                 $("#profile-jot-text-loading").show();
11                 $("#profile-jot-text-loading").hide();
12                 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
13                 $("#profile-jot-text").editor_autocomplete(baseurl + '/search/acl');
14                 $("#profile-jot-text").bbco_autocomplete('bbcode');
15                 $(".jothidden").show();
16                 $("a#jot-perms-icon").colorbox({
17                         'inline' : true,
18                         'transition' : 'elastic'
19                 });
20                 $("#profile-jot-submit-wrapper").show();
21         {{if $newpost}}
22                 $("#profile-upload-wrapper").show();
23                 $("#profile-attach-wrapper").show();
24                 $("#profile-link-wrapper").show();
25                 $("#profile-video-wrapper").show();
26                 $("#profile-audio-wrapper").show();
27                 $("#profile-location-wrapper").show();
28                 $("#profile-nolocation-wrapper").show();
29                 $("#profile-title-wrapper").show();
30                 $("#profile-jot-plugin-wrapper").show();
31                 $("#jot-preview-link").show();
32         {{/if}}
33
34                 editor = true;
35     }
36         if (typeof callback != "undefined") {
37                 callback();
38         }
39 } // initEditor
40
41 function enableOnUser(){
42         if (editor) {
43                 return;
44         }
45         $(this).val("");
46         initEditor();
47 }
48
49 </script>
50
51 <script type="text/javascript" src="view/js/ajaxupload.js?v={{$smarty.const.FRIENDICA_VERSION}}">
52 </script>
53
54 <script>
55         var ispublic = '{{$ispublic nofilter}}';
56
57         $(document).ready(function() {
58
59                 /* enable editor on focus and click */
60                 $("#profile-jot-text")
61                         .focus(enableOnUser)
62                         .click(enableOnUser);
63
64                 var uploader = new window.AjaxUpload(
65                         'wall-image-upload',
66                         { action: 'profile/{{$nickname}}/photos/upload',
67                                 name: 'userfile',
68                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
69                                 onComplete: function(file,response) {
70                                         addeditortext(response);
71                                         $('#profile-rotator').hide();
72                                 }
73                         }
74                 );
75
76                 var file_uploader = new window.AjaxUpload(
77                         'wall-file-upload',
78                         { action: 'profile/{{$nickname}}/attachment/upload',
79                                 name: 'userfile',
80                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
81                                 onComplete: function(file,response) {
82                                         addeditortext(response);
83                                         $('#profile-rotator').hide();
84                                 }
85                         }
86                 );
87                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
88                         var selstr;
89                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
90                                 selstr = $(this).html();
91                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
92                                 $('#jot-public').hide();
93                                 $('.profile-jot-net input').attr('disabled', 'disabled');
94                         });
95                         if(selstr == null) {
96                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
97                                 $('#jot-public').show();
98                                 $('.profile-jot-net input').attr('disabled', false);
99                         }
100
101                 }).trigger('change');
102
103         });
104
105         function deleteCheckedItems() {
106                 if(confirm('{{$delitems}}')) {
107                         var checkedstr = '';
108
109                         $("#item-delete-selected").hide();
110                         $('#item-delete-selected-rotator').show();
111
112                         $('.item-select').each( function() {
113                                 if($(this).is(':checked')) {
114                                         if(checkedstr.length != 0) {
115                                                 checkedstr = checkedstr + ',' + $(this).val();
116                                         }
117                                         else {
118                                                 checkedstr = $(this).val();
119                                         }
120                                 }
121                         });
122                         $.post('item', { dropitems: checkedstr }, function(data) {
123                                 window.location.reload();
124                         });
125                 }
126         }
127
128         function jotGetLink() {
129                 reply = prompt("{{$linkurl}}");
130                 if(reply && reply.length) {
131                         reply = bin2hex(reply);
132                         $('#profile-rotator').show();
133                         $.get('parseurl?binurl=' + reply, function(data) {
134                                 addeditortext(data);
135                                 $('#profile-rotator').hide();
136                         });
137                 }
138         }
139
140         function jotVideoURL() {
141                 reply = prompt("{{$vidurl}}");
142                 if(reply && reply.length) {
143                         addeditortext('[video]' + reply + '[/video]');
144                 }
145         }
146
147         function jotAudioURL() {
148                 reply = prompt("{{$audurl}}");
149                 if(reply && reply.length) {
150                         addeditortext('[audio]' + reply + '[/audio]');
151                 }
152         }
153
154
155         function jotGetLocation() {
156                 reply = prompt("{{$whereareu}}", $('#jot-location').val());
157                 if(reply && reply.length) {
158                         $('#jot-location').val(reply);
159                 }
160         }
161
162         function jotTitle() {
163                 reply = prompt("{{$title}}", $('#jot-title').val());
164                 if(reply && reply.length) {
165                         $('#jot-title').val(reply);
166                 }
167         }
168
169         function jotShare(id) {
170                 $('#like-rotator-' + id).show();
171                 $.get('post/' + id + '/share', function(data) {
172                         if (!editor) $("#profile-jot-text").val("");
173                         initEditor(function(){
174                                 addeditortext(data);
175                                 $('#like-rotator-' + id).hide();
176                                 $(window).scrollTop(0);
177                         });
178                 });
179         }
180
181         function linkdropper(event) {
182                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
183                 if(linkFound)
184                         event.preventDefault();
185         }
186
187         function linkdrop(event) {
188                 var reply = event.dataTransfer.getData("text/uri-list");
189                 event.target.textContent = reply;
190                 event.preventDefault();
191                 if(reply && reply.length) {
192                         reply = bin2hex(reply);
193                         $('#profile-rotator').show();
194                         $.get('parseurl?binurl=' + reply, function(data) {
195                                 if (!editor) $("#profile-jot-text").val("");
196                                 initEditor(function(){
197                                         addeditortext(data);
198                                         $('#profile-rotator').hide();
199                                 });
200                         });
201                 }
202         }
203
204         function itemTag(id) {
205                 reply = prompt("{{$term}}");
206                 if(reply && reply.length) {
207                         reply = reply.replace('#','');
208                         if(reply.length) {
209
210                                 commentBusy = true;
211                                 $('body').css('cursor', 'wait');
212
213                                 $.post('post/' + id + '/tag/add', {term: reply});
214                                 if(timer) clearTimeout(timer);
215                                 timer = setTimeout(NavUpdate,3000);
216                                 liking = 1;
217                         }
218                 }
219         }
220
221         function itemFiler(id) {
222
223                 var bordercolor = $("input").css("border-color");
224
225                 $.get('filer/', function(data){
226                         $.colorbox({html:data});
227                         $("#id_term").keypress(function(){
228                                 $(this).css("border-color",bordercolor);
229                         })
230                         $("#select_term").change(function(){
231                                 $("#id_term").css("border-color",bordercolor);
232                         })
233
234                         $("#filer_save").click(function(e){
235                                 e.preventDefault();
236                                 reply = $("#id_term").val();
237                                 if(reply && reply.length) {
238                                         commentBusy = true;
239                                         $('body').css('cursor', 'wait');
240                                         $.get('filer/' + id + '?term=' + reply, NavUpdate);
241 //                                      if(timer) clearTimeout(timer);
242 //                                      timer = setTimeout(NavUpdate,3000);
243                                         liking = 1;
244                                         force_update = true;
245                                         $.colorbox.close();
246                                 } else {
247                                         $("#id_term").css("border-color","#FF0000");
248                                 }
249                                 return false;
250                         });
251                 });
252
253         }
254
255
256
257         function jotClearLocation() {
258                 $('#jot-coord').val('');
259                 $('#profile-nolocation-wrapper').hide();
260         }
261
262         function addeditortext(data) {
263                 var currentText = $("#profile-jot-text").val();
264                 $("#profile-jot-text").val(currentText + data);
265         }
266
267
268         {{$geotag nofilter}}
269
270 </script>