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