3 <script language="javascript" type="text/javascript">
8 function initEditor(callback) {
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 + '/search/acl');
14 $("#profile-jot-text").bbco_autocomplete('bbcode');
15 $(".jothidden").show();
16 $("a#jot-perms-icon").colorbox({
18 'transition' : 'elastic'
20 $("#profile-jot-submit-wrapper").show();
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();
36 if (typeof callback != "undefined") {
41 function enableOnUser(){
51 <script type="text/javascript" src="view/js/ajaxupload.js?v={{$smarty.const.FRIENDICA_VERSION}}">
55 var ispublic = '{{$ispublic nofilter}}';
57 $(document).ready(function() {
59 /* enable editor on focus and click */
60 $("#profile-jot-text")
64 var uploader = new window.AjaxUpload(
66 { action: 'profile/{{$nickname}}/photos/upload',
68 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
69 onComplete: function(file,response) {
70 addeditortext(response);
71 $('#profile-rotator').hide();
76 var file_uploader = new window.AjaxUpload(
78 { action: 'profile/{{$nickname}}/attachment/upload',
80 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
81 onComplete: function(file,response) {
82 addeditortext(response);
83 $('#profile-rotator').hide();
87 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
89 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
90 selstr = $(this).html();
91 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
92 $('#jot-public').hide();
93 $('.profile-jot-net input').attr('disabled', 'disabled');
96 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
97 $('#jot-public').show();
98 $('.profile-jot-net input').attr('disabled', false);
101 }).trigger('change');
105 function deleteCheckedItems() {
106 if(confirm('{{$delitems}}')) {
109 $("#item-delete-selected").hide();
110 $('#item-delete-selected-rotator').show();
112 $('.item-select').each( function() {
113 if($(this).is(':checked')) {
114 if(checkedstr.length != 0) {
115 checkedstr = checkedstr + ',' + $(this).val();
118 checkedstr = $(this).val();
122 $.post('item', { dropitems: checkedstr }, function(data) {
123 window.location.reload();
128 function jotGetLink() {
129 reply = prompt("{{$linkurl}}");
130 if(reply && reply.length) {
131 reply = bin2hex(reply);
132 $('#profile-rotator').show();
133 $.get('parseurl?binurl=' + reply, function(data) {
135 $('#profile-rotator').hide();
140 function jotVideoURL() {
141 reply = prompt("{{$vidurl}}");
142 if(reply && reply.length) {
143 addeditortext('[video]' + reply + '[/video]');
147 function jotAudioURL() {
148 reply = prompt("{{$audurl}}");
149 if(reply && reply.length) {
150 addeditortext('[audio]' + reply + '[/audio]');
155 function jotGetLocation() {
156 reply = prompt("{{$whereareu}}", $('#jot-location').val());
157 if(reply && reply.length) {
158 $('#jot-location').val(reply);
162 function jotTitle() {
163 reply = prompt("{{$title}}", $('#jot-title').val());
164 if(reply && reply.length) {
165 $('#jot-title').val(reply);
169 function jotShare(id) {
170 $('#like-rotator-' + id).show();
171 $.get('post/' + id + '/share', function(data) {
172 if (!editor) $("#profile-jot-text").val("");
173 initEditor(function(){
175 $('#like-rotator-' + id).hide();
176 $(window).scrollTop(0);
181 function linkdropper(event) {
182 var linkFound = event.dataTransfer.types.contains("text/uri-list");
184 event.preventDefault();
187 function linkdrop(event) {
188 var reply = event.dataTransfer.getData("text/uri-list");
189 event.target.textContent = reply;
190 event.preventDefault();
191 if(reply && reply.length) {
192 reply = bin2hex(reply);
193 $('#profile-rotator').show();
194 $.get('parseurl?binurl=' + reply, function(data) {
195 if (!editor) $("#profile-jot-text").val("");
196 initEditor(function(){
198 $('#profile-rotator').hide();
204 function itemTag(id) {
205 reply = prompt("{{$term}}");
206 if(reply && reply.length) {
207 reply = reply.replace('#','');
211 $('body').css('cursor', 'wait');
213 $.post('post/' + id + '/tag/add', {term: reply});
214 if(timer) clearTimeout(timer);
215 timer = setTimeout(NavUpdate,3000);
221 function itemFiler(id) {
223 var bordercolor = $("input").css("border-color");
225 $.get('filer/', function(data){
226 $.colorbox({html:data});
227 $("#id_term").keypress(function(){
228 $(this).css("border-color",bordercolor);
230 $("#select_term").change(function(){
231 $("#id_term").css("border-color",bordercolor);
234 $("#filer_save").click(function(e){
236 reply = $("#id_term").val();
237 if(reply && reply.length) {
239 $('body').css('cursor', 'wait');
240 $.get('filer/' + id + '?term=' + reply, NavUpdate);
241 // if(timer) clearTimeout(timer);
242 // timer = setTimeout(NavUpdate,3000);
247 $("#id_term").css("border-color","#FF0000");
257 function jotClearLocation() {
258 $('#jot-coord').val('');
259 $('#profile-nolocation-wrapper').hide();
262 function addeditortext(data) {
263 var currentText = $("#profile-jot-text").val();
264 $("#profile-jot-text").val(currentText + data);