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