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