]> git.mxchange.org Git - friendica.git/blob - view/theme/frost-mobile/js/theme.js
Merge pull request #473 from pixelroot/master
[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 /*function showHideCommentBox(id) {
548         if( $j('#comment-edit-form-' + id).is(':visible')) {
549                 $j('#comment-edit-form-' + id).hide();
550         }
551         else {
552                 $j('#comment-edit-form-' + id).show();
553         }
554 }*/
555
556
557 /*function deleteCheckedItems() {
558         var checkedstr = '';
559
560         $j('.item-select').each( function() {
561                 if($j(this).is(':checked')) {
562                         if(checkedstr.length != 0) {
563                                 checkedstr = checkedstr + ',' + $j(this).val();
564                         }
565                         else {
566                                 checkedstr = $j(this).val();
567                         }
568                 }       
569         });
570         $j.post('item', { dropitems: checkedstr }, function(data) {
571                 window.location.reload();
572         });
573 }*/
574
575 function jotVideoURL() {
576         reply = prompt(window.vidURL);
577         if(reply && reply.length) {
578                 addeditortext('[video]' + reply + '[/video]');
579         }
580 }
581
582 function jotAudioURL() {
583         reply = prompt(window.audURL);
584         if(reply && reply.length) {
585                 addeditortext('[audio]' + reply + '[/audio]');
586         }
587 }
588
589
590 function jotGetLocation() {
591         reply = prompt(window.whereAreU, $j('#jot-location').val());
592         if(reply && reply.length) {
593                 $j('#jot-location').val(reply);
594         }
595 }
596
597 function jotShare(id) {
598         if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
599
600         $j('#like-rotator-' + id).show();
601         $j.get('share/' + id, function(data) {
602                 if (!editor) $j("#profile-jot-text").val("");
603                 initEditor(function(){
604                         addeditortext(data);
605                         $j('#like-rotator-' + id).hide();
606                         $j(window).scrollTop(0);
607                 });
608
609         });
610 }
611
612 function linkdropper(event) {
613         var linkFound = event.dataTransfer.types.contains("text/uri-list");
614         if(linkFound)
615                 event.preventDefault();
616 }
617
618 switch(window.ajaxType) {
619         case 'jot-header':
620                 function jotGetLink() {
621                         reply = prompt(window.linkURL);
622                         if(reply && reply.length) {
623                                 reply = bin2hex(reply);
624                                 $j('#profile-rotator').show();
625                                 $j.get('parse_url?binurl=' + reply, function(data) {
626                                         addeditortext(data);
627                                         $j('#profile-rotator').hide();
628                                 });
629                         }
630                 }
631
632                 function linkdrop(event) {
633                         var reply = event.dataTransfer.getData("text/uri-list");
634                         event.target.textContent = reply;
635                         event.preventDefault();
636                         if(reply && reply.length) {
637                                 reply = bin2hex(reply);
638                                 $j('#profile-rotator').show();
639                                 $j.get('parse_url?binurl=' + reply, function(data) {
640                                         if (!editor) $j("#profile-jot-text").val("");
641                                         initEditor(function(){
642                                                 addeditortext(data);
643                                                 $j('#profile-rotator').hide();
644                                         });
645                                 });
646                         }
647                 }
648                 break;
649         case 'msg-header':
650         case 'wallmsg-header':
651 // TINYMCE -- BAD
652                 function jotGetLink() {
653                         reply = prompt(window.linkURL);
654                         if(reply && reply.length) {
655                                 $j('#profile-rotator').show();
656                                 $j.get('parse_url?url=' + reply, function(data) {
657                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
658                                         $j('#profile-rotator').hide();
659                                 });
660                         }
661                 }
662
663                 function linkdrop(event) {
664                         var reply = event.dataTransfer.getData("text/uri-list");
665                         event.target.textContent = reply;
666                         event.preventDefault();
667                         if(reply && reply.length) {
668                                 $j('#profile-rotator').show();
669                                 $j.get('parse_url?url=' + reply, function(data) {
670                                         tinyMCE.execCommand('mceInsertRawHTML',false,data);
671                                         $j('#profile-rotator').hide();
672                                 });
673                         }
674                 }
675
676                 break;
677         default:
678                 break;
679 }
680
681 function showEvent(eventid) {
682 /*      $j.get(
683                 baseurl + '/events/?id='+eventid,
684                 function(data){
685                         $j.fancybox(data);
686                 }
687         );*/                    
688 }
689
690
691 function itemTag(id) {
692         reply = prompt(window.term);
693         if(reply && reply.length) {
694                 reply = reply.replace('#','');
695                 if(reply.length) {
696
697                         commentBusy = true;
698                         $j('body').css('cursor', 'wait');
699
700                         $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
701                         /*if(timer) clearTimeout(timer);
702                         timer = setTimeout(NavUpdate,3000);*/
703                         liking = 1;
704                 }
705         }
706 }
707
708 function itemFiler(id) {
709         
710         $j.get('filer/', function(data){
711
712                 var promptText = $j('#id_term_label', data).text();
713
714                 reply = prompt(promptText);
715                 if(reply && reply.length) {
716                         commentBusy = true;
717                         $j('body').css('cursor', 'wait');
718                         $j.get('filer/' + id + '?term=' + reply, NavUpdate);
719 /*                              if(timer) clearTimeout(timer);
720                         timer = setTimeout(NavUpdate,3000);*/
721                         liking = 1;
722 /*                              $j.fancybox.close();*/
723                 }
724         });
725
726 /*              var bordercolor = $j("input").css("border-color");
727         
728         $j.get('filer/', function(data){
729                 $j.fancybox(data);
730                 $j("#id_term").keypress(function(){
731                         $j(this).css("border-color",bordercolor);
732                 })
733                 $j("#select_term").change(function(){
734                         $j("#id_term").css("border-color",bordercolor);
735                 })
736                 
737                 $j("#filer_save").click(function(e){
738                         e.preventDefault();
739                         reply = $j("#id_term").val();
740                         if(reply && reply.length) {
741                                 commentBusy = true;
742                                 $j('body').css('cursor', 'wait');
743                                 $j.get('filer/' + id + '?term=' + reply);
744                                 if(timer) clearTimeout(timer);
745                                 timer = setTimeout(NavUpdate,3000);
746                                 liking = 1;
747                                 $j.fancybox.close();
748                         } else {
749                                 $j("#id_term").css("border-color","#FF0000");
750                         }
751                         return false;
752                 });
753         });
754 */              
755 }
756
757 function jotClearLocation() {
758         $j('#jot-coord').val('');
759         $j('#profile-nolocation-wrapper').hide();
760 }
761
762 function addeditortext(data) {
763         if(plaintext == 'none') {
764                 var currentText = $j("#profile-jot-text").val();
765                 $j("#profile-jot-text").val(currentText + data);
766         }
767         /*else
768                 tinyMCE.execCommand('mceInsertRawHTML',false,data);*/
769 }
770
771 if(typeof window.geoTag === 'function') window.geoTag();
772
773