]> git.mxchange.org Git - friendica.git/blob - view/theme/smoothly/templates/jot-header.tpl
- Remove TinyMCE mentions in themes
[friendica.git] / view / theme / smoothly / templates / jot-header.tpl
1
2
3 <script language="javascript" type="text/javascript">
4
5 var editor = false;
6 var textlen = 0;
7
8 function initEditor(callback) {
9         if (editor == false){
10                 $("#profile-jot-text-loading").show();
11                 $("#profile-jot-text-loading").hide();
12                 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
13                 $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
14                 $("#profile-jot-text").bbco_autocomplete('bbcode');
15                 $(".jothidden").show();
16                 $("a#jot-perms-icon").colorbox({
17                         'inline' : true,
18                         'transition' : 'elastic'
19                 });
20                 $("#profile-jot-submit-wrapper").show();
21         {{if $newpost}}
22                 $("#profile-upload-wrapper").show();
23                 $("#profile-attach-wrapper").show();
24                 $("#profile-link-wrapper").show();
25                 $("#profile-video-wrapper").show();
26                 $("#profile-audio-wrapper").show();
27                 $("#profile-location-wrapper").show();
28                 $("#profile-nolocation-wrapper").show();
29                 $("#profile-title-wrapper").show();
30                 $("#profile-jot-plugin-wrapper").show();
31                 $("#jot-preview-link").show();
32         {{/if}}
33
34                 editor = true;
35     }
36         if (typeof callback != "undefined") {
37                 callback();
38         }
39 } // initEditor
40
41 function enableOnUser(){
42         if (editor) {
43                 return;
44         }
45         $(this).val("");
46         initEditor();
47 }
48
49 </script>
50
51 <script type="text/javascript" src="js/ajaxupload.js" >
52 </script>
53
54 <script>
55         var ispublic = '{{$ispublic}}';
56
57         $(document).ready(function() {
58
59                 /* enable editor on focus and click */
60                 $("#profile-jot-text").focus(enableOnUser);
61                 $("#profile-jot-text").click(enableOnUser);
62
63                 var uploader = new window.AjaxUpload(
64                         'wall-image-upload',
65                         { action: 'wall_upload/{{$nickname}}',
66                                 name: 'userfile',
67                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
68                                 onComplete: function(file,response) {
69                                         addeditortext(response);
70                                         $('#profile-rotator').hide();
71                                 }
72                         }
73                 );
74
75                 var file_uploader = new window.AjaxUpload(
76                         'wall-file-upload',
77                         { action: 'wall_attach/{{$nickname}}',
78                                 name: 'userfile',
79                                 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
80                                 onComplete: function(file,response) {
81                                         addeditortext(response);
82                                         $('#profile-rotator').hide();
83                                 }
84                         }
85                 );
86                 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
87                         var selstr;
88                         $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
89                                 selstr = $(this).text();
90                                 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
91                                 $('#jot-public').hide();
92                                 $('.profile-jot-net input').attr('disabled', 'disabled');
93                         });
94                         if(selstr == null) {
95                                 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
96                                 $('#jot-public').show();
97                                 $('.profile-jot-net input').attr('disabled', false);
98                         }
99
100                 }).trigger('change');
101
102         });
103
104         function deleteCheckedItems() {
105                 if(confirm('{{$delitems}}')) {
106                         var checkedstr = '';
107
108                         $("#item-delete-selected").hide();
109                         $('#item-delete-selected-rotator').show();
110
111                         $('.item-select').each( function() {
112                                 if($(this).is(':checked')) {
113                                         if(checkedstr.length != 0) {
114                                                 checkedstr = checkedstr + ',' + $(this).val();
115                                         }
116                                         else {
117                                                 checkedstr = $(this).val();
118                                         }
119                                 }
120                         });
121                         $.post('item', { dropitems: checkedstr }, function(data) {
122                                 window.location.reload();
123                         });
124                 }
125         }
126
127         function jotGetLink() {
128                 reply = prompt("{{$linkurl}}");
129                 if(reply && reply.length) {
130                         reply = bin2hex(reply);
131                         $('#profile-rotator').show();
132                         $.get('parse_url?binurl=' + reply, function(data) {
133                                 addeditortext(data);
134                                 $('#profile-rotator').hide();
135                         });
136                 }
137         }
138
139         function jotVideoURL() {
140                 reply = prompt("{{$vidurl}}");
141                 if(reply && reply.length) {
142                         addeditortext('[video]' + reply + '[/video]');
143                 }
144         }
145
146         function jotAudioURL() {
147                 reply = prompt("{{$audurl}}");
148                 if(reply && reply.length) {
149                         addeditortext('[audio]' + reply + '[/audio]');
150                 }
151         }
152
153
154         function jotGetLocation() {
155                 reply = prompt("{{$whereareu}}", $('#jot-location').val());
156                 if(reply && reply.length) {
157                         $('#jot-location').val(reply);
158                 }
159         }
160
161         function jotTitle() {
162                 reply = prompt("{{$title}}", $('#jot-title').val());
163                 if(reply && reply.length) {
164                         $('#jot-title').val(reply);
165                 }
166         }
167
168         function jotShare(id) {
169                 $('#like-rotator-' + id).show();
170                 $.get('share/' + id, function(data) {
171                                 if (!editor) $("#profile-jot-text").val("");
172                                 initEditor(function(){
173                                         addeditortext(data);
174                                         $('#like-rotator-' + id).hide();
175                                         $(window).scrollTop(0);
176                                 });
177                 });
178         }
179
180         function linkdropper(event) {
181                 var linkFound = event.dataTransfer.types.contains("text/uri-list");
182                 if(linkFound)
183                         event.preventDefault();
184         }
185
186         function linkdrop(event) {
187                 var reply = event.dataTransfer.getData("text/uri-list");
188                 event.target.textContent = reply;
189                 event.preventDefault();
190                 if(reply && reply.length) {
191                         reply = bin2hex(reply);
192                         $('#profile-rotator').show();
193                         $.get('parse_url?binurl=' + reply, function(data) {
194                                 if (!editor) $("#profile-jot-text").val("");
195                                 initEditor(function(){
196                                         addeditortext(data);
197                                         $('#profile-rotator').hide();
198                                 });
199                         });
200                 }
201         }
202
203         function itemTag(id) {
204                 reply = prompt("{{$term}}");
205                 if(reply && reply.length) {
206                         reply = reply.replace('#','');
207                         if(reply.length) {
208
209                                 commentBusy = true;
210                                 $('body').css('cursor', 'wait');
211
212                                 $.get('tagger/' + id + '?term=' + reply);
213                                 if(timer) clearTimeout(timer);
214                                 timer = setTimeout(NavUpdate,3000);
215                                 liking = 1;
216                         }
217                 }
218         }
219
220         function itemFiler(id) {
221
222                 var bordercolor = $("input").css("border-color");
223
224                 $.get('filer/', function(data){
225                         $.colorbox({html:data});
226                         $("#id_term").keypress(function(){
227                                 $(this).css("border-color",bordercolor);
228                         })
229                         $("#select_term").change(function(){
230                                 $("#id_term").css("border-color",bordercolor);
231                         })
232
233                         $("#filer_save").click(function(e){
234                                 e.preventDefault();
235                                 reply = $("#id_term").val();
236                                 if(reply && reply.length) {
237                                         commentBusy = true;
238                                         $('body').css('cursor', 'wait');
239                                         $.get('filer/' + id + '?term=' + reply, NavUpdate);
240 //                                      if(timer) clearTimeout(timer);
241 //                                      timer = setTimeout(NavUpdate,3000);
242                                         liking = 1;
243                                         $.colorbox.close();
244                                 } else {
245                                         $("#id_term").css("border-color","#FF0000");
246                                 }
247                                 return false;
248                         });
249                 });
250
251         }
252
253
254
255         function jotClearLocation() {
256                 $('#jot-coord').val('');
257                 $('#profile-nolocation-wrapper').hide();
258         }
259
260         function addeditortext(data) {
261                 var currentText = $("#profile-jot-text").val();
262                 $("#profile-jot-text").val(currentText + data);
263         }
264
265
266         {{$geotag}}
267
268 </script>