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