]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/smarty3/jot-header.tpl
df3bab160199b401d4fbca501f27fcf41fef55de
[friendica.git] / view / theme / smoothly / smarty3 / jot-header.tpl
1 {{*
2  *      AUTOMATICALLY GENERATED TEMPLATE
3  *      DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
4  *
5  *}}
6 <script language="javascript" type="text/javascript">
7
8 var editor=false;
9 var textlen = 0;
10 var plaintext = '{{$editselect}}';
11
12 function initEditor(cb){
13         if (editor==false){
14                 $("#profile-jot-text-loading").show();
15                 if(plaintext == 'none') {
16                         $("#profile-jot-text-loading").hide();
17                         $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
18                         $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
19                         $(".jothidden").show();
20                         editor = true;
21                         $("a#jot-perms-icon").fancybox({
22                                 'transitionIn' : 'elastic',
23                                 'transitionOut' : 'elastic'
24                         });
25                                     $("#profile-jot-submit-wrapper").show();
26                                                                 {{if $newpost}}
27                                     $("#profile-upload-wrapper").show();
28                                         $("#profile-attach-wrapper").show();
29                                     $("#profile-link-wrapper").show();
30                                         $("#profile-video-wrapper").show();
31                                     $("#profile-audio-wrapper").show();
32                                         $("#profile-location-wrapper").show();
33                                     $("#profile-nolocation-wrapper").show();
34                                         $("#profile-title-wrapper").show();
35                                         $("#profile-jot-plugin-wrapper").show();
36                                         $("#jot-preview-link").show();
37                                                                 {{/if}}   
38
39
40                         if (typeof cb!="undefined") cb();
41                         return;
42         }
43         tinyMCE.init({
44                 theme : "advanced",
45                 mode : "specific_textareas",
46                 editor_selector: /(profile-jot-text|prvmail-text)/,
47                 plugins : "bbcode,paste,fullscreen,autoresize",
48                 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
49                 theme_advanced_buttons2 : "",
50                 theme_advanced_buttons3 : "",
51                 theme_advanced_toolbar_location : "top",
52                 theme_advanced_toolbar_align : "center",
53                 theme_advanced_blockformats : "blockquote,code",
54                 //theme_advanced_resizing : true,
55                 //theme_advanced_statusbar_location : "bottom",
56                 paste_text_sticky : true,
57                 entity_encoding : "raw",
58                 add_unload_trigger : false,
59                 remove_linebreaks : false,
60                 force_p_newlines : false,
61                 force_br_newlines : true,
62                 forced_root_block : '',
63                 convert_urls: false,
64                 content_css: "{{$baseurl}}/view/custom_tinymce.css",
65                 theme_advanced_path : false,
66                 setup : function(ed) {
67                                         cPopup = null;
68                                         ed.onKeyDown.add(function(ed,e) {
69                                                 if(cPopup !== null)
70                                                         cPopup.onkey(e);
71                                         });
72
73
74
75                                         ed.onKeyUp.add(function(ed, e) {
76                                                 var txt = tinyMCE.activeEditor.getContent();
77                                                 match = txt.match(/@([^ \n]+)$/);
78                                                 if(match!==null) {
79                                                         if(cPopup === null) {
80                                                                 cPopup = new ACPopup(this,baseurl+"/acl");
81                                                         }
82                                                         if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
83                                                         if(! cPopup.ready) cPopup = null;
84                                                 }
85                                                 else {
86                                                         if(cPopup !== null) { cPopup.close(); cPopup = null; }
87                                                 }
88
89                                                 textlen = txt.length;
90                                                 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
91                                                         $('#profile-jot-desc').html(ispublic);
92                                                 }
93                         else {
94                             $('#profile-jot-desc').html('&nbsp;');
95                         }
96
97                                 //Character count
98
99                                 if(textlen <= 140) {
100                                         $('#character-counter').removeClass('red');
101                                         $('#character-counter').removeClass('orange');
102                                         $('#character-counter').addClass('grey');
103                                 }
104                                 if((textlen > 140) && (textlen <= 420)) {
105                                         $('#character-counter').removeClass('grey');
106                                         $('#character-counter').removeClass('red');
107                                         $('#character-counter').addClass('orange');
108                                 }
109                                 if(textlen > 420) {
110                                         $('#character-counter').removeClass('grey');
111                                         $('#character-counter').removeClass('orange');
112                                         $('#character-counter').addClass('red');
113                                 }
114                                 $('#character-counter').text(textlen);
115                         });
116                         ed.onInit.add(function(ed) {
117                                 ed.pasteAsPlainText = true;
118                                                                 $("#profile-jot-text-loading").hide();
119                                                                 $(".jothidden").show();
120                                     $("#profile-jot-submit-wrapper").show();
121                                                                 {{if $newpost}}
122                                     $("#profile-upload-wrapper").show();
123                                         $("#profile-attach-wrapper").show();
124                                     $("#profile-link-wrapper").show();
125                                         $("#profile-video-wrapper").show();
126                                     $("#profile-audio-wrapper").show();
127                                         $("#profile-location-wrapper").show();
128                                     $("#profile-nolocation-wrapper").show();
129                                         $("#profile-title-wrapper").show();
130                                         $("#profile-jot-plugin-wrapper").show();
131                                         $("#jot-preview-link").show();
132                                                                 {{/if}}   
133                              $("#character-counter").show();
134                                 if (typeof cb!="undefined") cb();
135                         });
136                 }
137         });
138         editor = true;
139         // setup acl popup
140         $("a#jot-perms-icon").fancybox({
141             'transitionIn' : 'none',
142             'transitionOut' : 'none'
143         }); 
144     } else {
145         if (typeof cb!="undefined") cb();
146     }
147 } // initEditor
148
149 function enableOnUser(){
150         if (editor) return;
151         $(this).val("");
152         initEditor();
153 }
154
155 </script>
156
157 <script type="text/javascript" src="js/ajaxupload.js" >
158 </script>
159
160 <script>
161         var ispublic = '{{$ispublic}}';
162
163         $(document).ready(function() {
164                 
165                 /* enable tinymce on focus and click */
166                 $("#profile-jot-text").focus(enableOnUser);
167                 $("#profile-jot-text").click(enableOnUser);
168
169                 var uploader = new window.AjaxUpload(
170                         'wall-image-upload',
171                         { action: 'wall_upload/{{$nickname}}',
172                                 name: 'userfile',
173                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
174                                 onComplete: function(file,response) {
175                                         addeditortext(response);
176                                         $('#profile-rotator').hide();
177                                 }                                
178                         }
179                 );
180
181                 var file_uploader = new window.AjaxUpload(
182                         'wall-file-upload',
183                         { action: 'wall_attach/{{$nickname}}',
184                                 name: 'userfile',
185                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
186                                 onComplete: function(file,response) {
187                                         addeditortext(response);
188                                         $('#profile-rotator').hide();
189                                 }                                
190                         }
191                 );              
192                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
193                         var selstr;
194                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
195                                 selstr = $(this).text();
196                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
197                                 $('#jot-public').hide();
198                                 $('.profile-jot-net input').attr('disabled', 'disabled');
199                         });
200                         if(selstr == null) { 
201                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
202                                 $('#jot-public').show();
203                                 $('.profile-jot-net input').attr('disabled', false);
204                         }
205
206                 }).trigger('change');
207
208         });
209
210         function deleteCheckedItems() {
211                 if(confirm('{{$delitems}}')) {
212                         var checkedstr = '';
213
214                         $("#item-delete-selected").hide();
215                         $('#item-delete-selected-rotator').show();
216
217                         $('.item-select').each( function() {
218                                 if($(this).is(':checked')) {
219                                         if(checkedstr.length != 0) {
220                                                 checkedstr = checkedstr + ',' + $(this).val();
221                                         }
222                                         else {
223                                                 checkedstr = $(this).val();
224                                         }
225                                 }       
226                         });
227                         $.post('item', { dropitems: checkedstr }, function(data) {
228                                 window.location.reload();
229                         });
230                 }
231         }
232
233         function jotGetLink() {
234                 reply = prompt("{{$linkurl}}");
235                 if(reply && reply.length) {
236                         reply = bin2hex(reply);
237                         $('#profile-rotator').show();
238                         $.get('parse_url?binurl=' + reply, function(data) {
239                                 addeditortext(data);
240                                 $('#profile-rotator').hide();
241                         });
242                 }
243         }
244
245         function jotVideoURL() {
246                 reply = prompt("{{$vidurl}}");
247                 if(reply && reply.length) {
248                         addeditortext('[video]' + reply + '[/video]');
249                 }
250         }
251
252         function jotAudioURL() {
253                 reply = prompt("{{$audurl}}");
254                 if(reply && reply.length) {
255                         addeditortext('[audio]' + reply + '[/audio]');
256                 }
257         }
258
259
260         function jotGetLocation() {
261                 reply = prompt("{{$whereareu}}", $('#jot-location').val());
262                 if(reply && reply.length) {
263                         $('#jot-location').val(reply);
264                 }
265         }
266
267         function jotTitle() {
268                 reply = prompt("{{$title}}", $('#jot-title').val());
269                 if(reply && reply.length) {
270                         $('#jot-title').val(reply);
271                 }
272         }
273
274         function jotShare(id) {
275                 $('#like-rotator-' + id).show();
276                 $.get('share/' + id, function(data) {
277                                 if (!editor) $("#profile-jot-text").val("");
278                                 initEditor(function(){
279                                         addeditortext(data);
280                                         $('#like-rotator-' + id).hide();
281                                         $(window).scrollTop(0);
282                                 });
283                 });
284         }
285
286         function linkdropper(event) {
287                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
288                 if(linkFound)
289                         event.preventDefault();
290         }
291
292         function linkdrop(event) {
293                 var reply = event.dataTransfer.getData("text/uri-list");
294                 event.target.textContent = reply;
295                 event.preventDefault();
296                 if(reply && reply.length) {
297                         reply = bin2hex(reply);
298                         $('#profile-rotator').show();
299                         $.get('parse_url?binurl=' + reply, function(data) {
300                                 if (!editor) $("#profile-jot-text").val("");
301                                 initEditor(function(){
302                                         addeditortext(data);
303                                         $('#profile-rotator').hide();
304                                 });
305                         });
306                 }
307         }
308
309         function itemTag(id) {
310                 reply = prompt("{{$term}}");
311                 if(reply && reply.length) {
312                         reply = reply.replace('#','');
313                         if(reply.length) {
314
315                                 commentBusy = true;
316                                 $('body').css('cursor', 'wait');
317
318                                 $.get('tagger/' + id + '?term=' + reply);
319                                 if(timer) clearTimeout(timer);
320                                 timer = setTimeout(NavUpdate,3000);
321                                 liking = 1;
322                         }
323                 }
324         }
325         
326         function itemFiler(id) {
327                 
328                 var bordercolor = $("input").css("border-color");
329                 
330                 $.get('filer/', function(data){
331                         $.fancybox(data);
332                         $("#id_term").keypress(function(){
333                                 $(this).css("border-color",bordercolor);
334                         })
335                         $("#select_term").change(function(){
336                                 $("#id_term").css("border-color",bordercolor);
337                         })
338                         
339                         $("#filer_save").click(function(e){
340                                 e.preventDefault();
341                                 reply = $("#id_term").val();
342                                 if(reply && reply.length) {
343                                         commentBusy = true;
344                                         $('body').css('cursor', 'wait');
345                                         $.get('filer/' + id + '?term=' + reply, NavUpdate);
346 //                                      if(timer) clearTimeout(timer);
347 //                                      timer = setTimeout(NavUpdate,3000);
348                                         liking = 1;
349                                         $.fancybox.close();
350                                 } else {
351                                         $("#id_term").css("border-color","#FF0000");
352                                 }
353                                 return false;
354                         });
355                 });
356                 
357         }
358
359         
360
361         function jotClearLocation() {
362                 $('#jot-coord').val('');
363                 $('#profile-nolocation-wrapper').hide();
364         }
365
366   function addeditortext(data) {
367         if(plaintext == 'none') {
368             var currentText = $("#profile-jot-text").val();
369             $("#profile-jot-text").val(currentText + data);
370         }
371         else
372             tinyMCE.execCommand('mceInsertRawHTML',false,data);
373     }
374
375
376         {{$geotag}}
377
378 </script>