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