3 <script language="javascript" type="text/javascript">
8 function initEditor(callback) {
10 var colorbox_options = {
11 {{if $APP->is_mobile}}
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();
29 if (typeof callback != "undefined") {
34 function enableOnUser(){
43 <script type="text/javascript" src="{{$baseurl}}/view/js/ajaxupload.js?v={{$smarty.const.FRIENDICA_VERSION}}" ></script>
45 var ispublic = '{{$ispublic nofilter}}';
48 $(document).ready(function() {
50 /* enable editor on focus and click */
51 $("#profile-jot-text").focus(enableOnUser);
52 $("#profile-jot-text").click(enableOnUser);
54 /* show images / file browser window
59 $('body').on('fbrowser.image.main', function(e, filename, embedcode, id) {
61 addeditortext(embedcode);
63 $('body').on('fbrowser.file.main', function(e, filename, embedcode, id) {
65 addeditortext(embedcode);
68 $('#wall-image-upload').on('click', function(){
69 Dialog.doImageBrowser("main");
72 $('#wall-file-upload').on('click', function(){
73 Dialog.doFileBrowser("main");
78 function deleteCheckedItems() {
79 if(confirm('{{$delitems}}')) {
82 $("#item-delete-selected").hide();
83 $('#item-delete-selected-rotator').show();
85 $('.item-select').each( function() {
86 if($(this).is(':checked')) {
87 if(checkedstr.length != 0) {
88 checkedstr = checkedstr + ',' + $(this).val();
91 checkedstr = $(this).val();
95 $.post('item', { dropitems: checkedstr }, function(data) {
96 window.location.reload();
101 function jotGetLink() {
102 reply = prompt("{{$linkurl}}");
103 if(reply && reply.length) {
104 reply = bin2hex(reply);
105 $('#profile-rotator').show();
106 $.get('parse_url?binurl=' + reply, function(data) {
108 $('#profile-rotator').hide();
113 function jotVideoURL() {
114 reply = prompt("{{$vidurl}}");
115 if(reply && reply.length) {
116 addeditortext('[video]' + reply + '[/video]');
120 function jotAudioURL() {
121 reply = prompt("{{$audurl}}");
122 if(reply && reply.length) {
123 addeditortext('[audio]' + reply + '[/audio]');
128 function jotGetLocation() {
129 reply = prompt("{{$whereareu}}", $('#jot-location').val());
130 if(reply && reply.length) {
131 $('#jot-location').val(reply);
135 function jotShare(id) {
136 if ($('#jot-popup').length != 0) $('#jot-popup').show();
138 $('#like-rotator-' + id).show();
139 $.get('share/' + id, function(data) {
140 if (!editor) $("#profile-jot-text").val("");
141 initEditor(function(){
143 $('#like-rotator-' + id).hide();
144 $(window).scrollTop(0);
150 function linkdropper(event) {
151 var linkFound = event.dataTransfer.types.contains("text/uri-list");
153 event.preventDefault();
156 function linkdrop(event) {
157 var reply = event.dataTransfer.getData("text/uri-list");
158 event.target.textContent = reply;
159 event.preventDefault();
160 if(reply && reply.length) {
161 reply = bin2hex(reply);
162 $('#profile-rotator').show();
163 $.get('parse_url?binurl=' + reply, function(data) {
164 if (!editor) $("#profile-jot-text").val("");
165 initEditor(function(){
167 $('#profile-rotator').hide();
173 function itemTag(id) {
174 reply = prompt("{{$term}}");
175 if(reply && reply.length) {
176 reply = reply.replace('#','');
180 $('body').css('cursor', 'wait');
182 $.get('tagger/' + id + '?term=' + reply);
183 if(timer) clearTimeout(timer);
184 timer = setTimeout(NavUpdate,3000);
190 function itemFiler(id) {
192 var bordercolor = $("input").css("border-color");
194 $.get('filer/', function(data){
195 $.colorbox({html:data});
196 $("#id_term").keypress(function(){
197 $(this).css("border-color",bordercolor);
199 $("#select_term").change(function(){
200 $("#id_term").css("border-color",bordercolor);
203 $("#filer_save").click(function(e){
205 reply = $("#id_term").val();
206 if(reply && reply.length) {
208 $('body').css('cursor', 'wait');
209 $.get('filer/' + id + '?term=' + reply, NavUpdate);
210 // if(timer) clearTimeout(timer);
211 // timer = setTimeout(NavUpdate,3000);
215 $("#id_term").css("border-color","#FF0000");
223 function jotClearLocation() {
224 $('#jot-coord').val('');
225 $('#profile-nolocation-wrapper').hide();
228 function addeditortext(data) {
229 var currentText = $("#profile-jot-text").val();
230 $("#profile-jot-text").val(currentText + data);