3 <script language="javascript" type="text/javascript">
8 function initEditor(callback) {
10 var colorbox_options = {
16 'transition' : 'elastic'
19 $("#profile-jot-text-loading").show();
20 $("#profile-jot-text-loading").hide();
21 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
22 $("#profile-jot-text").editor_autocomplete(baseurl + '/search/acl');
23 $("#profile-jot-text").bbco_autocomplete('bbcode');
24 $("a#jot-perms-icon").colorbox(colorbox_options);
25 $(".jothidden").show();
27 $("#profile-jot-text").keyup(function(){
28 var textlen = $(this).val().length;
29 $('#character-counter').text(textlen);
34 if (typeof callback != "undefined") {
39 function enableOnUser(){
48 <script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js?v={{$smarty.const.FRIENDICA_VERSION}}"></script>
50 var ispublic = '{{$ispublic nofilter}}';
53 $(document).ready(function() {
55 /* enable editor on focus and click */
56 $("#profile-jot-text").focus(enableOnUser);
57 $("#profile-jot-text").click(enableOnUser);
59 /* show images / file browser window
64 $('body').on('fbrowser.photo.main', function(e, filename, embedcode, id) {
66 addeditortext(embedcode);
68 $('body').on('fbrowser.attachment.main', function(e, filename, embedcode, id) {
70 addeditortext(embedcode);
73 $('#wall-image-upload').on('click', function(){
74 Dialog.doImageBrowser("main");
77 $('#wall-file-upload').on('click', function(){
78 Dialog.doFileBrowser("main");
83 function deleteCheckedItems() {
84 if(confirm('{{$delitems}}')) {
87 $("#item-delete-selected").hide();
88 $('#item-delete-selected-rotator').show();
90 $('.item-select').each( function() {
91 if($(this).is(':checked')) {
92 if(checkedstr.length != 0) {
93 checkedstr = checkedstr + ',' + $(this).val();
96 checkedstr = $(this).val();
100 $.post('item', { dropitems: checkedstr }, function(data) {
101 window.location.reload();
106 function jotGetLink() {
107 reply = prompt("{{$linkurl}}");
108 if(reply && reply.length) {
109 reply = bin2hex(reply);
110 $('#profile-rotator').show();
111 $.get('parseurl?binurl=' + reply, function(data) {
113 $('#profile-rotator').hide();
118 function jotVideoURL() {
119 reply = prompt("{{$vidurl}}");
120 if(reply && reply.length) {
121 addeditortext('[video]' + reply + '[/video]');
125 function jotAudioURL() {
126 reply = prompt("{{$audurl}}");
127 if(reply && reply.length) {
128 addeditortext('[audio]' + reply + '[/audio]');
133 function jotGetLocation() {
134 reply = prompt("{{$whereareu}}", $('#jot-location').val());
135 if(reply && reply.length) {
136 $('#jot-location').val(reply);
140 function jotShare(id) {
141 if ($('#jot-popup').length != 0) $('#jot-popup').show();
143 $('#like-rotator-' + id).show();
144 $.get('post/' + id + '/share', function(data) {
145 if (!editor) $("#profile-jot-text").val("");
146 initEditor(function(){
148 $('#like-rotator-' + id).hide();
149 $(window).scrollTop(0);
155 function linkdropper(event) {
156 var linkFound = event.dataTransfer.types.contains("text/uri-list");
158 event.preventDefault();
161 function linkdrop(event) {
162 var reply = event.dataTransfer.getData("text/uri-list");
163 event.target.textContent = reply;
164 event.preventDefault();
165 if(reply && reply.length) {
166 reply = bin2hex(reply);
167 $('#profile-rotator').show();
168 $.get('parseurl?binurl=' + reply, function(data) {
169 if (!editor) $("#profile-jot-text").val("");
170 initEditor(function(){
172 $('#profile-rotator').hide();
178 function itemTag(id) {
179 reply = prompt("{{$term}}");
180 if(reply && reply.length) {
181 reply = reply.replace('#','');
185 $('body').css('cursor', 'wait');
187 $.post('post/' + id + '/tag/add', {term: reply});
188 if(timer) clearTimeout(timer);
189 timer = setTimeout(NavUpdate,3000);
195 function itemFiler(id) {
197 var bordercolor = $("input").css("border-color");
199 $.get('filer/', function(data){
200 $.colorbox({html:data});
201 $("#id_term").keypress(function(){
202 $(this).css("border-color",bordercolor);
204 $("#select_term").change(function(){
205 $("#id_term").css("border-color",bordercolor);
208 $("#filer_save").click(function(e){
210 reply = $("#id_term").val();
211 if(reply && reply.length) {
213 $('body').css('cursor', 'wait');
214 $.get('filer/' + id + '?term=' + reply, NavUpdate);
215 // if(timer) clearTimeout(timer);
216 // timer = setTimeout(NavUpdate,3000);
221 $("#id_term").css("border-color","#FF0000");
229 function jotClearLocation() {
230 $('#jot-coord').val('');
231 $('#profile-nolocation-wrapper').hide();
234 function addeditortext(data) {
235 var currentText = $("#profile-jot-text").val();
236 $("#profile-jot-text").val(currentText + data);