]> git.mxchange.org Git - friendica.git/blob - view/theme/testbubble/smarty3/jot-header.tpl
965a91a80e1dde11b35320bef3387e7511f9aa8a
[friendica.git] / view / theme / testbubble / 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" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
7 <script language="javascript" type="text/javascript">
8
9 var editor=false;
10 var textlen = 0;
11 var plaintext = '{{$editselect}}';
12
13 function initEditor(cb) {
14     if (editor==false) {
15         $("#profile-jot-text-loading").show();
16  if(plaintext == 'none') {
17             $("#profile-jot-text-loading").hide();
18             $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
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 </script>
149 <script type="text/javascript" src="js/ajaxupload.js" ></script>
150 <script>
151     var ispublic = '{{$ispublic}}';
152         $(document).ready(function() {
153                 /* enable tinymce on focus */
154                 $("#profile-jot-text").focus(function(){
155                     if (editor) return;
156                     $(this).val("");
157                     initEditor();
158                 }); 
159
160
161                 var uploader = new window.AjaxUpload(
162                         'wall-image-upload',
163                         { action: 'wall_upload/{{$nickname}}',
164                                 name: 'userfile',
165                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
166                                 onComplete: function(file,response) {
167                                         addeditortext(response);
168                                         $('#profile-rotator').hide();
169                                 }                                
170                         }
171                 );
172                 var file_uploader = new window.AjaxUpload(
173                         'wall-file-upload',
174                         { action: 'wall_attach/{{$nickname}}',
175                                 name: 'userfile',
176                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
177                                 onComplete: function(file,response) {
178                                         addeditortext(response);
179                                         $('#profile-rotator').hide();
180                                 }                                
181                         }
182                 );              
183                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
184                         var selstr;
185                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
186                                 selstr = $(this).text();
187                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
188                                 $('#jot-public').hide();
189                                 $('.profile-jot-net input').attr('disabled', 'disabled');
190                         });
191                         if(selstr == null) { 
192                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
193                                 $('#jot-public').show();
194                                 $('.profile-jot-net input').attr('disabled', false);
195                         }
196
197                 }).trigger('change');
198
199         });
200
201         function deleteCheckedItems() {
202                 if(confirm('{{$delitems}}')) {
203                         var checkedstr = '';
204
205                         $("#item-delete-selected").hide();
206                         $('#item-delete-selected-rotator').show();
207
208                         $('.item-select').each( function() {
209                                 if($(this).is(':checked')) {
210                                         if(checkedstr.length != 0) {
211                                                 checkedstr = checkedstr + ',' + $(this).val();
212                                         }
213                                         else {
214                                                 checkedstr = $(this).val();
215                                         }
216                                 }       
217                         });
218                         $.post('item', { dropitems: checkedstr }, function(data) {
219                                 window.location.reload();
220                         });
221                 }
222         }
223
224         function jotGetLink() {
225                 reply = prompt("{{$linkurl}}");
226                 if(reply && reply.length) {
227                         reply = bin2hex(reply);
228                         $('#profile-rotator').show();
229                         $.get('parse_url?binurl=' + reply, function(data) {
230                                 addeditortext(data);
231                                 $('#profile-rotator').hide();
232                         });
233                 }
234         }
235
236         function jotVideoURL() {
237                 reply = prompt("{{$vidurl}}");
238                 if(reply && reply.length) {
239                         addeditortext('[video]' + reply + '[/video]');
240                 }
241         }
242
243         function jotAudioURL() {
244                 reply = prompt("{{$audurl}}");
245                 if(reply && reply.length) {
246                         addeditortext('[audio]' + reply + '[/audio]');
247                 }
248         }
249
250
251         function jotGetLocation() {
252                 reply = prompt("{{$whereareu}}", $('#jot-location').val());
253                 if(reply && reply.length) {
254                         $('#jot-location').val(reply);
255                 }
256         }
257
258         function jotTitle() {
259                 reply = prompt("{{$title}}", $('#jot-title').val());
260                 if(reply && reply.length) {
261                         $('#jot-title').val(reply);
262                 }
263         }
264
265         function jotShare(id) {
266                 $('#like-rotator-' + id).show();
267                 $.get('share/' + id, function(data) {
268                                 if (!editor) $("#profile-jot-text").val("");
269                                 initEditor(function(){
270                                         addeditortext(data);
271                                         $('#like-rotator-' + id).hide();
272                                         $(window).scrollTop(0);
273                                 });
274                 });
275         }
276
277         function linkdropper(event) {
278                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
279                 if(linkFound)
280                         event.preventDefault();
281         }
282
283         function linkdrop(event) {
284                 var reply = event.dataTransfer.getData("text/uri-list");
285                 event.target.textContent = reply;
286                 event.preventDefault();
287                 if(reply && reply.length) {
288                         reply = bin2hex(reply);
289                         $('#profile-rotator').show();
290                         $.get('parse_url?binurl=' + reply, function(data) {
291                                 if (!editor) $("#profile-jot-text").val("");
292                                 initEditor(function(){
293                                         addeditortext(data);
294                                         $('#profile-rotator').hide();
295                                 });
296                         });
297                 }
298         }
299
300         function itemTag(id) {
301                 reply = prompt("{{$term}}");
302                 if(reply && reply.length) {
303                         reply = reply.replace('#','');
304                         if(reply.length) {
305
306                                 commentBusy = true;
307                                 $('body').css('cursor', 'wait');
308
309                                 $.get('tagger/' + id + '?term=' + reply);
310                                 if(timer) clearTimeout(timer);
311                                 timer = setTimeout(NavUpdate,3000);
312                                 liking = 1;
313                         }
314                 }
315         }
316         
317         function itemFiler(id) {
318                 
319                 var bordercolor = $("input").css("border-color");
320                 
321                 $.get('filer/', function(data){
322                         $.fancybox(data);
323                         $("#id_term").keypress(function(){
324                                 $(this).css("border-color",bordercolor);
325                         })
326                         $("#select_term").change(function(){
327                                 $("#id_term").css("border-color",bordercolor);
328                         })
329                         
330                         $("#filer_save").click(function(e){
331                                 e.preventDefault();
332                                 reply = $("#id_term").val();
333                                 if(reply && reply.length) {
334                                         commentBusy = true;
335                                         $('body').css('cursor', 'wait');
336                                         $.get('filer/' + id + '?term=' + reply);
337                                         if(timer) clearTimeout(timer);
338                                         timer = setTimeout(NavUpdate,3000);
339                                         liking = 1;
340                                         $.fancybox.close();
341                                 } else {
342                                         $("#id_term").css("border-color","#FF0000");
343                                 }
344                                 return false;
345                         });
346                 });
347                 
348         }
349
350         
351
352         function jotClearLocation() {
353                 $('#jot-coord').val('');
354                 $('#profile-nolocation-wrapper').hide();
355         }
356
357   function addeditortext(data) {
358         if(plaintext == 'none') {
359             var currentText = $("#profile-jot-text").val();
360             $("#profile-jot-text").val(currentText + data);
361         }
362         else
363             tinyMCE.execCommand('mceInsertRawHTML',false,data);
364     }
365
366
367         {{$geotag}}
368
369 </script>
370