]> git.mxchange.org Git - friendica.git/blob - view/theme/frost-mobile/js/theme.js
Merge branch 'master' of https://github.com/friendica/friendica into threaded_items
[friendica.git] / view / theme / frost-mobile / js / theme.js
1 $j(document).ready(function() {
2
3                 /* enable tinymce on focus and click */
4                 $j("#profile-jot-text").focus(enableOnUser);
5                 $j("#profile-jot-text").click(enableOnUser);
6
7         if(typeof window.AjaxUpload != "undefined") {
8                 switch(window.ajaxType) {
9                         case 'jot-header':
10                                 var uploader = new window.AjaxUpload(
11                                         'wall-image-upload',
12                                         { action: 'wall_upload/'+window.nickname,
13                                                 name: 'userfile',
14                                                 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
15                                                 onComplete: function(file,response) {
16                                                         addeditortext(response);
17                                                         $j('#profile-rotator').hide();
18                                                 }                                
19                                         }
20                                 );
21
22                                 var file_uploader = new window.AjaxUpload(
23                                         'wall-file-upload',
24                                         { action: 'wall_attach/'+window.nickname,
25                                                 name: 'userfile',
26                                                 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
27                                                 onComplete: function(file,response) {
28                                                         addeditortext(response);
29                                                         $j('#profile-rotator').hide();
30                                                 }                                
31                                         }
32                                 );
33                                 break;
34                         case 'msg-header':
35                                 var uploader = new window.AjaxUpload(
36                                         'prvmail-upload',
37                                         { action: 'wall_upload/' + window.nickname,
38                                                 name: 'userfile',
39                                                 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
40                                                 onComplete: function(file,response) {
41                                                         tinyMCE.execCommand('mceInsertRawHTML',false,response);
42                                                         $j('#profile-rotator').hide();
43                                                 }                                
44                                         }
45                                 );
46                                 break;
47                         default:
48                                 break;
49                 }
50         }
51
52         if(typeof acl=="undefined"){
53                 acl = new ACL(
54                         baseurl+"/acl",
55                         [ window.allowCID,window.allowGID,window.denyCID,window.denyGID ]
56                 );
57         }
58
59 /*$j('html').click(function() { $j("#nav-notifications-menu" ).hide(); });*/
60
61         /*$j('.group-edit-icon').hover(
62                 function() {
63                         $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
64                 function() {
65                         $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
66         );
67
68         $j('.sidebar-group-element').hover(
69                 function() {
70                         id = $j(this).attr('id');
71                         $j('#edit-' + id).addClass('icon'); $j('#edit-' + id).removeClass('iconspacer');},
72
73                 function() {
74                         id = $j(this).attr('id');
75                         $j('#edit-' + id).removeClass('icon');$j('#edit-' + id).addClass('iconspacer');}
76         );
77
78
79         $j('.savedsearchdrop').hover(
80                 function() {
81                         $j(this).addClass('drop'); $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
82                 function() {
83                         $j(this).removeClass('drop'); $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
84         );
85
86         $j('.savedsearchterm').hover(
87                 function() {
88                         id = $j(this).attr('id');
89                         $j('#drop-' + id).addClass('icon');     $j('#drop-' + id).addClass('drophide'); $j('#drop-' + id).removeClass('iconspacer');},
90
91                 function() {
92                         id = $j(this).attr('id');
93                         $j('#drop-' + id).removeClass('icon');$j('#drop-' + id).removeClass('drophide'); $j('#drop-' + id).addClass('iconspacer');}
94         );*/
95
96         if(window.autoCompleteType == "display-head") {
97                 //$j(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
98                 // make auto-complete work in more places
99                 //$j(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
100                 $j(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
101         }
102
103         if(window.aclType == "event_head") {
104                 $j('#events-calendar').fullCalendar({
105                         events: baseurl + '/events/json/',
106                         header: {
107                                 left: 'prev,next today',
108                                 center: 'title',
109                                 right: 'month,agendaWeek,agendaDay'
110                         },                      
111                         timeFormat: 'H(:mm)',
112                         eventClick: function(calEvent, jsEvent, view) {
113                                 showEvent(calEvent.id);
114                         },
115                         
116                         eventRender: function(event, element, view) {
117                                 //console.log(view.name);
118                                 if (event.item['author-name']==null) return;
119                                 switch(view.name){
120                                         case "month":
121                                         element.find(".fc-event-title").html(
122                                                 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
123                                                         event.item['author-avatar'],
124                                                         event.item['author-name'],
125                                                         event.title
126                                         ));
127                                         break;
128                                         case "agendaWeek":
129                                         element.find(".fc-event-title").html(
130                                                 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
131                                                         event.item['author-avatar'],
132                                                         event.item['author-name'],
133                                                         event.item.desc,
134                                                         event.item.location
135                                         ));
136                                         break;
137                                         case "agendaDay":
138                                         element.find(".fc-event-title").html(
139                                                 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
140                                                         event.item['author-avatar'],
141                                                         event.item['author-name'],
142                                                         event.item.desc,
143                                                         event.item.location
144                                         ));
145                                         break;
146                                 }
147                         }
148                         
149                 });
150                 
151                 // center on date
152                 var args=location.href.replace(baseurl,"").split("/");
153                 if (args.length>=4) {
154                         $j("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
155                 } 
156                 
157                 // show event popup
158                 var hash = location.hash.split("-")
159                 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
160         }       
161
162         if(window.aclType == "settings-head" || window.aclType == "photos_head" || window.aclType == "event_head") {
163                 $j('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
164                         var selstr;
165                         $j('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
166                                 selstr = $j(this).text();
167                                 $j('#jot-perms-icon').removeClass('unlock').addClass('lock');
168                                 $j('#jot-public').hide();
169                         });
170                         if(selstr == null) { 
171                                 $j('#jot-perms-icon').removeClass('lock').addClass('unlock');
172                                 $j('#jot-public').show();
173                         }
174
175                 }).trigger('change');
176         }
177
178         switch(window.autocompleteType) {
179                 case 'msg-header':
180                         var a = $j("#recip").autocomplete({ 
181                                 serviceUrl: baseurl + '/acl',
182                                 minChars: 2,
183                                 width: 350,
184                                 onSelect: function(value,data) {
185                                         $j("#recip-complete").val(data);
186                                 }                       
187                         });
188                         break;
189                 case 'contacts-head':
190                         var a = $j("#contacts-search").autocomplete({ 
191                                 serviceUrl: baseurl + '/acl',
192                                 minChars: 2,
193                                 width: 350,
194                         });
195                         a.setOptions({ params: { type: 'a' }});
196                         break;
197                 default:
198                         break;
199         }
200
201
202         $j('#event-share-checkbox').change(function() {
203
204                 if ($j('#event-share-checkbox').is(':checked')) { 
205                         $j('#acl-wrapper').show();
206                 }
207                 else {
208                         $j('#acl-wrapper').hide();
209                 }
210         }).trigger('change');
211
212
213         $j(".popupbox").click(function () {
214                 var parent = $j( $j(this).attr('href') ).parent();
215                 if (parent.css('display') == 'none') {
216                         parent.show();
217                 } else {
218                         parent.hide();
219                 }
220                 return false;
221         });
222
223 });
224
225 // update pending count //
226 $j(function(){
227
228         $j("nav").bind('nav-update',  function(e,data){
229                 var elm = $j('#pending-update');
230                 var register = $j(data).find('register').text();
231                 if (register=="0") { register=""; elm.hide();} else { elm.show(); }
232                 elm.html(register);
233         });
234 });
235
236
237
238 function insertFormatting(comment,BBcode,id) {
239         
240         var tmpStr = $j("#comment-edit-text-" + id).val();
241         if(tmpStr == comment) {
242                 tmpStr = "";
243                 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
244                 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
245                 openMenu("comment-edit-submit-wrapper-" + id);
246                 $j("#comment-edit-text-" + id).val(tmpStr);
247         }
248
249         textarea = document.getElementById("comment-edit-text-" +id);
250         if (document.selection) {
251                 textarea.focus();
252                 selected = document.selection.createRange();
253                 if (BBcode == "url"){
254                         selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
255                         } else                  
256                 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
257         } else if (textarea.selectionStart || textarea.selectionStart == "0") {
258                 var start = textarea.selectionStart;
259                 var end = textarea.selectionEnd;
260                 if (BBcode == "url"){
261                         textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
262                         } else
263                 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
264         }
265         return true;
266 }
267
268 function cmtBbOpen(id) {
269         $j(".comment-edit-bb-" + id).show();
270 }
271 function cmtBbClose(id) {
272         $j(".comment-edit-bb-" + id).hide();
273 }
274
275
276
277
278 var editor=false;
279 var textlen = 0;
280 var plaintext = 'none';//window.editSelect;
281         var ispublic = window.isPublic;
282
283 function initEditor(cb){
284         if (editor==false){
285 //              $j("#profile-jot-text-loading").show();
286                 if(plaintext == 'none') {
287 //                      $j("#profile-jot-text-loading").hide();
288                         $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
289                         $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
290                         editor = true;
291 /*                      $j("a#jot-perms-icon").fancybox({
292                                 'transitionIn' : 'none',
293                                 'transitionOut' : 'none'
294                         });*/
295                         $j("a#jot-perms-icon, a#settings-default-perms-menu").click(function () {
296                                 var parent = $j("#profile-jot-acl-wrapper").parent();
297                                 if (parent.css('display') == 'none') {
298                                         parent.show();
299                                 } else {
300                                         parent.hide();
301                                 }
302 //                              $j("#profile-jot-acl-wrapper").parent().toggle();
303                                 return false;
304                         });
305                         $j(".jothidden").show();
306                         if (typeof cb!="undefined") cb();
307                         return;
308                 }       
309 /*              tinyMCE.init({
310                         theme : "advanced",
311                         mode : "specific_textareas",
312                         editor_selector: window.editSelect,
313                         auto_focus: "profile-jot-text",
314                         plugins : "bbcode,paste,autoresize, inlinepopups",
315                         theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
316                         theme_advanced_buttons2 : "",
317                         theme_advanced_buttons3 : "",
318                         theme_advanced_toolbar_location : "top",
319                         theme_advanced_toolbar_align : "center",
320                         theme_advanced_blockformats : "blockquote,code",
321                         gecko_spellcheck : true,
322                         paste_text_sticky : true,
323                         entity_encoding : "raw",
324                         add_unload_trigger : false,
325                         remove_linebreaks : false,
326                         force_p_newlines : false,
327                         force_br_newlines : true,
328                         forced_root_block : '',
329                         convert_urls: false,
330                         content_css: "$baseurl/view/custom_tinymce.css",
331                         theme_advanced_path : false,
332                         file_browser_callback : "fcFileBrowser",
333                         setup : function(ed) {
334                                 cPopup = null;
335                                 ed.onKeyDown.add(function(ed,e) {
336                                         if(cPopup !== null)
337                                                 cPopup.onkey(e);
338                                 });
339
340                                 ed.onKeyUp.add(function(ed, e) {
341                                         var txt = tinyMCE.activeEditor.getContent();
342                                         match = txt.match(/@([^ \n]+)$/);
343                                         if(match!==null) {
344                                                 if(cPopup === null) {
345                                                         cPopup = new ACPopup(this,baseurl+"/acl");
346                                                 }
347                                                 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
348                                                 if(! cPopup.ready) cPopup = null;
349                                         }
350                                         else {
351                                                 if(cPopup !== null) { cPopup.close(); cPopup = null; }
352                                         }
353
354                                         textlen = txt.length;
355                                         if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
356                                                 $j('#profile-jot-desc').html(ispublic);
357                                         }
358                                         else {
359                                                 $j('#profile-jot-desc').html('&nbsp;');
360                                         }        
361
362                                  //Character count
363
364                                         if(textlen <= 140) {
365                                                 $j('#character-counter').removeClass('red');
366                                                 $j('#character-counter').removeClass('orange');
367                                                 $j('#character-counter').addClass('grey');
368                                         }
369                                         if((textlen > 140) && (textlen <= 420)) {
370                                                 $j('#character-counter').removeClass('grey');
371                                                 $j('#character-counter').removeClass('red');
372                                                 $j('#character-counter').addClass('orange');
373                                         }
374                                         if(textlen > 420) {
375                                                 $j('#character-counter').removeClass('grey');
376                                                 $j('#character-counter').removeClass('orange');
377                                                 $j('#character-counter').addClass('red');
378                                         }
379                                         $j('#character-counter').text(textlen);
380                                 });
381
382                                 ed.onInit.add(function(ed) {
383                                         ed.pasteAsPlainText = true;
384                                         $j("#profile-jot-text-loading").hide();
385                                         $j(".jothidden").show();
386                                         if (typeof cb!="undefined") cb();
387                                 });
388
389                         }
390                 });
391                 editor = true;
392                 // setup acl popup
393                 $j("a#jot-perms-icon").fancybox({
394                         'transitionIn' : 'elastic',
395                         'transitionOut' : 'elastic'
396                 }); */
397         } else {
398                 if (typeof cb!="undefined") cb();
399         }
400 }
401
402 function enableOnUser(){
403         if (editor) return;
404         $j(this).val("");
405         initEditor();
406 }
407
408 function wallInitEditor() {
409         var plaintext = window.editSelect;
410
411         if(plaintext != 'none') {
412                 tinyMCE.init({
413                         theme : "advanced",
414                         mode : "specific_textareas",
415                         editor_selector: /(profile-jot-text|prvmail-text)/,
416                         plugins : "bbcode,paste",
417                         theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
418                         theme_advanced_buttons2 : "",
419                         theme_advanced_buttons3 : "",
420                         theme_advanced_toolbar_location : "top",
421                         theme_advanced_toolbar_align : "center",
422                         theme_advanced_blockformats : "blockquote,code",
423                         gecko_spellcheck : true,
424                         paste_text_sticky : true,
425                         entity_encoding : "raw",
426                         add_unload_trigger : false,
427                         remove_linebreaks : false,
428                         force_p_newlines : false,
429                         force_br_newlines : true,
430                         forced_root_block : '',
431                         convert_urls: false,
432                         content_css: baseurl + "/view/custom_tinymce.css",
433                                  //Character count
434                         theme_advanced_path : false,
435                         setup : function(ed) {
436                                 ed.onInit.add(function(ed) {
437                                         ed.pasteAsPlainText = true;
438                                         var editorId = ed.editorId;
439                                         var textarea = $j('#'+editorId);
440                                         if (typeof(textarea.attr('tabindex')) != "undefined") {
441                                                 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
442                                                 textarea.attr('tabindex', null);
443                                         }
444                                 });
445                         }
446                 });
447         }
448         else
449                 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
450 }
451
452
453
454
455 function initCrop() {
456         function onEndCrop( coords, dimensions ) {
457                 $( 'x1' ).value = coords.x1;
458                 $( 'y1' ).value = coords.y1;
459                 $( 'x2' ).value = coords.x2;
460                 $( 'y2' ).value = coords.y2;
461                 $( 'width' ).value = dimensions.width;
462                 $( 'height' ).value = dimensions.height;
463         }
464
465         Event.observe( window, 'load', function() {
466                 new Cropper.ImgWithPreview(
467                 'croppa',
468                 {
469                         previewWrap: 'previewWrap',
470                         minWidth: 175,
471                         minHeight: 175,
472                         maxWidth: 640,
473                         maxHeight: 640,
474                         ratioDim: { x: 100, y:100 },
475                         displayOnInit: true,
476                         onEndCrop: onEndCrop
477                 });
478         });
479 }
480
481
482 function confirmDelete() { return confirm(window.delItem); }
483 function commentOpen(obj,id) {
484         if(obj.value == window.commentEmptyText) {
485                 obj.value = "";
486                 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
487                 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
488                 $j("#mod-cmnt-wrap-" + id).show();
489                 openMenu("comment-edit-submit-wrapper-" + id);
490         }
491 }
492 function commentClose(obj,id) {
493         if(obj.value == "") {
494                 obj.value = window.commentEmptyText;
495                 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
496                 $j("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
497                 $j("#mod-cmnt-wrap-" + id).hide();
498                 closeMenu("comment-edit-submit-wrapper-" + id);
499         }
500 }
501
502
503 function commentInsert(obj,id) {
504         var tmpStr = $j("#comment-edit-text-" + id).val();
505         if(tmpStr == window.commentEmptyText) {
506                 tmpStr = "";
507                 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
508                 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
509                 openMenu("comment-edit-submit-wrapper-" + id);
510         }
511         var ins = $j(obj).html();
512         ins = ins.replace("&lt;","<");
513         ins = ins.replace("&gt;",">");
514         ins = ins.replace("&amp;","&");
515         ins = ins.replace("&quot;",'"');
516         $j("#comment-edit-text-" + id).val(tmpStr + ins);
517 }
518
519 function qCommentInsert(obj,id) {
520         var tmpStr = $j("#comment-edit-text-" + id).val();
521         if(tmpStr == window.commentEmptyText) {
522                 tmpStr = "";
523                 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
524                 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
525                 openMenu("comment-edit-submit-wrapper-" + id);
526         }
527         var ins = $j(obj).val();
528         ins = ins.replace("&lt;","<");
529         ins = ins.replace("&gt;",">");
530         ins = ins.replace("&amp;","&");
531         ins = ins.replace("&quot;",'"');
532         $j("#comment-edit-text-" + id).val(tmpStr + ins);
533         $j(obj).val("");
534 }
535
536 function showHideComments(id) {
537         if( $j("#collapsed-comments-" + id).is(":visible")) {
538                 $j("#collapsed-comments-" + id).hide();
539                 $j("#hide-comments-" + id).html(window.showMore);
540         }
541         else {
542                 $j("#collapsed-comments-" + id).show();
543                 $j("#hide-comments-" + id).html(window.showFewer);
544         }
545 }
546
547
548 /*function deleteCheckedItems() {
549         var checkedstr = '';
550
551         $j('.item-select').each( function() {
552                 if($j(this).is(':checked')) {
553                         if(checkedstr.length != 0) {
554                                 checkedstr = checkedstr + ',' + $j(this).val();
555                         }
556                         else {
557                                 checkedstr = $j(this).val();
558                         }
559                 }       
560         });
561         $j.post('item', { dropitems: checkedstr }, function(data) {
562                 window.location.reload();
563         });
564 }*/
565
566 function jotVideoURL() {
567         reply = prompt(window.vidURL);
568         if(reply && reply.length) {
569                 addeditortext('[video]' + reply + '[/video]');
570         }
571 }
572
573 function jotAudioURL() {
574         reply = prompt(window.audURL);
575         if(reply && reply.length) {
576                 addeditortext('[audio]' + reply + '[/audio]');
577         }
578 }
579
580
581 function jotGetLocation() {
582         reply = prompt(window.whereAreU, $j('#jot-location').val());
583         if(reply && reply.length) {
584                 $j('#jot-location').val(reply);
585         }
586 }
587
588 function jotShare(id) {
589         if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
590
591         $j('#like-rotator-' + id).show();
592         $j.get('share/' + id, function(data) {
593                 if (!editor) $j("#profile-jot-text").val("");
594                 initEditor(function(){
595                         addeditortext(data);
596                         $j('#like-rotator-' + id).hide();
597                         $j(window).scrollTop(0);
598                 });
599
600         });
601 }
602
603 function linkdropper(event) {
604         var linkFound = event.dataTransfer.types.contains("text/uri-list");
605         if(linkFound)
606                 event.preventDefault();
607 }
608
609 switch(window.ajaxType) {
610         case 'jot-header':
611                 function jotGetLink() {
612                         reply = prompt(window.linkURL);
613                         if(reply && reply.length) {
614                                 reply = bin2hex(reply);
615                                 $j('#profile-rotator').show();
616                                 $j.get('parse_url?binurl=' + reply, function(data) {
617                                         addeditortext(data);
618                                         $j('#profile-rotator').hide();
619                                 });
620                         }
621                 }
622
623                 function linkdrop(event) {
624                         var reply = event.dataTransfer.getData("text/uri-list");
625                         event.target.textContent = reply;
626                         event.preventDefault();
627                         if(reply && reply.length) {
628                                 reply = bin2hex(reply);
629                                 $j('#profile-rotator').show();
630                                 $j.get('parse_url?binurl=' + reply, function(data) {
631                                         if (!editor) $j("#profile-jot-text").val("");
632                                         initEditor(function(){
633                                                 addeditortext(data);
634                                                 $j('#profile-rotator').hide();
635                                         });
636                                 });
637                         }
638                 }
639                 break;
640         case 'msg-header':
641         case 'wallmsg-header':
642 // TINYMCE -- BAD
643                 function jotGetLink() {
644                         reply = prompt(window.linkURL);
645                         if(reply && reply.length) {
646                                 $j('#profile-rotator').show();
647                                 $j.get('parse_url?url=' + reply, function(data) {
648                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
649                                         $j('#profile-rotator').hide();
650                                 });
651                         }
652                 }
653
654                 function linkdrop(event) {
655                         var reply = event.dataTransfer.getData("text/uri-list");
656                         event.target.textContent = reply;
657                         event.preventDefault();
658                         if(reply && reply.length) {
659                                 $j('#profile-rotator').show();
660                                 $j.get('parse_url?url=' + reply, function(data) {
661                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
662                                         $j('#profile-rotator').hide();
663                                 });
664                         }
665                 }
666
667                 break;
668         default:
669                 break;
670 }
671
672 function showEvent(eventid) {
673 /*      $j.get(
674                 baseurl + '/events/?id='+eventid,
675                 function(data){
676                         $j.fancybox(data);
677                 }
678         );*/                    
679 }
680
681
682 function itemTag(id) {
683         reply = prompt(window.term);
684         if(reply && reply.length) {
685                 reply = reply.replace('#','');
686                 if(reply.length) {
687
688                         commentBusy = true;
689                         $j('body').css('cursor', 'wait');
690
691                         $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
692                         /*if(timer) clearTimeout(timer);
693                         timer = setTimeout(NavUpdate,3000);*/
694                         liking = 1;
695                 }
696         }
697 }
698
699 function itemFiler(id) {
700         
701         $j.get('filer/', function(data){
702
703                 var promptText = $j('#id_term_label', data).text();
704
705                 reply = prompt(promptText);
706                 if(reply && reply.length) {
707                         commentBusy = true;
708                         $j('body').css('cursor', 'wait');
709                         $j.get('filer/' + id + '?term=' + reply, NavUpdate);
710 /*                              if(timer) clearTimeout(timer);
711                         timer = setTimeout(NavUpdate,3000);*/
712                         liking = 1;
713 /*                              $j.fancybox.close();*/
714                 }
715         });
716
717 /*              var bordercolor = $j("input").css("border-color");
718         
719         $j.get('filer/', function(data){
720                 $j.fancybox(data);
721                 $j("#id_term").keypress(function(){
722                         $j(this).css("border-color",bordercolor);
723                 })
724                 $j("#select_term").change(function(){
725                         $j("#id_term").css("border-color",bordercolor);
726                 })
727                 
728                 $j("#filer_save").click(function(e){
729                         e.preventDefault();
730                         reply = $j("#id_term").val();
731                         if(reply && reply.length) {
732                                 commentBusy = true;
733                                 $j('body').css('cursor', 'wait');
734                                 $j.get('filer/' + id + '?term=' + reply);
735                                 if(timer) clearTimeout(timer);
736                                 timer = setTimeout(NavUpdate,3000);
737                                 liking = 1;
738                                 $j.fancybox.close();
739                         } else {
740                                 $j("#id_term").css("border-color","#FF0000");
741                         }
742                         return false;
743                 });
744         });
745 */              
746 }
747
748 function jotClearLocation() {
749         $j('#jot-coord').val('');
750         $j('#profile-nolocation-wrapper').hide();
751 }
752
753 function addeditortext(data) {
754         if(plaintext == 'none') {
755                 var currentText = $j("#profile-jot-text").val();
756                 $j("#profile-jot-text").val(currentText + data);
757         }
758         /*else
759                 tinyMCE.execCommand('mceInsertRawHTML',false,data);*/
760 }
761
762 if(typeof window.geoTag === 'function') window.geoTag();
763
764