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 window.aclInit !="undefined" && 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-list, .nav-menu-icon').hover(function() {
33 showNavMenu($j(this).attr('point'));
35 hideNavMenu($j(this).attr('point'));
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 function homeRedirect() {
309 $j('html').fadeOut('slow', function(){
310 window.location = baseurl + "/login";
315 if(typeof window.photoEdit != 'undefined') {
317 $j(document).keydown(function(event) {
319 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
320 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
325 switch(window.ajaxType) {
327 function jotGetLink() {
328 reply = prompt(window.linkURL);
329 if(reply && reply.length) {
330 reply = bin2hex(reply);
331 $j('#profile-rotator').show();
332 $j.get('parse_url?binurl=' + reply, function(data) {
334 $j('#profile-rotator').hide();
339 function linkdrop(event) {
340 var reply = event.dataTransfer.getData("text/uri-list");
341 event.target.textContent = reply;
342 event.preventDefault();
343 if(reply && reply.length) {
344 reply = bin2hex(reply);
345 $j('#profile-rotator').show();
346 $j.get('parse_url?binurl=' + reply, function(data) {
347 if (!editor) $j("#profile-jot-text").val("");
348 initEditor(function(){
350 $j('#profile-rotator').hide();
357 case 'wallmsg-header':
358 function jotGetLink() {
359 reply = prompt(window.linkURL);
360 if(reply && reply.length) {
361 $j('#profile-rotator').show();
362 $j.get('parse_url?url=' + reply, function(data) {
363 tinyMCE.execCommand('mceInsertRawHTML',false,data);
364 $j('#profile-rotator').hide();
369 function linkdrop(event) {
370 var reply = event.dataTransfer.getData("text/uri-list");
371 event.target.textContent = reply;
372 event.preventDefault();
373 if(reply && reply.length) {
374 $j('#profile-rotator').show();
375 $j.get('parse_url?url=' + reply, function(data) {
376 tinyMCE.execCommand('mceInsertRawHTML',false,data);
377 $j('#profile-rotator').hide();
388 function showEvent(eventid) {
390 baseurl + '/events/?id='+eventid,
397 function initCrop() {
398 function onEndCrop( coords, dimensions ) {
399 $( 'x1' ).value = coords.x1;
400 $( 'y1' ).value = coords.y1;
401 $( 'x2' ).value = coords.x2;
402 $( 'y2' ).value = coords.y2;
403 $( 'width' ).value = dimensions.width;
404 $( 'height' ).value = dimensions.height;
407 Event.observe( window, 'load', function() {
408 new Cropper.ImgWithPreview(
411 previewWrap: 'previewWrap',
416 ratioDim: { x: 100, y:100 },
425 $j(document).mouseup(function (clickPos) {
427 var sysMenu = $j("#system-menu-list");
428 var sysMenuLink = $j(".system-menu-link");
429 var contactsMenu = $j("#contacts-menu-list");
430 var contactsMenuLink = $j(".contacts-menu-link");
431 var networkMenu = $j("#network-menu-list");
432 var networkMenuLink = $j(".network-menu-link");
434 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
435 hideNavMenu("#system-menu-list");
437 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
438 hideNavMenu("#contacts-menu-list");
440 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
441 hideNavMenu("#network-menu-list");
446 function getPageContent(url) {
448 var pos = $j('.main-container').position();
450 $j('.main-container').css('margin-left', pos.left);
451 $j('.main-content-container').hide(0, function () {
452 $j('.main-content-loading').show(0);
455 $j.get(url, function(html) {
456 console.log($j('.main-content-container').html());
457 $j('.main-content-container').html( $j('.main-content-container', html).html() );
458 console.log($j('.main-content-container').html());
459 $j('.main-content-loading').hide(function() {
460 $j('.main-content-container').fadeIn(800,function() {
461 $j('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
468 function showNavMenu(menuID) {
470 if(window.navMenuTimeout[menuID + '-closing']) {
471 window.navMenuTimeout[menuID + '-closing'] = false;
472 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
475 window.navMenuTimeout[menuID + '-opening'] = true;
477 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
478 $j(menuID).slideDown('fast').show();
479 window.navMenuTimeout[menuID + '-opening'] = false;
484 function hideNavMenu(menuID) {
486 if(window.navMenuTimeout[menuID + '-opening']) {
487 window.navMenuTimeout[menuID + '-opening'] = false;
488 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
491 window.navMenuTimeout[menuID + '-closing'] = true;
493 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
494 $j(menuID).slideUp('fast');
495 window.navMenuTimeout[menuID + '-closing'] = false;
502 function insertFormatting(comment,BBcode,id) {
504 var tmpStr = $j("#comment-edit-text-" + id).val();
505 if(tmpStr == comment) {
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 $j("#comment-edit-text-" + id).val(tmpStr);
513 textarea = document.getElementById("comment-edit-text-" +id);
514 if (document.selection) {
516 selected = document.selection.createRange();
517 if (BBcode == "url"){
518 selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
520 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
521 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
522 var start = textarea.selectionStart;
523 var end = textarea.selectionEnd;
524 if (BBcode == "url"){
525 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
527 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
532 function cmtBbOpen(id) {
533 $j("#comment-edit-bb-" + id).show();
535 function cmtBbClose(id) {
536 $j("#comment-edit-bb-" + id).hide();
539 function confirmDelete() { return confirm(window.delItem); }
541 function commentOpen(obj,id) {
542 if(obj.value == window.commentEmptyText) {
544 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
545 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
546 $j("#mod-cmnt-wrap-" + id).show();
547 openMenu("comment-edit-submit-wrapper-" + id);
550 function commentClose(obj,id) {
551 if(obj.value == "") {
552 obj.value = window.commentEmptyText;
553 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
554 $j("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
555 $j("#mod-cmnt-wrap-" + id).hide();
556 closeMenu("comment-edit-submit-wrapper-" + id);
561 function commentInsert(obj,id) {
562 var tmpStr = $j("#comment-edit-text-" + id).val();
563 if(tmpStr == window.commentEmptyText) {
565 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
566 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
567 openMenu("comment-edit-submit-wrapper-" + id);
569 var ins = $j(obj).html();
570 ins = ins.replace("<","<");
571 ins = ins.replace(">",">");
572 ins = ins.replace("&","&");
573 ins = ins.replace(""",'"');
574 $j("#comment-edit-text-" + id).val(tmpStr + ins);
577 function qCommentInsert(obj,id) {
578 var tmpStr = $j("#comment-edit-text-" + id).val();
579 if(tmpStr == window.commentEmptyText) {
581 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
582 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
583 openMenu("comment-edit-submit-wrapper-" + id);
585 var ins = $j(obj).val();
586 ins = ins.replace("<","<");
587 ins = ins.replace(">",">");
588 ins = ins.replace("&","&");
589 ins = ins.replace(""",'"');
590 $j("#comment-edit-text-" + id).val(tmpStr + ins);
594 /*function showHideCommentBox(id) {
595 if( $j('#comment-edit-form-' + id).is(':visible')) {
596 $j('#comment-edit-form-' + id).hide();
599 $j('#comment-edit-form-' + id).show();
605 function enableOnUser(){
614 var plaintext = window.editSelect;
615 var ispublic = window.isPublic;
617 function initEditor(cb){
619 $j("#profile-jot-text-loading").show();
620 if(plaintext == 'none') {
621 $j("#profile-jot-text-loading").hide();
622 $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
623 $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
625 $j("a#jot-perms-icon").fancybox({
626 'transitionIn' : 'none', //'elastic',
627 'transitionOut' : 'none' //'elastic'
629 $j(".jothidden").show();
630 if (typeof cb!="undefined") cb();
635 mode : "specific_textareas",
636 editor_selector: window.editSelect,
637 auto_focus: "profile-jot-text",
638 plugins : "bbcode,paste,autoresize, inlinepopups",
639 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
640 theme_advanced_buttons2 : "",
641 theme_advanced_buttons3 : "",
642 theme_advanced_toolbar_location : "top",
643 theme_advanced_toolbar_align : "center",
644 theme_advanced_blockformats : "blockquote,code",
645 gecko_spellcheck : true,
646 paste_text_sticky : true,
647 entity_encoding : "raw",
648 add_unload_trigger : false,
649 remove_linebreaks : false,
650 force_p_newlines : false,
651 force_br_newlines : true,
652 forced_root_block : '',
654 content_css: window.baseURL + "/view/custom_tinymce.css",
655 theme_advanced_path : false,
656 file_browser_callback : "fcFileBrowser",
657 setup : function(ed) {
659 ed.onKeyDown.add(function(ed,e) {
664 ed.onKeyUp.add(function(ed, e) {
665 var txt = tinyMCE.activeEditor.getContent();
666 match = txt.match(/@([^ \n]+)$/);
668 if(cPopup === null) {
669 cPopup = new ACPopup(this,baseurl+"/acl");
671 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
672 if(! cPopup.ready) cPopup = null;
675 if(cPopup !== null) { cPopup.close(); cPopup = null; }
678 textlen = txt.length;
679 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
680 $j('#profile-jot-desc').html(ispublic);
683 $j('#profile-jot-desc').html(' ');
689 $j('#character-counter').removeClass('red');
690 $j('#character-counter').removeClass('orange');
691 $j('#character-counter').addClass('grey');
693 if((textlen > 140) && (textlen <= 420)) {
694 $j('#character-counter').removeClass('grey');
695 $j('#character-counter').removeClass('red');
696 $j('#character-counter').addClass('orange');
699 $j('#character-counter').removeClass('grey');
700 $j('#character-counter').removeClass('orange');
701 $j('#character-counter').addClass('red');
703 $j('#character-counter').text(textlen);
706 ed.onInit.add(function(ed) {
707 ed.pasteAsPlainText = true;
708 $j("#profile-jot-text-loading").hide();
709 $j(".jothidden").show();
710 if (typeof cb!="undefined") cb();
717 $j("a#jot-perms-icon").fancybox({
718 'transitionIn' : 'none',
719 'transitionOut' : 'none'
722 if (typeof cb!="undefined") cb();
727 function msgInitEditor() {
728 if(plaintext != 'none') {
731 mode : "specific_textareas",
732 editor_selector: /(profile-jot-text|prvmail-text)/,
733 plugins : "bbcode,paste",
734 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
735 theme_advanced_buttons2 : "",
736 theme_advanced_buttons3 : "",
737 theme_advanced_toolbar_location : "top",
738 theme_advanced_toolbar_align : "center",
739 theme_advanced_blockformats : "blockquote,code",
740 gecko_spellcheck : true,
741 paste_text_sticky : true,
742 entity_encoding : "raw",
743 add_unload_trigger : false,
744 remove_linebreaks : false,
745 force_p_newlines : false,
746 force_br_newlines : true,
747 forced_root_block : '',
749 content_css: baseurl + "/view/custom_tinymce.css",
751 theme_advanced_path : false,
752 setup : function(ed) {
753 ed.onInit.add(function(ed) {
754 ed.pasteAsPlainText = true;
755 var editorId = ed.editorId;
756 var textarea = $j('#'+editorId);
757 if (typeof(textarea.attr('tabindex')) != "undefined") {
758 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
759 textarea.attr('tabindex', null);
766 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
770 function profInitEditor() {
773 mode : window.editSelect,
774 plugins : "bbcode,paste",
775 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
776 theme_advanced_buttons2 : "",
777 theme_advanced_buttons3 : "",
778 theme_advanced_toolbar_location : "top",
779 theme_advanced_toolbar_align : "center",
780 theme_advanced_blockformats : "blockquote,code",
781 gecko_spellcheck : true,
782 paste_text_sticky : true,
783 entity_encoding : "raw",
784 add_unload_trigger : false,
785 remove_linebreaks : false,
786 force_p_newlines : false,
787 force_br_newlines : true,
788 forced_root_block : '',
789 content_css: baseurl + "/view/custom_tinymce.css",
790 theme_advanced_path : false,
791 setup : function(ed) {
792 ed.onInit.add(function(ed) {
793 ed.pasteAsPlainText = true;
800 function eventInitEditor() {
804 plugins : "bbcode,paste",
805 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
806 theme_advanced_buttons2 : "",
807 theme_advanced_buttons3 : "",
808 theme_advanced_toolbar_location : "top",
809 theme_advanced_toolbar_align : "center",
810 theme_advanced_blockformats : "blockquote,code",
811 gecko_spellcheck : true,
812 paste_text_sticky : true,
813 entity_encoding : "raw",
814 add_unload_trigger : false,
815 remove_linebreaks : false,
816 force_p_newlines : false,
817 force_br_newlines : true,
818 forced_root_block : '',
819 content_css: baseurl + "/view/custom_tinymce.css",
820 theme_advanced_path : false,
821 setup : function(ed) {
822 ed.onInit.add(function(ed) {
823 ed.pasteAsPlainText = true;
830 function contactInitEditor () {
833 mode : window.editSelect,
834 elements: "contact-edit-info",
836 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
837 theme_advanced_buttons2 : "",
838 theme_advanced_buttons3 : "",
839 theme_advanced_toolbar_location : "top",
840 theme_advanced_toolbar_align : "center",
841 theme_advanced_styles : "blockquote,code",
842 gecko_spellcheck : true,
843 entity_encoding : "raw",
844 add_unload_trigger : false,
845 remove_linebreaks : false,
846 force_p_newlines : false,
847 force_br_newlines : true,
848 forced_root_block : '',
849 content_css: baseurl + "/view/custom_tinymce.css"
855 function wallInitEditor() {
856 var plaintext = window.editSelect;
858 if(plaintext != 'none') {
861 mode : "specific_textareas",
862 editor_selector: /(profile-jot-text|prvmail-text)/,
863 plugins : "bbcode,paste",
864 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
865 theme_advanced_buttons2 : "",
866 theme_advanced_buttons3 : "",
867 theme_advanced_toolbar_location : "top",
868 theme_advanced_toolbar_align : "center",
869 theme_advanced_blockformats : "blockquote,code",
870 gecko_spellcheck : true,
871 paste_text_sticky : true,
872 entity_encoding : "raw",
873 add_unload_trigger : false,
874 remove_linebreaks : false,
875 force_p_newlines : false,
876 force_br_newlines : true,
877 forced_root_block : '',
879 content_css: baseurl + "/view/custom_tinymce.css",
881 theme_advanced_path : false,
882 setup : function(ed) {
883 ed.onInit.add(function(ed) {
884 ed.pasteAsPlainText = true;
885 var editorId = ed.editorId;
886 var textarea = $j('#'+editorId);
887 if (typeof(textarea.attr('tabindex')) != "undefined") {
888 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
889 textarea.attr('tabindex', null);
896 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
899 function deleteCheckedItems(delID) {
900 if(confirm(window.delItems)) {
904 $j(delID + '-rotator').show();
905 $j('.item-select').each( function() {
906 if($j(this).is(':checked')) {
907 if(checkedstr.length != 0) {
908 checkedstr = checkedstr + ',' + $j(this).val();
911 checkedstr = $j(this).val();
915 $j.post('item', { dropitems: checkedstr }, function(data) {
916 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() {
939 /* if(navigator.geolocation) {
941 navigator.geolocation.getCurrentPosition(function(position) {
942 var lat = position.coords.latitude;
943 var lng = position.coords.longitude;
947 url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
948 jsonp: 'json_callback',
949 contentType: 'application/json',
951 success: function(json) {
953 var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
954 $j('#jot-location').val(locationDisplay);
955 $j('#jot-display-location').html('Location: '+locationDisplay);
956 $j('#jot-display-location').show();
963 reply = prompt(window.whereAreU, $j('#jot-location').val());
964 if(reply && reply.length) {
965 $j('#jot-location').val(reply);
969 reply = prompt(window.whereAreU, $j('#jot-location').val());
970 if(reply && reply.length) {
971 $j('#jot-location').val(reply);
975 function jotShare(id) {
976 if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
978 $j('#like-rotator-' + id).show();
979 $j.get('share/' + id, function(data) {
980 if (!editor) $j("#profile-jot-text").val("");
981 initEditor(function(){
983 $j('#like-rotator-' + id).hide();
984 $j(window).scrollTop(0);
990 function linkdropper(event) {
991 var linkFound = event.dataTransfer.types.contains("text/uri-list");
993 event.preventDefault();
996 function itemTag(id) {
997 reply = prompt(window.term);
998 if(reply && reply.length) {
999 reply = reply.replace('#','');
1003 $j('body').css('cursor', 'wait');
1005 $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
1006 /*if(timer) clearTimeout(timer);
1007 timer = setTimeout(NavUpdate,3000);*/
1013 function itemFiler(id) {
1015 var bordercolor = $j("input").css("border-color");
1017 $j.get('filer/', function(data){
1019 $j("#id_term").keypress(function(){
1020 $j(this).css("border-color",bordercolor);
1022 $j("#select_term").change(function(){
1023 $j("#id_term").css("border-color",bordercolor);
1026 $j("#filer_save").click(function(e){
1028 reply = $j("#id_term").val();
1029 if(reply && reply.length) {
1031 $j('body').css('cursor', 'wait');
1032 $j.get('filer/' + id + '?term=' + reply, NavUpdate);
1033 /* if(timer) clearTimeout(timer);
1034 timer = setTimeout(NavUpdate,3000);*/
1036 $j.fancybox.close();
1038 $j("#id_term").css("border-color","#FF0000");
1046 function jotClearLocation() {
1047 $j('#jot-coord').val('');
1048 $j('#profile-nolocation-wrapper').hide();
1051 function addeditortext(data) {
1052 if(plaintext == 'none') {
1053 var currentText = $j("#profile-jot-text").val();
1054 $j("#profile-jot-text").val(currentText + data);
1057 tinyMCE.execCommand('mceInsertRawHTML',false,data);
1060 if(typeof window.geoTag === 'function') window.geoTag();