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