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-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 showHideCommentBox(id) {
588 if( $j('#comment-edit-form-' + id).is(':visible')) {
589 $j('#comment-edit-form-' + id).hide();
592 $j('#comment-edit-form-' + id).show();
598 function enableOnUser(){
607 var plaintext = window.editSelect;
608 var ispublic = window.isPublic;
610 function initEditor(cb){
612 $j("#profile-jot-text-loading").show();
613 if(plaintext == 'none') {
614 $j("#profile-jot-text-loading").hide();
615 $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
616 $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
618 $j("a#jot-perms-icon").fancybox({
619 'transitionIn' : 'elastic',
620 'transitionOut' : 'elastic'
622 $j(".jothidden").show();
623 if (typeof cb!="undefined") cb();
628 mode : "specific_textareas",
629 editor_selector: window.editSelect,
630 auto_focus: "profile-jot-text",
631 plugins : "bbcode,paste,autoresize, inlinepopups",
632 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
633 theme_advanced_buttons2 : "",
634 theme_advanced_buttons3 : "",
635 theme_advanced_toolbar_location : "top",
636 theme_advanced_toolbar_align : "center",
637 theme_advanced_blockformats : "blockquote,code",
638 gecko_spellcheck : true,
639 paste_text_sticky : true,
640 entity_encoding : "raw",
641 add_unload_trigger : false,
642 remove_linebreaks : false,
643 force_p_newlines : false,
644 force_br_newlines : true,
645 forced_root_block : '',
647 content_css: window.baseURL + "/view/custom_tinymce.css",
648 theme_advanced_path : false,
649 file_browser_callback : "fcFileBrowser",
650 setup : function(ed) {
652 ed.onKeyDown.add(function(ed,e) {
657 ed.onKeyUp.add(function(ed, e) {
658 var txt = tinyMCE.activeEditor.getContent();
659 match = txt.match(/@([^ \n]+)$/);
661 if(cPopup === null) {
662 cPopup = new ACPopup(this,baseurl+"/acl");
664 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
665 if(! cPopup.ready) cPopup = null;
668 if(cPopup !== null) { cPopup.close(); cPopup = null; }
671 textlen = txt.length;
672 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
673 $j('#profile-jot-desc').html(ispublic);
676 $j('#profile-jot-desc').html(' ');
682 $j('#character-counter').removeClass('red');
683 $j('#character-counter').removeClass('orange');
684 $j('#character-counter').addClass('grey');
686 if((textlen > 140) && (textlen <= 420)) {
687 $j('#character-counter').removeClass('grey');
688 $j('#character-counter').removeClass('red');
689 $j('#character-counter').addClass('orange');
692 $j('#character-counter').removeClass('grey');
693 $j('#character-counter').removeClass('orange');
694 $j('#character-counter').addClass('red');
696 $j('#character-counter').text(textlen);
699 ed.onInit.add(function(ed) {
700 ed.pasteAsPlainText = true;
701 $j("#profile-jot-text-loading").hide();
702 $j(".jothidden").show();
703 if (typeof cb!="undefined") cb();
710 $j("a#jot-perms-icon").fancybox({
711 'transitionIn' : 'none',
712 'transitionOut' : 'none'
715 if (typeof cb!="undefined") cb();
720 function msgInitEditor() {
721 if(plaintext != 'none') {
724 mode : "specific_textareas",
725 editor_selector: /(profile-jot-text|prvmail-text)/,
726 plugins : "bbcode,paste",
727 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
728 theme_advanced_buttons2 : "",
729 theme_advanced_buttons3 : "",
730 theme_advanced_toolbar_location : "top",
731 theme_advanced_toolbar_align : "center",
732 theme_advanced_blockformats : "blockquote,code",
733 gecko_spellcheck : true,
734 paste_text_sticky : true,
735 entity_encoding : "raw",
736 add_unload_trigger : false,
737 remove_linebreaks : false,
738 force_p_newlines : false,
739 force_br_newlines : true,
740 forced_root_block : '',
742 content_css: baseurl + "/view/custom_tinymce.css",
744 theme_advanced_path : false,
745 setup : function(ed) {
746 ed.onInit.add(function(ed) {
747 ed.pasteAsPlainText = true;
748 var editorId = ed.editorId;
749 var textarea = $j('#'+editorId);
750 if (typeof(textarea.attr('tabindex')) != "undefined") {
751 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
752 textarea.attr('tabindex', null);
759 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
763 function profInitEditor() {
766 mode : window.editSelect,
767 plugins : "bbcode,paste",
768 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
769 theme_advanced_buttons2 : "",
770 theme_advanced_buttons3 : "",
771 theme_advanced_toolbar_location : "top",
772 theme_advanced_toolbar_align : "center",
773 theme_advanced_blockformats : "blockquote,code",
774 gecko_spellcheck : true,
775 paste_text_sticky : true,
776 entity_encoding : "raw",
777 add_unload_trigger : false,
778 remove_linebreaks : false,
779 force_p_newlines : false,
780 force_br_newlines : true,
781 forced_root_block : '',
782 content_css: baseurl + "/view/custom_tinymce.css",
783 theme_advanced_path : false,
784 setup : function(ed) {
785 ed.onInit.add(function(ed) {
786 ed.pasteAsPlainText = true;
793 function eventInitEditor() {
797 plugins : "bbcode,paste",
798 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
799 theme_advanced_buttons2 : "",
800 theme_advanced_buttons3 : "",
801 theme_advanced_toolbar_location : "top",
802 theme_advanced_toolbar_align : "center",
803 theme_advanced_blockformats : "blockquote,code",
804 gecko_spellcheck : true,
805 paste_text_sticky : true,
806 entity_encoding : "raw",
807 add_unload_trigger : false,
808 remove_linebreaks : false,
809 force_p_newlines : false,
810 force_br_newlines : true,
811 forced_root_block : '',
812 content_css: baseurl + "/view/custom_tinymce.css",
813 theme_advanced_path : false,
814 setup : function(ed) {
815 ed.onInit.add(function(ed) {
816 ed.pasteAsPlainText = true;
823 function contactInitEditor () {
826 mode : window.editSelect,
827 elements: "contact-edit-info",
829 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
830 theme_advanced_buttons2 : "",
831 theme_advanced_buttons3 : "",
832 theme_advanced_toolbar_location : "top",
833 theme_advanced_toolbar_align : "center",
834 theme_advanced_styles : "blockquote,code",
835 gecko_spellcheck : true,
836 entity_encoding : "raw",
837 add_unload_trigger : false,
838 remove_linebreaks : false,
839 force_p_newlines : false,
840 force_br_newlines : true,
841 forced_root_block : '',
842 content_css: baseurl + "/view/custom_tinymce.css"
848 function wallInitEditor() {
849 var plaintext = window.editSelect;
851 if(plaintext != 'none') {
854 mode : "specific_textareas",
855 editor_selector: /(profile-jot-text|prvmail-text)/,
856 plugins : "bbcode,paste",
857 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor",
858 theme_advanced_buttons2 : "",
859 theme_advanced_buttons3 : "",
860 theme_advanced_toolbar_location : "top",
861 theme_advanced_toolbar_align : "center",
862 theme_advanced_blockformats : "blockquote,code",
863 gecko_spellcheck : true,
864 paste_text_sticky : true,
865 entity_encoding : "raw",
866 add_unload_trigger : false,
867 remove_linebreaks : false,
868 force_p_newlines : false,
869 force_br_newlines : true,
870 forced_root_block : '',
872 content_css: baseurl + "/view/custom_tinymce.css",
874 theme_advanced_path : false,
875 setup : function(ed) {
876 ed.onInit.add(function(ed) {
877 ed.pasteAsPlainText = true;
878 var editorId = ed.editorId;
879 var textarea = $j('#'+editorId);
880 if (typeof(textarea.attr('tabindex')) != "undefined") {
881 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
882 textarea.attr('tabindex', null);
889 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
892 function deleteCheckedItems(delID) {
893 if(confirm(window.delItems)) {
897 $j(delID + '-rotator').show();
898 $j('.item-select').each( function() {
899 if($j(this).is(':checked')) {
900 if(checkedstr.length != 0) {
901 checkedstr = checkedstr + ',' + $j(this).val();
904 checkedstr = $j(this).val();
908 $j.post('item', { dropitems: checkedstr }, function(data) {
909 window.location.reload();
915 function jotVideoURL() {
916 reply = prompt(window.vidURL);
917 if(reply && reply.length) {
918 addeditortext('[video]' + reply + '[/video]');
922 function jotAudioURL() {
923 reply = prompt(window.audURL);
924 if(reply && reply.length) {
925 addeditortext('[audio]' + reply + '[/audio]');
930 function jotGetLocation() {
932 /* if(navigator.geolocation) {
934 navigator.geolocation.getCurrentPosition(function(position) {
935 var lat = position.coords.latitude;
936 var lng = position.coords.longitude;
940 url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
941 jsonp: 'json_callback',
942 contentType: 'application/json',
944 success: function(json) {
946 var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
947 $j('#jot-location').val(locationDisplay);
948 $j('#jot-display-location').html('Location: '+locationDisplay);
949 $j('#jot-display-location').show();
956 reply = prompt(window.whereAreU, $j('#jot-location').val());
957 if(reply && reply.length) {
958 $j('#jot-location').val(reply);
962 reply = prompt(window.whereAreU, $j('#jot-location').val());
963 if(reply && reply.length) {
964 $j('#jot-location').val(reply);
968 function jotShare(id) {
969 if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
971 $j('#like-rotator-' + id).show();
972 $j.get('share/' + id, function(data) {
973 if (!editor) $j("#profile-jot-text").val("");
974 initEditor(function(){
976 $j('#like-rotator-' + id).hide();
977 $j(window).scrollTop(0);
983 function linkdropper(event) {
984 var linkFound = event.dataTransfer.types.contains("text/uri-list");
986 event.preventDefault();
989 function itemTag(id) {
990 reply = prompt(window.term);
991 if(reply && reply.length) {
992 reply = reply.replace('#','');
996 $j('body').css('cursor', 'wait');
998 $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
999 /*if(timer) clearTimeout(timer);
1000 timer = setTimeout(NavUpdate,3000);*/
1006 function itemFiler(id) {
1008 var bordercolor = $j("input").css("border-color");
1010 $j.get('filer/', function(data){
1012 $j("#id_term").keypress(function(){
1013 $j(this).css("border-color",bordercolor);
1015 $j("#select_term").change(function(){
1016 $j("#id_term").css("border-color",bordercolor);
1019 $j("#filer_save").click(function(e){
1021 reply = $j("#id_term").val();
1022 if(reply && reply.length) {
1024 $j('body').css('cursor', 'wait');
1025 $j.get('filer/' + id + '?term=' + reply, NavUpdate);
1026 /* if(timer) clearTimeout(timer);
1027 timer = setTimeout(NavUpdate,3000);*/
1029 $j.fancybox.close();
1031 $j("#id_term").css("border-color","#FF0000");
1039 function jotClearLocation() {
1040 $j('#jot-coord').val('');
1041 $j('#profile-nolocation-wrapper').hide();
1044 function addeditortext(data) {
1045 if(plaintext == 'none') {
1046 var currentText = $j("#profile-jot-text").val();
1047 $j("#profile-jot-text").val(currentText + data);
1050 tinyMCE.execCommand('mceInsertRawHTML',false,data);
1053 if(typeof window.geoTag === 'function') window.geoTag();