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