]> git.mxchange.org Git - friendica.git/blob - view/theme/testbubble/jot-header.tpl
Merge remote branch 'upstream/master'
[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                      //Character count
36                         ed.onKeyUp.add(function(ed, e) {
37                                 var txt = tinyMCE.activeEditor.getContent();
38                                 textlen = txt.length;
39                                 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
40                                         $('#profile-jot-desc').html(ispublic);
41                                 }
42                                 else {
43                                         $('#profile-jot-desc').html('&nbsp;');
44                                 }
45
46                                 if(textlen <= 140) {
47                                         $('#character-counter').removeClass('red');
48                                         $('#character-counter').removeClass('orange');
49                                         $('#character-counter').addClass('grey');
50                                 }
51                                 if((textlen > 140) && (textlen <= 420)) {
52                                         $('#character-counter').removeClass('grey');
53                                         $('#character-counter').removeClass('red');
54                                         $('#character-counter').addClass('orange');
55                                 }
56                                 if(textlen > 420) {
57                                         $('#character-counter').removeClass('grey');
58                                         $('#character-counter').removeClass('orange');
59                                         $('#character-counter').addClass('red');
60                                 }
61                                 $('#character-counter').text(textlen);
62                         });
63                         ed.onInit.add(function(ed) {
64                                 ed.pasteAsPlainText = true;
65                                 $("#profile-jot-text-loading").hide();
66                                 $("#profile-jot-submit-wrapper").show();
67                                 $("#profile-upload-wrapper").show();
68                                 $("#profile-attach-wrapper").show();
69                                 $("#profile-link-wrapper").show();
70                                 $("#profile-youtube-wrapper").show();
71                                 $("#profile-video-wrapper").show();
72                                 $("#profile-audio-wrapper").show();
73                                 $("#profile-location-wrapper").show();
74                                 $("#profile-nolocation-wrapper").show();
75                                 $("#profile-title-wrapper").show();
76                                 $("#profile-jot-plugin-wrapper").show();
77                                 $("#character-counter").show();
78                                 if (typeof cb!="undefined") cb();
79                         });
80                 }
81         });
82         editor = true;
83         // setup acl popup
84         $("a#jot-perms-icon").fancybox({
85             'transitionIn' : 'none',
86             'transitionOut' : 'none'
87         }); 
88     } else {
89         if (typeof cb!="undefined") cb();
90     }
91 } // initEditor
92 </script>
93 <script type="text/javascript" src="js/ajaxupload.js" ></script>
94 <script>
95     var ispublic = '$ispublic';
96         $(document).ready(function() {
97                 /* enable tinymce on focus */
98                 $("#profile-jot-text").focus(function(){
99                     if (editor) return;
100                     $(this).val("");
101                     initEditor();
102                 }); 
103                 var uploader = new window.AjaxUpload(
104                         'wall-image-upload',
105                         { action: 'wall_upload/$nickname',
106                                 name: 'userfile',
107                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
108                                 onComplete: function(file,response) {
109                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
110                                         $('#profile-rotator').hide();
111                                 }                                
112                         }
113                 );
114                 var file_uploader = new window.AjaxUpload(
115                         'wall-file-upload',
116                         { action: 'wall_attach/$nickname',
117                                 name: 'userfile',
118                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
119                                 onComplete: function(file,response) {
120                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
121                                         $('#profile-rotator').hide();
122                                 }                                
123                         }
124                 );              
125                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
126                         var selstr;
127                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
128                                 selstr = $(this).text();
129                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
130                                 $('#jot-public').hide();
131                                 $('.profile-jot-net input').attr('disabled', 'disabled');
132                         });
133                         if(selstr == null) { 
134                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
135                                 $('#jot-public').show();
136                                 $('.profile-jot-net input').attr('disabled', false);
137                         }
138
139                 }).trigger('change');
140
141         });
142
143         function deleteCheckedItems() {
144                 var checkedstr = '';
145
146                 $('.item-select').each( function() {
147                         if($(this).is(':checked')) {
148                                 if(checkedstr.length != 0) {
149                                         checkedstr = checkedstr + ',' + $(this).val();
150                                 }
151                                 else {
152                                         checkedstr = $(this).val();
153                                 }
154                         }       
155                 });
156                 $.post('item', { dropitems: checkedstr }, function(data) {
157                         window.location.reload();
158                 });
159         }
160
161         function jotGetLink() {
162                 reply = prompt("$linkurl");
163                 if(reply && reply.length) {
164                         reply = bin2hex(reply);
165                         $('#profile-rotator').show();
166                         $.get('parse_url?url=' + reply, function(data) {
167                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
168                                 $('#profile-rotator').hide();
169                         });
170                 }
171         }
172
173         function jotGetVideo() {
174                 reply = prompt("$utubeurl");
175                 if(reply && reply.length) {
176                         tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
177                 }
178         }
179
180         function jotVideoURL() {
181                 reply = prompt("$vidurl");
182                 if(reply && reply.length) {
183                         tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
184                 }
185         }
186
187         function jotAudioURL() {
188                 reply = prompt("$audurl");
189                 if(reply && reply.length) {
190                         tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
191                 }
192         }
193
194
195         function jotGetLocation() {
196                 reply = prompt("$whereareu", $('#jot-location').val());
197                 if(reply && reply.length) {
198                         $('#jot-location').val(reply);
199                 }
200         }
201
202         function jotTitle() {
203                 reply = prompt("$title", $('#jot-title').val());
204                 if(reply && reply.length) {
205                         $('#jot-title').val(reply);
206                 }
207         }
208
209         function jotShare(id) {
210                 $('#like-rotator-' + id).show();
211                 $.get('share/' + id, function(data) {
212                                 if (!editor) $("#profile-jot-text").val("");
213                                 initEditor(function(){
214                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
215                                         $('#like-rotator-' + id).hide();
216                                         $(window).scrollTop(0);
217                                 });
218                 });
219         }
220
221         function linkdropper(event) {
222                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
223                 if(linkFound)
224                         event.preventDefault();
225         }
226
227         function linkdrop(event) {
228                 var reply = event.dataTransfer.getData("text/uri-list");
229                 event.target.textContent = reply;
230                 event.preventDefault();
231                 if(reply && reply.length) {
232                         $('#profile-rotator').show();
233                         $.get('parse_url?url=' + reply, function(data) {
234                                 if (!editor) $("#profile-jot-text").val("");
235                                 initEditor(function(){
236                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
237                                         $('#profile-rotator').hide();
238                                 });
239                         });
240                 }
241         }
242
243         function jotClearLocation() {
244                 $('#jot-coord').val('');
245                 $('#profile-nolocation-wrapper').hide();
246         }
247
248         $geotag
249
250 </script>
251