1 $j(document).ready(function() {
3 window.navMenuTimeout = {
4 '#network-menu-list-timeout': null,
5 '#contacts-menu-list-timeout': null,
6 '#system-menu-list-timeout': null,
7 '#network-menu-list-opening': false,
8 '#contacts-menu-list-opening': false,
9 '#system-menu-list-opening': false,
10 '#network-menu-list-closing': false,
11 '#contacts-menu-list-closing': false,
12 '#system-menu-list-closing': false
20 if(typeof acl=="undefined"){
23 [ window.allowCID,window.allowGID,window.denyCID,window.denyGID ]
27 /* enable tinymce on focus and click */
28 $j("#profile-jot-text").focus(enableOnUser);
29 $j("#profile-jot-text").click(enableOnUser);
32 $j('.nav-menu-link').hover(function() {
33 showNavMenu($j(this).attr('rel'));
35 hideNavMenu($j(this).attr('rel'));
38 /* $j('html').click(function() { $j("#nav-notifications-menu" ).hide(); });*/
40 $j('.group-edit-icon').hover(
42 $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
44 $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
47 $j('.sidebar-group-element').hover(
49 id = $j(this).attr('id');
50 $j('#edit-' + id).addClass('icon'); $j('#edit-' + id).removeClass('iconspacer');},
53 id = $j(this).attr('id');
54 $j('#edit-' + id).removeClass('icon');$j('#edit-' + id).addClass('iconspacer');}
58 $j('.savedsearchdrop').hover(
60 $j(this).addClass('drop'); $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
62 $j(this).removeClass('drop'); $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
65 $j('.savedsearchterm').hover(
67 id = $j(this).attr('id');
68 $j('#drop-' + id).addClass('icon'); $j('#drop-' + id).addClass('drophide'); $j('#drop-' + id).removeClass('iconspacer');},
71 id = $j(this).attr('id');
72 $j('#drop-' + id).removeClass('icon');$j('#drop-' + id).removeClass('drophide'); $j('#drop-' + id).addClass('iconspacer');}
75 /* $j('.nav-load-page-link').click(function() {
76 getPageContent( $j(this).attr('href') );
77 hideNavMenu( '#' + $j(this).closest('ul').attr('id') );
81 if(window.autoCompleteType == "display-head") {
82 //$j(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
83 // make auto-complete work in more places
84 //$j(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
85 $j(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
88 if(window.aclType == "event_head") {
89 $j('#events-calendar').fullCalendar({
90 events: baseurl + '/events/json/',
92 left: 'prev,next today',
94 right: 'month,agendaWeek,agendaDay'
97 eventClick: function(calEvent, jsEvent, view) {
98 showEvent(calEvent.id);
101 eventRender: function(event, element, view) {
102 //console.log(view.name);
103 if (event.item['author-name']==null) return;
106 element.find(".fc-event-title").html(
107 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
108 event.item['author-avatar'],
109 event.item['author-name'],
114 element.find(".fc-event-title").html(
115 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
116 event.item['author-avatar'],
117 event.item['author-name'],
123 element.find(".fc-event-title").html(
124 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
125 event.item['author-avatar'],
126 event.item['author-name'],
137 var args=location.href.replace(baseurl,"").split("/");
138 if (args.length>=4) {
139 $j("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
143 var hash = location.hash.split("-")
144 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
147 $j('#event-share-checkbox').change(function() {
149 if ($j('#event-share-checkbox').is(':checked')) {
150 $j('#acl-wrapper').show();
153 $j('#acl-wrapper').hide();
155 }).trigger('change');
158 if(window.aclType == "settings-head" || window.aclType == "photos_head" || window.aclType == "event_head") {
159 $j('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
161 $j('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
162 selstr = $j(this).text();
163 $j('#jot-perms-icon').removeClass('unlock').addClass('lock');
164 $j('#jot-public').hide();
167 $j('#jot-perms-icon').removeClass('lock').addClass('unlock');
168 $j('#jot-public').show();
171 }).trigger('change');
174 /* $j('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
176 $j('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
177 selstr = $j(this).text();
178 $j('#jot-public').hide();
181 $j('#jot-public').show();
184 }).trigger('change');*/
187 switch(window.autocompleteType) {
189 var a = $j("#recip").autocomplete({
190 serviceUrl: baseurl + '/acl',
193 onSelect: function(value,data) {
194 $j("#recip-complete").val(data);
198 case 'contacts-head':
199 var a = $j("#contacts-search").autocomplete({
200 serviceUrl: baseurl + '/acl',
204 a.setOptions({ params: { type: 'a' }});
211 if(typeof window.AjaxUpload != "undefined") {
212 switch(window.ajaxType) {
214 var uploader = new window.AjaxUpload(
216 { action: 'wall_upload/'+window.nickname,
218 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
219 onComplete: function(file,response) {
220 addeditortext(response);
221 $j('#profile-rotator').hide();
226 var file_uploader = new window.AjaxUpload(
228 { action: 'wall_attach/'+window.nickname,
230 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
231 onComplete: function(file,response) {
232 addeditortext(response);
233 $j('#profile-rotator').hide();
239 var uploader = new window.AjaxUpload(
241 { action: 'wall_upload/' + window.nickname,
243 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
244 onComplete: function(file,response) {
245 tinyMCE.execCommand('mceInsertRawHTML',false,response);
246 $j('#profile-rotator').hide();
259 // update pending count //
262 $j("nav").bind('nav-update', function(e,data){
263 var elm = $j('#pending-update');
264 var register = $j(data).find('register').text();
265 if (register=="0") { register=""; elm.hide();} else { elm.show(); }
273 $j("#cnftheme").fancybox({
275 autoDimensions: false,
277 var theme = $j("#id_theme :selected").val();
278 var theme_mobile = $j("#id_theme_mobile :selected").val();
279 $j("#cnftheme").attr('href', baseurl + "/admin/themes/"+theme);
281 onComplete: function(){
282 $j("div#fancybox-content form").submit(function(e){
283 var url = $j(this).attr('action');
284 // can't get .serialize() to work...
286 $j(this).find("input").each(function(){
287 data[$j(this).attr('name')] = $j(this).val();
289 $j(this).find("select").each(function(){
290 data[$j(this).attr('name')] = $j(this).children(":selected").val();
292 console.log(":)", url, data);
294 $j.post(url, data, function(data) {
295 if(timer) clearTimeout(timer);
308 if(typeof window.photoEdit != 'undefined') {
310 $j(document).keydown(function(event) {
312 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
313 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
318 switch(window.ajaxType) {
320 function jotGetLink() {
321 reply = prompt(window.linkURL);
322 if(reply && reply.length) {
323 reply = bin2hex(reply);
324 $j('#profile-rotator').show();
325 $j.get('parse_url?binurl=' + reply, function(data) {
327 $j('#profile-rotator').hide();
332 function linkdrop(event) {
333 var reply = event.dataTransfer.getData("text/uri-list");
334 event.target.textContent = reply;
335 event.preventDefault();
336 if(reply && reply.length) {
337 reply = bin2hex(reply);
338 $j('#profile-rotator').show();
339 $j.get('parse_url?binurl=' + reply, function(data) {
340 if (!editor) $j("#profile-jot-text").val("");
341 initEditor(function(){
343 $j('#profile-rotator').hide();
350 case 'wallmsg-header':
351 function jotGetLink() {
352 reply = prompt(window.linkURL);
353 if(reply && reply.length) {
354 $j('#profile-rotator').show();
355 $j.get('parse_url?url=' + reply, function(data) {
356 tinyMCE.execCommand('mceInsertRawHTML',false,data);
357 $j('#profile-rotator').hide();
362 function linkdrop(event) {
363 var reply = event.dataTransfer.getData("text/uri-list");
364 event.target.textContent = reply;
365 event.preventDefault();
366 if(reply && reply.length) {
367 $j('#profile-rotator').show();
368 $j.get('parse_url?url=' + reply, function(data) {
369 tinyMCE.execCommand('mceInsertRawHTML',false,data);
370 $j('#profile-rotator').hide();
381 function showEvent(eventid) {
383 baseurl + '/events/?id='+eventid,
390 function initCrop() {
391 function onEndCrop( coords, dimensions ) {
392 $( 'x1' ).value = coords.x1;
393 $( 'y1' ).value = coords.y1;
394 $( 'x2' ).value = coords.x2;
395 $( 'y2' ).value = coords.y2;
396 $( 'width' ).value = dimensions.width;
397 $( 'height' ).value = dimensions.height;
400 Event.observe( window, 'load', function() {
401 new Cropper.ImgWithPreview(
404 previewWrap: 'previewWrap',
409 ratioDim: { x: 100, y:100 },
418 $j(document).mouseup(function (clickPos) {
420 var sysMenu = $j("#system-menu-list");
421 var sysMenuLink = $j(".system-menu-link");
422 var contactsMenu = $j("#contacts-menu-list");
423 var contactsMenuLink = $j(".contacts-menu-link");
424 var networkMenu = $j("#network-menu-list");
425 var networkMenuLink = $j(".network-menu-link");
427 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
428 hideNavMenu("#system-menu-list");
430 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
431 hideNavMenu("#contacts-menu-list");
433 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
434 hideNavMenu("#network-menu-list");
439 function getPageContent(url) {
441 var pos = $j('.main-container').position();
443 $j('.main-container').css('margin-left', pos.left);
444 $j('.main-content-container').hide(0, function () {
445 $j('.main-content-loading').show(0);
448 $j.get(url, function(html) {
449 console.log($j('.main-content-container').html());
450 $j('.main-content-container').html( $j('.main-content-container', html).html() );
451 console.log($j('.main-content-container').html());
452 $j('.main-content-loading').hide(function() {
453 $j('.main-content-container').fadeIn(800,function() {
454 $j('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
461 function showNavMenu(menuID) {
463 if(window.navMenuTimeout[menuID + '-closing']) {
464 window.navMenuTimeout[menuID + '-closing'] = false;
465 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
468 window.navMenuTimeout[menuID + '-opening'] = true;
470 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
471 $j(menuID).slideDown('fast').show();
472 window.navMenuTimeout[menuID + '-opening'] = false;
477 function hideNavMenu(menuID) {
479 if(window.navMenuTimeout[menuID + '-opening']) {
480 window.navMenuTimeout[menuID + '-opening'] = false;
481 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
484 window.navMenuTimeout[menuID + '-closing'] = true;
486 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
487 $j(menuID).slideUp('fast');
488 window.navMenuTimeout[menuID + '-closing'] = false;
495 function insertFormatting(comment,BBcode,id) {
497 var tmpStr = $j("#comment-edit-text-" + id).val();
498 if(tmpStr == comment) {
500 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
501 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
502 openMenu("comment-edit-submit-wrapper-" + id);
503 $j("#comment-edit-text-" + id).val(tmpStr);
506 textarea = document.getElementById("comment-edit-text-" +id);
507 if (document.selection) {
509 selected = document.selection.createRange();
510 if (BBcode == "url"){
511 selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
513 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
514 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
515 var start = textarea.selectionStart;
516 var end = textarea.selectionEnd;
517 if (BBcode == "url"){
518 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
520 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
525 function cmtBbOpen(id) {
526 $j("#comment-edit-bb-" + id).show();
528 function cmtBbClose(id) {
529 $j("#comment-edit-bb-" + id).hide();
532 function confirmDelete() { return confirm(window.delItem); }
534 function commentOpen(obj,id) {
535 if(obj.value == window.commentEmptyText) {
537 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
538 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
539 $j("#mod-cmnt-wrap-" + id).show();
540 openMenu("comment-edit-submit-wrapper-" + id);
543 function commentClose(obj,id) {
544 if(obj.value == "") {
545 obj.value = window.commentEmptyText;
546 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
547 $j("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
548 $j("#mod-cmnt-wrap-" + id).hide();
549 closeMenu("comment-edit-submit-wrapper-" + id);
554 function commentInsert(obj,id) {
555 var tmpStr = $j("#comment-edit-text-" + id).val();
556 if(tmpStr == window.commentEmptyText) {
558 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
559 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
560 openMenu("comment-edit-submit-wrapper-" + id);
562 var ins = $j(obj).html();
563 ins = ins.replace("<","<");
564 ins = ins.replace(">",">");
565 ins = ins.replace("&","&");
566 ins = ins.replace(""",'"');
567 $j("#comment-edit-text-" + id).val(tmpStr + ins);
570 function qCommentInsert(obj,id) {
571 var tmpStr = $j("#comment-edit-text-" + id).val();
572 if(tmpStr == window.commentEmptyText) {
574 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
575 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
576 openMenu("comment-edit-submit-wrapper-" + id);
578 var ins = $j(obj).val();
579 ins = ins.replace("<","<");
580 ins = ins.replace(">",">");
581 ins = ins.replace("&","&");
582 ins = ins.replace(""",'"');
583 $j("#comment-edit-text-" + id).val(tmpStr + ins);
587 function showHideComments(id) {
588 if( $j("#collapsed-comments-" + id).is(":visible")) {
589 $j("#collapsed-comments-" + id).hide();
590 $j("#hide-comments-" + id).html(window.showMore);
593 $j("#collapsed-comments-" + id).show();
594 $j("#hide-comments-" + id).html(window.showFewer);
598 /*function showHideCommentBox(id) {
599 if( $j('#comment-edit-form-' + id).is(':visible')) {
600 $j('#comment-edit-form-' + id).hide();
603 $j('#comment-edit-form-' + id).show();
609 function enableOnUser(){
618 var plaintext = window.editSelect;
619 var ispublic = window.isPublic;
621 function initEditor(cb){
623 $j("#profile-jot-text-loading").show();
624 if(plaintext == 'none') {
625 $j("#profile-jot-text-loading").hide();
626 $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
627 $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
629 $j("a#jot-perms-icon").fancybox({
630 'transitionIn' : 'elastic',
631 'transitionOut' : 'elastic'
633 $j(".jothidden").show();
634 if (typeof cb!="undefined") cb();
639 mode : "specific_textareas",
640 editor_selector: window.editSelect,
641 auto_focus: "profile-jot-text",
642 plugins : "bbcode,paste,autoresize, inlinepopups",
643 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
644 theme_advanced_buttons2 : "",
645 theme_advanced_buttons3 : "",
646 theme_advanced_toolbar_location : "top",
647 theme_advanced_toolbar_align : "center",
648 theme_advanced_blockformats : "blockquote,code",
649 gecko_spellcheck : true,
650 paste_text_sticky : true,
651 entity_encoding : "raw",
652 add_unload_trigger : false,
653 remove_linebreaks : false,
654 force_p_newlines : false,
655 force_br_newlines : true,
656 forced_root_block : '',
658 content_css: window.baseURL + "/view/custom_tinymce.css",
659 theme_advanced_path : false,
660 file_browser_callback : "fcFileBrowser",
661 setup : function(ed) {
663 ed.onKeyDown.add(function(ed,e) {
668 ed.onKeyUp.add(function(ed, e) {
669 var txt = tinyMCE.activeEditor.getContent();
670 match = txt.match(/@([^ \n]+)$/);
672 if(cPopup === null) {
673 cPopup = new ACPopup(this,baseurl+"/acl");
675 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
676 if(! cPopup.ready) cPopup = null;
679 if(cPopup !== null) { cPopup.close(); cPopup = null; }
682 textlen = txt.length;
683 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
684 $j('#profile-jot-desc').html(ispublic);
687 $j('#profile-jot-desc').html(' ');
693 $j('#character-counter').removeClass('red');
694 $j('#character-counter').removeClass('orange');
695 $j('#character-counter').addClass('grey');
697 if((textlen > 140) && (textlen <= 420)) {
698 $j('#character-counter').removeClass('grey');
699 $j('#character-counter').removeClass('red');
700 $j('#character-counter').addClass('orange');
703 $j('#character-counter').removeClass('grey');
704 $j('#character-counter').removeClass('orange');
705 $j('#character-counter').addClass('red');
707 $j('#character-counter').text(textlen);
710 ed.onInit.add(function(ed) {
711 ed.pasteAsPlainText = true;
712 $j("#profile-jot-text-loading").hide();
713 $j(".jothidden").show();
714 if (typeof cb!="undefined") cb();
721 $j("a#jot-perms-icon").fancybox({
722 'transitionIn' : 'none',
723 'transitionOut' : 'none'
726 if (typeof cb!="undefined") cb();
731 function msgInitEditor() {
732 if(plaintext != 'none') {
735 mode : "specific_textareas",
736 editor_selector: /(profile-jot-text|prvmail-text)/,
737 plugins : "bbcode,paste",
738 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
739 theme_advanced_buttons2 : "",
740 theme_advanced_buttons3 : "",
741 theme_advanced_toolbar_location : "top",
742 theme_advanced_toolbar_align : "center",
743 theme_advanced_blockformats : "blockquote,code",
744 gecko_spellcheck : true,
745 paste_text_sticky : true,
746 entity_encoding : "raw",
747 add_unload_trigger : false,
748 remove_linebreaks : false,
749 force_p_newlines : false,
750 force_br_newlines : true,
751 forced_root_block : '',
753 content_css: baseurl + "/view/custom_tinymce.css",
755 theme_advanced_path : false,
756 setup : function(ed) {
757 ed.onInit.add(function(ed) {
758 ed.pasteAsPlainText = true;
759 var editorId = ed.editorId;
760 var textarea = $j('#'+editorId);
761 if (typeof(textarea.attr('tabindex')) != "undefined") {
762 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
763 textarea.attr('tabindex', null);
770 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
774 function profInitEditor() {
777 mode : window.editSelect,
778 plugins : "bbcode,paste",
779 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
780 theme_advanced_buttons2 : "",
781 theme_advanced_buttons3 : "",
782 theme_advanced_toolbar_location : "top",
783 theme_advanced_toolbar_align : "center",
784 theme_advanced_blockformats : "blockquote,code",
785 gecko_spellcheck : true,
786 paste_text_sticky : true,
787 entity_encoding : "raw",
788 add_unload_trigger : false,
789 remove_linebreaks : false,
790 force_p_newlines : false,
791 force_br_newlines : true,
792 forced_root_block : '',
793 content_css: baseurl + "/view/custom_tinymce.css",
794 theme_advanced_path : false,
795 setup : function(ed) {
796 ed.onInit.add(function(ed) {
797 ed.pasteAsPlainText = true;
804 function eventInitEditor() {
808 plugins : "bbcode,paste",
809 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
810 theme_advanced_buttons2 : "",
811 theme_advanced_buttons3 : "",
812 theme_advanced_toolbar_location : "top",
813 theme_advanced_toolbar_align : "center",
814 theme_advanced_blockformats : "blockquote,code",
815 gecko_spellcheck : true,
816 paste_text_sticky : true,
817 entity_encoding : "raw",
818 add_unload_trigger : false,
819 remove_linebreaks : false,
820 force_p_newlines : false,
821 force_br_newlines : true,
822 forced_root_block : '',
823 content_css: baseurl + "/view/custom_tinymce.css",
824 theme_advanced_path : false,
825 setup : function(ed) {
826 ed.onInit.add(function(ed) {
827 ed.pasteAsPlainText = true;
834 function contactInitEditor () {
837 mode : window.editSelect,
838 elements: "contact-edit-info",
840 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
841 theme_advanced_buttons2 : "",
842 theme_advanced_buttons3 : "",
843 theme_advanced_toolbar_location : "top",
844 theme_advanced_toolbar_align : "center",
845 theme_advanced_styles : "blockquote,code",
846 gecko_spellcheck : true,
847 entity_encoding : "raw",
848 add_unload_trigger : false,
849 remove_linebreaks : false,
850 force_p_newlines : false,
851 force_br_newlines : true,
852 forced_root_block : '',
853 content_css: baseurl + "/view/custom_tinymce.css"
859 function wallInitEditor() {
860 var plaintext = window.editSelect;
862 if(plaintext != 'none') {
865 mode : "specific_textareas",
866 editor_selector: /(profile-jot-text|prvmail-text)/,
867 plugins : "bbcode,paste",
868 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
869 theme_advanced_buttons2 : "",
870 theme_advanced_buttons3 : "",
871 theme_advanced_toolbar_location : "top",
872 theme_advanced_toolbar_align : "center",
873 theme_advanced_blockformats : "blockquote,code",
874 gecko_spellcheck : true,
875 paste_text_sticky : true,
876 entity_encoding : "raw",
877 add_unload_trigger : false,
878 remove_linebreaks : false,
879 force_p_newlines : false,
880 force_br_newlines : true,
881 forced_root_block : '',
883 content_css: baseurl + "/view/custom_tinymce.css",
885 theme_advanced_path : false,
886 setup : function(ed) {
887 ed.onInit.add(function(ed) {
888 ed.pasteAsPlainText = true;
889 var editorId = ed.editorId;
890 var textarea = $j('#'+editorId);
891 if (typeof(textarea.attr('tabindex')) != "undefined") {
892 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
893 textarea.attr('tabindex', null);
900 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
903 function deleteCheckedItems() {
906 $j('.item-select').each( function() {
907 if($j(this).is(':checked')) {
908 if(checkedstr.length != 0) {
909 checkedstr = checkedstr + ',' + $j(this).val();
912 checkedstr = $j(this).val();
916 $j.post('item', { dropitems: checkedstr }, function(data) {
917 window.location.reload();
922 function jotVideoURL() {
923 reply = prompt(window.vidURL);
924 if(reply && reply.length) {
925 addeditortext('[video]' + reply + '[/video]');
929 function jotAudioURL() {
930 reply = prompt(window.audURL);
931 if(reply && reply.length) {
932 addeditortext('[audio]' + reply + '[/audio]');
937 function jotGetLocation() {
938 reply = prompt(window.whereAreU, $j('#jot-location').val());
939 if(reply && reply.length) {
940 $j('#jot-location').val(reply);
944 function jotShare(id) {
945 if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
947 $j('#like-rotator-' + id).show();
948 $j.get('share/' + id, function(data) {
949 if (!editor) $j("#profile-jot-text").val("");
950 initEditor(function(){
952 $j('#like-rotator-' + id).hide();
953 $j(window).scrollTop(0);
959 function linkdropper(event) {
960 var linkFound = event.dataTransfer.types.contains("text/uri-list");
962 event.preventDefault();
965 function itemTag(id) {
966 reply = prompt(window.term);
967 if(reply && reply.length) {
968 reply = reply.replace('#','');
972 $j('body').css('cursor', 'wait');
974 $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
975 /*if(timer) clearTimeout(timer);
976 timer = setTimeout(NavUpdate,3000);*/
982 function itemFiler(id) {
984 var bordercolor = $j("input").css("border-color");
986 $j.get('filer/', function(data){
988 $j("#id_term").keypress(function(){
989 $j(this).css("border-color",bordercolor);
991 $j("#select_term").change(function(){
992 $j("#id_term").css("border-color",bordercolor);
995 $j("#filer_save").click(function(e){
997 reply = $j("#id_term").val();
998 if(reply && reply.length) {
1000 $j('body').css('cursor', 'wait');
1001 $j.get('filer/' + id + '?term=' + reply, NavUpdate);
1002 /* if(timer) clearTimeout(timer);
1003 timer = setTimeout(NavUpdate,3000);*/
1005 $j.fancybox.close();
1007 $j("#id_term").css("border-color","#FF0000");
1015 function jotClearLocation() {
1016 $j('#jot-coord').val('');
1017 $j('#profile-nolocation-wrapper').hide();
1020 function addeditortext(data) {
1021 if(plaintext == 'none') {
1022 var currentText = $j("#profile-jot-text").val();
1023 $j("#profile-jot-text").val(currentText + data);
1026 tinyMCE.execCommand('mceInsertRawHTML',false,data);
1029 if(typeof window.geoTag === 'function') window.geoTag();