]> git.mxchange.org Git - friendica.git/blob - view/jot-header.tpl
d7a429512582d8b9a4b786edd6703709a6caf8ec
[friendica.git] / view / 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;
6 var textlen = 0;
7
8 tinyMCE.init({
9         theme : "advanced",
10         mode : "specific_textareas",
11         editor_selector: /(profile-jot-text|prvmail-text)/,
12         plugins : "bbcode,paste",
13         theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
14         theme_advanced_buttons2 : "",
15         theme_advanced_buttons3 : "",
16         theme_advanced_toolbar_location : "top",
17         theme_advanced_toolbar_align : "center",
18         theme_advanced_blockformats : "blockquote,code",
19         paste_text_sticky : true,
20         entity_encoding : "raw",
21         add_unload_trigger : false,
22         remove_linebreaks : false,
23         force_p_newlines : false,
24         force_br_newlines : true,
25         forced_root_block : '',
26         convert_urls: false,
27         content_css: "$baseurl/view/custom_tinymce.css",
28         theme_advanced_path : false,
29         setup : function(ed) {
30              //Character count
31                 ed.onKeyUp.add(function(ed, e) {
32                         var txt = tinyMCE.activeEditor.getContent();
33                         textlen = txt.length;
34                         if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
35                                 $('#profile-jot-desc').html(ispublic);
36                         }
37                         else {
38                                 $('#profile-jot-desc').html('&nbsp;');
39                         }        
40
41                         if(textlen <= 140) {
42                                 $('#character-counter').removeClass('red');
43                                 $('#character-counter').removeClass('orange');
44                                 $('#character-counter').addClass('grey');
45                         }
46                         if((textlen > 140) && (textlen <= 420)) {
47                                 $('#character-counter').removeClass('grey');
48                                 $('#character-counter').removeClass('red');
49                                 $('#character-counter').addClass('orange');
50                         }
51                         if(textlen > 420) {
52                                 $('#character-counter').removeClass('grey');
53                                 $('#character-counter').removeClass('orange');
54                                 $('#character-counter').addClass('red');
55                         }
56                         $('#character-counter').text(textlen);
57         });
58
59                 ed.onInit.add(function(ed) {
60                         ed.pasteAsPlainText = true;
61                 });
62
63         }
64 });
65
66 </script>
67 <script type="text/javascript" src="include/ajaxupload.js" ></script>
68 <script>
69         var ispublic = '$ispublic';
70         $(document).ready(function() {
71                 var uploader = new window.AjaxUpload(
72                         'wall-image-upload',
73                         { action: 'wall_upload/$nickname',
74                                 name: 'userfile',
75                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
76                                 onComplete: function(file,response) {
77                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
78                                         $('#profile-rotator').hide();
79                                 }                                
80                         }
81                 );
82                 var file_uploader = new window.AjaxUpload(
83                         'wall-file-upload',
84                         { action: 'wall_attach/$nickname',
85                                 name: 'userfile',
86                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
87                                 onComplete: function(file,response) {
88                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
89                                         $('#profile-rotator').hide();
90                                 }                                
91                         }
92                 );
93
94                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
95                         var selstr;
96                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
97                                 selstr = $(this).text();
98                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
99                                 $('#jot-public').hide();
100                                 $('.profile-jot-net input').attr('disabled', 'disabled');
101                         });
102                         if(selstr == null) { 
103                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
104                                 $('#jot-public').show();
105                                 $('.profile-jot-net input').attr('disabled', false);
106                         }
107
108                 }).trigger('change');
109
110         });
111
112         function deleteCheckedItems() {
113                 var checkedstr = '';
114
115                 $('.item-select').each( function() {
116                         if($(this).is(':checked')) {
117                                 if(checkedstr.length != 0) {
118                                         checkedstr = checkedstr + ',' + $(this).val();
119                                 }
120                                 else {
121                                         checkedstr = $(this).val();
122                                 }
123                         }       
124                 });
125                 $.post('item', { dropitems: checkedstr }, function(data) {
126                         window.location.reload();
127                 });
128         }
129
130         function jotGetLink() {
131                 reply = prompt("$linkurl");
132                 if(reply && reply.length) {
133                         reply = bin2hex(reply);
134                         $('#profile-rotator').show();
135                         $.get('parse_url?url=' + reply, function(data) {
136                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
137                                 $('#profile-rotator').hide();
138                         });
139                 }
140         }
141
142         function jotGetVideo() {
143                 reply = prompt("$utubeurl");
144                 if(reply && reply.length) {
145                         tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
146                 }
147         }
148
149         function jotVideoURL() {
150                 reply = prompt("$vidurl");
151                 if(reply && reply.length) {
152                         tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
153                 }
154         }
155
156         function jotAudioURL() {
157                 reply = prompt("$audurl");
158                 if(reply && reply.length) {
159                         tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
160                 }
161         }
162
163
164         function jotGetLocation() {
165                 reply = prompt("$whereareu", $('#jot-location').val());
166                 if(reply && reply.length) {
167                         $('#jot-location').val(reply);
168                 }
169         }
170
171         function jotTitle() {
172                 reply = prompt("$title", $('#jot-title').val());
173                 if(reply && reply.length) {
174                         $('#jot-title').val(reply);
175                 }
176         }
177
178         function jotShare(id) {
179                 $('#like-rotator-' + id).show();
180                 $.get('share/' + id, function(data) {
181                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
182                         $('#like-rotator-' + id).hide();
183                         $(window).scrollTop(0);
184                 });
185         }
186
187         function linkdropper(event) {
188                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
189                 if(linkFound)
190                         event.preventDefault();
191         }
192
193         function linkdrop(event) {
194                 var reply = event.dataTransfer.getData("text/uri-list");
195                 event.target.textContent = reply;
196                 event.preventDefault();
197                 if(reply && reply.length) {
198                         $('#profile-rotator').show();
199                         $.get('parse_url?url=' + reply, function(data) {
200                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
201                                 $('#profile-rotator').hide();
202                         });
203                 }
204         }
205
206         function jotClearLocation() {
207                 $('#jot-coord').val('');
208                 $('#profile-nolocation-wrapper').hide();
209         }
210
211         $geotag
212
213 </script>
214