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