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 $j("#cnftheme").attr('href', baseurl + "/admin/themes/"+theme);
280 onComplete: function(){
281 $j("div#fancybox-content form").submit(function(e){
282 var url = $j(this).attr('action');
283 // can't get .serialize() to work...
285 $j(this).find("input").each(function(){
286 data[$j(this).attr('name')] = $j(this).val();
288 $j(this).find("select").each(function(){
289 data[$j(this).attr('name')] = $j(this).children(":selected").val();
291 console.log(":)", url, data);
293 $j.post(url, data, function(data) {
294 if(timer) clearTimeout(timer);
307 if(typeof window.photoEdit != 'undefined') {
309 $j(document).keydown(function(event) {
311 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
312 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
317 switch(window.ajaxType) {
319 function jotGetLink() {
320 reply = prompt(window.linkURL);
321 if(reply && reply.length) {
322 reply = bin2hex(reply);
323 $j('#profile-rotator').show();
324 $j.get('parse_url?binurl=' + reply, function(data) {
326 $j('#profile-rotator').hide();
331 function linkdrop(event) {
332 var reply = event.dataTransfer.getData("text/uri-list");
333 event.target.textContent = reply;
334 event.preventDefault();
335 if(reply && reply.length) {
336 reply = bin2hex(reply);
337 $j('#profile-rotator').show();
338 $j.get('parse_url?binurl=' + reply, function(data) {
339 if (!editor) $j("#profile-jot-text").val("");
340 initEditor(function(){
342 $j('#profile-rotator').hide();
349 case 'wallmsg-header':
350 function jotGetLink() {
351 reply = prompt(window.linkURL);
352 if(reply && reply.length) {
353 $j('#profile-rotator').show();
354 $j.get('parse_url?url=' + reply, function(data) {
355 tinyMCE.execCommand('mceInsertRawHTML',false,data);
356 $j('#profile-rotator').hide();
361 function linkdrop(event) {
362 var reply = event.dataTransfer.getData("text/uri-list");
363 event.target.textContent = reply;
364 event.preventDefault();
365 if(reply && reply.length) {
366 $j('#profile-rotator').show();
367 $j.get('parse_url?url=' + reply, function(data) {
368 tinyMCE.execCommand('mceInsertRawHTML',false,data);
369 $j('#profile-rotator').hide();
380 function showEvent(eventid) {
382 baseurl + '/events/?id='+eventid,
389 function initCrop() {
390 function onEndCrop( coords, dimensions ) {
391 $( 'x1' ).value = coords.x1;
392 $( 'y1' ).value = coords.y1;
393 $( 'x2' ).value = coords.x2;
394 $( 'y2' ).value = coords.y2;
395 $( 'width' ).value = dimensions.width;
396 $( 'height' ).value = dimensions.height;
399 Event.observe( window, 'load', function() {
400 new Cropper.ImgWithPreview(
403 previewWrap: 'previewWrap',
408 ratioDim: { x: 100, y:100 },
417 $j(document).mouseup(function (clickPos) {
419 var sysMenu = $j("#system-menu-list");
420 var sysMenuLink = $j(".system-menu-link");
421 var contactsMenu = $j("#contacts-menu-list");
422 var contactsMenuLink = $j(".contacts-menu-link");
423 var networkMenu = $j("#network-menu-list");
424 var networkMenuLink = $j(".network-menu-link");
426 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
427 hideNavMenu("#system-menu-list");
429 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
430 hideNavMenu("#contacts-menu-list");
432 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
433 hideNavMenu("#network-menu-list");
438 function getPageContent(url) {
440 var pos = $j('.main-container').position();
442 $j('.main-container').css('margin-left', pos.left);
443 $j('.main-content-container').hide(0, function () {
444 $j('.main-content-loading').show(0);
447 $j.get(url, function(html) {
448 console.log($j('.main-content-container').html());
449 $j('.main-content-container').html( $j('.main-content-container', html).html() );
450 console.log($j('.main-content-container').html());
451 $j('.main-content-loading').hide(function() {
452 $j('.main-content-container').fadeIn(800,function() {
453 $j('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
460 function showNavMenu(menuID) {
462 if(window.navMenuTimeout[menuID + '-closing']) {
463 window.navMenuTimeout[menuID + '-closing'] = false;
464 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
467 window.navMenuTimeout[menuID + '-opening'] = true;
469 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
470 $j(menuID).slideDown('fast').show();
471 window.navMenuTimeout[menuID + '-opening'] = false;
476 function hideNavMenu(menuID) {
478 if(window.navMenuTimeout[menuID + '-opening']) {
479 window.navMenuTimeout[menuID + '-opening'] = false;
480 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
483 window.navMenuTimeout[menuID + '-closing'] = true;
485 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
486 $j(menuID).slideUp('fast');
487 window.navMenuTimeout[menuID + '-closing'] = false;
494 function insertFormatting(comment,BBcode,id) {
496 var tmpStr = $j("#comment-edit-text-" + id).val();
497 if(tmpStr == comment) {
499 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
500 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
501 openMenu("comment-edit-submit-wrapper-" + id);
502 $j("#comment-edit-text-" + id).val(tmpStr);
505 textarea = document.getElementById("comment-edit-text-" +id);
506 if (document.selection) {
508 selected = document.selection.createRange();
509 if (BBcode == "url"){
510 selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
512 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
513 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
514 var start = textarea.selectionStart;
515 var end = textarea.selectionEnd;
516 if (BBcode == "url"){
517 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
519 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
524 function cmtBbOpen(id) {
525 $j(".comment-edit-bb-" + id).show();
527 function cmtBbClose(id) {
528 $j(".comment-edit-bb-" + id).hide();
531 function confirmDelete() { return confirm(window.delItem); }
533 function commentOpen(obj,id) {
534 if(obj.value == window.commentEmptyText) {
536 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
537 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
538 $j("#mod-cmnt-wrap-" + id).show();
539 openMenu("comment-edit-submit-wrapper-" + id);
542 function commentClose(obj,id) {
543 if(obj.value == "") {
544 obj.value = window.commentEmptyText;
545 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
546 $j("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
547 $j("#mod-cmnt-wrap-" + id).hide();
548 closeMenu("comment-edit-submit-wrapper-" + id);
553 function commentInsert(obj,id) {
554 var tmpStr = $j("#comment-edit-text-" + id).val();
555 if(tmpStr == window.commentEmptyText) {
557 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
558 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
559 openMenu("comment-edit-submit-wrapper-" + id);
561 var ins = $j(obj).html();
562 ins = ins.replace("<","<");
563 ins = ins.replace(">",">");
564 ins = ins.replace("&","&");
565 ins = ins.replace(""",'"');
566 $j("#comment-edit-text-" + id).val(tmpStr + ins);
569 function qCommentInsert(obj,id) {
570 var tmpStr = $j("#comment-edit-text-" + id).val();
571 if(tmpStr == window.commentEmptyText) {
573 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
574 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
575 openMenu("comment-edit-submit-wrapper-" + id);
577 var ins = $j(obj).val();
578 ins = ins.replace("<","<");
579 ins = ins.replace(">",">");
580 ins = ins.replace("&","&");
581 ins = ins.replace(""",'"');
582 $j("#comment-edit-text-" + id).val(tmpStr + ins);
586 function showHideComments(id) {
587 if( $j("#collapsed-comments-" + id).is(":visible")) {
588 $j("#collapsed-comments-" + id).hide();
589 $j("#hide-comments-" + id).html(window.showMore);
592 $j("#collapsed-comments-" + id).show();
593 $j("#hide-comments-" + id).html(window.showFewer);
599 function enableOnUser(){
608 var plaintext = window.editSelect;
609 var ispublic = window.isPublic;
611 function initEditor(cb){
613 $j("#profile-jot-text-loading").show();
614 if(plaintext == 'none') {
615 $j("#profile-jot-text-loading").hide();
616 $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
617 $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
619 $j("a#jot-perms-icon").fancybox({
620 'transitionIn' : 'elastic',
621 'transitionOut' : 'elastic'
623 $j(".jothidden").show();
624 if (typeof cb!="undefined") cb();
629 mode : "specific_textareas",
630 editor_selector: window.editSelect,
631 auto_focus: "profile-jot-text",
632 plugins : "bbcode,paste,autoresize, inlinepopups",
633 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
634 theme_advanced_buttons2 : "",
635 theme_advanced_buttons3 : "",
636 theme_advanced_toolbar_location : "top",
637 theme_advanced_toolbar_align : "center",
638 theme_advanced_blockformats : "blockquote,code",
639 gecko_spellcheck : true,
640 paste_text_sticky : true,
641 entity_encoding : "raw",
642 add_unload_trigger : false,
643 remove_linebreaks : false,
644 force_p_newlines : false,
645 force_br_newlines : true,
646 forced_root_block : '',
648 content_css: window.baseURL + "/view/custom_tinymce.css",
649 theme_advanced_path : false,
650 file_browser_callback : "fcFileBrowser",
651 setup : function(ed) {
653 ed.onKeyDown.add(function(ed,e) {
658 ed.onKeyUp.add(function(ed, e) {
659 var txt = tinyMCE.activeEditor.getContent();
660 match = txt.match(/@([^ \n]+)$/);
662 if(cPopup === null) {
663 cPopup = new ACPopup(this,baseurl+"/acl");
665 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
666 if(! cPopup.ready) cPopup = null;
669 if(cPopup !== null) { cPopup.close(); cPopup = null; }
672 textlen = txt.length;
673 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
674 $j('#profile-jot-desc').html(ispublic);
677 $j('#profile-jot-desc').html(' ');
683 $j('#character-counter').removeClass('red');
684 $j('#character-counter').removeClass('orange');
685 $j('#character-counter').addClass('grey');
687 if((textlen > 140) && (textlen <= 420)) {
688 $j('#character-counter').removeClass('grey');
689 $j('#character-counter').removeClass('red');
690 $j('#character-counter').addClass('orange');
693 $j('#character-counter').removeClass('grey');
694 $j('#character-counter').removeClass('orange');
695 $j('#character-counter').addClass('red');
697 $j('#character-counter').text(textlen);
700 ed.onInit.add(function(ed) {
701 ed.pasteAsPlainText = true;
702 $j("#profile-jot-text-loading").hide();
703 $j(".jothidden").show();
704 if (typeof cb!="undefined") cb();
711 $j("a#jot-perms-icon").fancybox({
712 'transitionIn' : 'none',
713 'transitionOut' : 'none'
716 if (typeof cb!="undefined") cb();
721 function msgInitEditor() {
722 if(plaintext != 'none') {
725 mode : "specific_textareas",
726 editor_selector: /(profile-jot-text|prvmail-text)/,
727 plugins : "bbcode,paste",
728 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
729 theme_advanced_buttons2 : "",
730 theme_advanced_buttons3 : "",
731 theme_advanced_toolbar_location : "top",
732 theme_advanced_toolbar_align : "center",
733 theme_advanced_blockformats : "blockquote,code",
734 gecko_spellcheck : true,
735 paste_text_sticky : true,
736 entity_encoding : "raw",
737 add_unload_trigger : false,
738 remove_linebreaks : false,
739 force_p_newlines : false,
740 force_br_newlines : true,
741 forced_root_block : '',
743 content_css: baseurl + "/view/custom_tinymce.css",
745 theme_advanced_path : false,
746 setup : function(ed) {
747 ed.onInit.add(function(ed) {
748 ed.pasteAsPlainText = true;
749 var editorId = ed.editorId;
750 var textarea = $j('#'+editorId);
751 if (typeof(textarea.attr('tabindex')) != "undefined") {
752 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
753 textarea.attr('tabindex', null);
760 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
764 function profInitEditor() {
767 mode : window.editSelect,
768 plugins : "bbcode,paste",
769 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
770 theme_advanced_buttons2 : "",
771 theme_advanced_buttons3 : "",
772 theme_advanced_toolbar_location : "top",
773 theme_advanced_toolbar_align : "center",
774 theme_advanced_blockformats : "blockquote,code",
775 gecko_spellcheck : true,
776 paste_text_sticky : true,
777 entity_encoding : "raw",
778 add_unload_trigger : false,
779 remove_linebreaks : false,
780 force_p_newlines : false,
781 force_br_newlines : true,
782 forced_root_block : '',
783 content_css: baseurl + "/view/custom_tinymce.css",
784 theme_advanced_path : false,
785 setup : function(ed) {
786 ed.onInit.add(function(ed) {
787 ed.pasteAsPlainText = true;
794 function eventInitEditor() {
798 plugins : "bbcode,paste",
799 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
800 theme_advanced_buttons2 : "",
801 theme_advanced_buttons3 : "",
802 theme_advanced_toolbar_location : "top",
803 theme_advanced_toolbar_align : "center",
804 theme_advanced_blockformats : "blockquote,code",
805 gecko_spellcheck : true,
806 paste_text_sticky : true,
807 entity_encoding : "raw",
808 add_unload_trigger : false,
809 remove_linebreaks : false,
810 force_p_newlines : false,
811 force_br_newlines : true,
812 forced_root_block : '',
813 content_css: baseurl + "/view/custom_tinymce.css",
814 theme_advanced_path : false,
815 setup : function(ed) {
816 ed.onInit.add(function(ed) {
817 ed.pasteAsPlainText = true;
824 function contactInitEditor () {
827 mode : window.editSelect,
828 elements: "contact-edit-info",
830 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
831 theme_advanced_buttons2 : "",
832 theme_advanced_buttons3 : "",
833 theme_advanced_toolbar_location : "top",
834 theme_advanced_toolbar_align : "center",
835 theme_advanced_styles : "blockquote,code",
836 gecko_spellcheck : true,
837 entity_encoding : "raw",
838 add_unload_trigger : false,
839 remove_linebreaks : false,
840 force_p_newlines : false,
841 force_br_newlines : true,
842 forced_root_block : '',
843 content_css: baseurl + "/view/custom_tinymce.css"
849 function wallInitEditor() {
850 var plaintext = window.editSelect;
852 if(plaintext != 'none') {
855 mode : "specific_textareas",
856 editor_selector: /(profile-jot-text|prvmail-text)/,
857 plugins : "bbcode,paste",
858 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
859 theme_advanced_buttons2 : "",
860 theme_advanced_buttons3 : "",
861 theme_advanced_toolbar_location : "top",
862 theme_advanced_toolbar_align : "center",
863 theme_advanced_blockformats : "blockquote,code",
864 gecko_spellcheck : true,
865 paste_text_sticky : true,
866 entity_encoding : "raw",
867 add_unload_trigger : false,
868 remove_linebreaks : false,
869 force_p_newlines : false,
870 force_br_newlines : true,
871 forced_root_block : '',
873 content_css: baseurl + "/view/custom_tinymce.css",
875 theme_advanced_path : false,
876 setup : function(ed) {
877 ed.onInit.add(function(ed) {
878 ed.pasteAsPlainText = true;
879 var editorId = ed.editorId;
880 var textarea = $j('#'+editorId);
881 if (typeof(textarea.attr('tabindex')) != "undefined") {
882 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
883 textarea.attr('tabindex', null);
890 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
893 function deleteCheckedItems() {
896 $j('.item-select').each( function() {
897 if($j(this).is(':checked')) {
898 if(checkedstr.length != 0) {
899 checkedstr = checkedstr + ',' + $j(this).val();
902 checkedstr = $j(this).val();
906 $j.post('item', { dropitems: checkedstr }, function(data) {
907 window.location.reload();
912 function jotVideoURL() {
913 reply = prompt(window.vidURL);
914 if(reply && reply.length) {
915 addeditortext('[video]' + reply + '[/video]');
919 function jotAudioURL() {
920 reply = prompt(window.audURL);
921 if(reply && reply.length) {
922 addeditortext('[audio]' + reply + '[/audio]');
927 function jotGetLocation() {
928 reply = prompt(window.whereAreU, $j('#jot-location').val());
929 if(reply && reply.length) {
930 $j('#jot-location').val(reply);
934 function jotShare(id) {
935 if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
937 $j('#like-rotator-' + id).show();
938 $j.get('share/' + id, function(data) {
939 if (!editor) $j("#profile-jot-text").val("");
940 initEditor(function(){
942 $j('#like-rotator-' + id).hide();
943 $j(window).scrollTop(0);
949 function linkdropper(event) {
950 var linkFound = event.dataTransfer.types.contains("text/uri-list");
952 event.preventDefault();
955 function itemTag(id) {
956 reply = prompt(window.term);
957 if(reply && reply.length) {
958 reply = reply.replace('#','');
962 $j('body').css('cursor', 'wait');
964 $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
965 /*if(timer) clearTimeout(timer);
966 timer = setTimeout(NavUpdate,3000);*/
972 function itemFiler(id) {
974 var bordercolor = $j("input").css("border-color");
976 $j.get('filer/', function(data){
978 $j("#id_term").keypress(function(){
979 $j(this).css("border-color",bordercolor);
981 $j("#select_term").change(function(){
982 $j("#id_term").css("border-color",bordercolor);
985 $j("#filer_save").click(function(e){
987 reply = $j("#id_term").val();
988 if(reply && reply.length) {
990 $j('body').css('cursor', 'wait');
991 $j.get('filer/' + id + '?term=' + reply, NavUpdate);
992 /* if(timer) clearTimeout(timer);
993 timer = setTimeout(NavUpdate,3000);*/
997 $j("#id_term").css("border-color","#FF0000");
1005 function jotClearLocation() {
1006 $j('#jot-coord').val('');
1007 $j('#profile-nolocation-wrapper').hide();
1010 function addeditortext(data) {
1011 if(plaintext == 'none') {
1012 var currentText = $j("#profile-jot-text").val();
1013 $j("#profile-jot-text").val(currentText + data);
1016 tinyMCE.execCommand('mceInsertRawHTML',false,data);
1019 if(typeof window.geoTag === 'function') window.geoTag();