]> git.mxchange.org Git - friendica.git/blob - view/jot-header.tpl
61c80702efb4c4f68dc2a78e82ccffcd87c7c42e
[friendica.git] / view / jot-header.tpl
1
2 <script language="javascript" type="text/javascript" src="$baseurl/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                                 else
120                                         checkedstr = $(this).val();
121                         }       
122                 });
123                 $.post('item', { dropitems: checkedstr }, function(data) {
124                         window.location.reload();
125                 });
126         }
127
128         function jotGetLink() {
129                 reply = prompt("$linkurl");
130                 if(reply && reply.length) {
131                         reply = bin2hex(reply);
132                         $('#profile-rotator').show();
133                         $.get('parse_url?url=' + reply, function(data) {
134                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
135                                 $('#profile-rotator').hide();
136                         });
137                 }
138         }
139
140         function jotGetVideo() {
141                 reply = prompt("$utubeurl");
142                 if(reply && reply.length) {
143                         tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
144                 }
145         }
146
147         function jotVideoURL() {
148                 reply = prompt("$vidurl");
149                 if(reply && reply.length) {
150                         tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
151                 }
152         }
153
154         function jotAudioURL() {
155                 reply = prompt("$audurl");
156                 if(reply && reply.length) {
157                         tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
158                 }
159         }
160
161
162         function jotGetLocation() {
163                 reply = prompt("$whereareu", $('#jot-location').val());
164                 if(reply && reply.length) {
165                         $('#jot-location').val(reply);
166                 }
167         }
168
169         function jotTitle() {
170                 reply = prompt("$title", $('#jot-title').val());
171                 if(reply && reply.length) {
172                         $('#jot-title').val(reply);
173                 }
174         }
175
176         function jotShare(id) {
177                 $('#like-rotator-' + id).show();
178                 $.get('share/' + id, function(data) {
179                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
180                         $('#like-rotator-' + id).hide();
181                         $(window).scrollTop(0);
182                 });
183         }
184
185         function linkdropper(event) {
186                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
187                 if(linkFound)
188                         event.preventDefault();
189         }
190
191         function linkdrop(event) {
192                 var reply = event.dataTransfer.getData("text/uri-list");
193                 event.target.textContent = reply;
194                 event.preventDefault();
195                 if(reply && reply.length) {
196                         $('#profile-rotator').show();
197                         $.get('parse_url?url=' + reply, function(data) {
198                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
199                                 $('#profile-rotator').hide();
200                         });
201                 }
202         }
203
204         function jotClearLocation() {
205                 $('#jot-coord').val('');
206                 $('#profile-nolocation-wrapper').hide();
207         }
208
209         $geotag
210
211 </script>
212