]> git.mxchange.org Git - friendica.git/blob - view/theme/dispy/jot-header.tpl
Merge branch 'dispy' of github.com:fabrixxm/friendika into dispy
[friendica.git] / view / theme / dispy / 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,fullscreen,autoresize",
13         theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code,fullscreen",
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         //theme_advanced_resizing : true,
20         //theme_advanced_statusbar_location : "bottom",
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                 });
64
65         }
66 });
67
68 </script>
69 <script type="text/javascript" src="include/ajaxupload.js" ></script>
70 <script>
71     var ispublic = '$ispublic';
72         $(document).ready(function() {
73                 var uploader = new window.AjaxUpload(
74                         'wall-image-upload',
75                         { action: 'wall_upload/$nickname',
76                                 name: 'userfile',
77                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
78                                 onComplete: function(file,response) {
79                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
80                                         $('#profile-rotator').hide();
81                                 }                                
82                         }
83                 );
84                 var file_uploader = new window.AjaxUpload(
85                         'wall-file-upload',
86                         { action: 'wall_attach/$nickname',
87                                 name: 'userfile',
88                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
89                                 onComplete: function(file,response) {
90                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
91                                         $('#profile-rotator').hide();
92                                 }                                
93                         }
94                 );              
95                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
96                         var selstr;
97                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
98                                 selstr = $(this).text();
99                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
100                                 $('#jot-public').hide();
101                                 $('.profile-jot-net input').attr('disabled', 'disabled');
102                         });
103                         if(selstr == null) { 
104                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
105                                 $('#jot-public').show();
106                                 $('.profile-jot-net input').attr('disabled', false);
107                         }
108
109                 }).trigger('change');
110
111         });
112
113         function deleteCheckedItems() {
114                 var checkedstr = '';
115
116                 $('.item-select').each( function() {
117                         if($(this).is(':checked')) {
118                                 if(checkedstr.length != 0) {
119                                         checkedstr = checkedstr + ',' + $(this).val();
120                                 }
121                                 else {
122                                         checkedstr = $(this).val();
123                                 }
124                         }       
125                 });
126                 $.post('item', { dropitems: checkedstr }, function(data) {
127                         window.location.reload();
128                 });
129         }
130
131         function jotGetLink() {
132                 reply = prompt("$linkurl");
133                 if(reply && reply.length) {
134                         reply = bin2hex(reply);
135                         $('#profile-rotator').show();
136                         $.get('parse_url?url=' + reply, function(data) {
137                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
138                                 $('#profile-rotator').hide();
139                         });
140                 }
141         }
142
143         function jotGetVideo() {
144                 reply = prompt("$utubeurl");
145                 if(reply && reply.length) {
146                         tinyMCE.execCommand('mceInsertRawHTML',false,'[youtube]' + reply + '[/youtube]');
147                 }
148         }
149
150         function jotVideoURL() {
151                 reply = prompt("$vidurl");
152                 if(reply && reply.length) {
153                         tinyMCE.execCommand('mceInsertRawHTML',false,'[video]' + reply + '[/video]');
154                 }
155         }
156
157         function jotAudioURL() {
158                 reply = prompt("$audurl");
159                 if(reply && reply.length) {
160                         tinyMCE.execCommand('mceInsertRawHTML',false,'[audio]' + reply + '[/audio]');
161                 }
162         }
163
164
165         function jotGetLocation() {
166                 reply = prompt("$whereareu", $('#jot-location').val());
167                 if(reply && reply.length) {
168                         $('#jot-location').val(reply);
169                 }
170         }
171
172         function jotTitle() {
173                 reply = prompt("$title", $('#jot-title').val());
174                 if(reply && reply.length) {
175                         $('#jot-title').val(reply);
176                 }
177         }
178
179         function jotShare(id) {
180                 $('#like-rotator-' + id).show();
181                 $.get('share/' + id, function(data) {
182                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
183                         $('#like-rotator-' + id).hide();
184                         $(window).scrollTop(0);
185                 });
186         }
187
188         function linkdropper(event) {
189                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
190                 if(linkFound)
191                         event.preventDefault();
192         }
193
194         function linkdrop(event) {
195                 var reply = event.dataTransfer.getData("text/uri-list");
196                 event.target.textContent = reply;
197                 event.preventDefault();
198                 if(reply && reply.length) {
199                         $('#profile-rotator').show();
200                         $.get('parse_url?url=' + reply, function(data) {
201                                 tinyMCE.execCommand('mceInsertRawHTML',false,data);
202                                 $('#profile-rotator').hide();
203                         });
204                 }
205         }
206
207         function jotClearLocation() {
208                 $('#jot-coord').val('');
209                 $('#profile-nolocation-wrapper').hide();
210         }
211
212         $geotag
213
214 </script>
215