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 /* enable tinymce on focus and click */
21 $j("#profile-jot-text").focus(enableOnUser);
22 $j("#profile-jot-text").click(enableOnUser);
24 $j('.nav-menu-list, .nav-menu-icon').hover(function() {
25 showNavMenu($j(this).attr('point'));
27 hideNavMenu($j(this).attr('point'));
30 /* $j('html').click(function() { $j("#nav-notifications-menu" ).hide(); });*/
32 $j('.group-edit-icon').hover(
34 $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
36 $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
39 $j('.sidebar-group-element').hover(
41 id = $j(this).attr('id');
42 $j('#edit-' + id).addClass('icon'); $j('#edit-' + id).removeClass('iconspacer');},
45 id = $j(this).attr('id');
46 $j('#edit-' + id).removeClass('icon');$j('#edit-' + id).addClass('iconspacer');}
50 $j('.savedsearchdrop').hover(
52 $j(this).addClass('drop'); $j(this).addClass('icon'); $j(this).removeClass('iconspacer');},
54 $j(this).removeClass('drop'); $j(this).removeClass('icon'); $j(this).addClass('iconspacer');}
57 $j('.savedsearchterm').hover(
59 id = $j(this).attr('id');
60 $j('#drop-' + id).addClass('icon'); $j('#drop-' + id).addClass('drophide'); $j('#drop-' + id).removeClass('iconspacer');},
63 id = $j(this).attr('id');
64 $j('#drop-' + id).removeClass('icon');$j('#drop-' + id).removeClass('drophide'); $j('#drop-' + id).addClass('iconspacer');}
67 /* $j('.nav-load-page-link').click(function() {
68 getPageContent( $j(this).attr('href') );
69 hideNavMenu( '#' + $j(this).closest('ul').attr('id') );
73 $j('#event-share-checkbox').change(function() {
75 if ($j('#event-share-checkbox').is(':checked')) {
76 $j('#acl-wrapper').show();
79 $j('#acl-wrapper').hide();
84 /* $j('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
86 $j('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
87 selstr = $j(this).text();
88 $j('#jot-public').hide();
91 $j('#jot-public').show();
94 }).trigger('change');*/
97 if(typeof window.AjaxUpload != "undefined") {
98 var uploader = new window.AjaxUpload(
99 window.imageUploadButton,
100 { action: 'wall_upload/'+window.nickname,
102 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
103 onComplete: function(file,response) {
104 addeditortext(window.jotId, response);
105 $j('#profile-rotator').hide();
110 if($j('#wall-file-upload').length) {
111 var file_uploader = new window.AjaxUpload(
113 { action: 'wall_attach/'+window.nickname,
115 onSubmit: function(file,ext) { $j('#profile-rotator').show(); },
116 onComplete: function(file,response) {
117 addeditortext(window.jotId, response);
118 $j('#profile-rotator').hide();
126 if(typeof window.aclInit !="undefined" && typeof acl=="undefined"){
129 [ window.allowCID,window.allowGID,window.denyCID,window.denyGID ]
134 if(window.aclType == "settings-head" || window.aclType == "photos_head" || window.aclType == "event_head") {
135 $j('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
137 $j('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
138 selstr = $j(this).text();
139 $j('#jot-perms-icon').removeClass('unlock').addClass('lock');
140 $j('#jot-public').hide();
143 $j('#jot-perms-icon').removeClass('lock').addClass('unlock');
144 $j('#jot-public').show();
147 }).trigger('change');
150 if(window.aclType == "event_head") {
151 $j('#events-calendar').fullCalendar({
152 events: baseurl + '/events/json/',
154 left: 'prev,next today',
156 right: 'month,agendaWeek,agendaDay'
158 timeFormat: 'H(:mm)',
159 eventClick: function(calEvent, jsEvent, view) {
160 showEvent(calEvent.id);
163 eventRender: function(event, element, view) {
164 //console.log(view.name);
165 if (event.item['author-name']==null) return;
168 element.find(".fc-event-title").html(
169 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
170 event.item['author-avatar'],
171 event.item['author-name'],
176 element.find(".fc-event-title").html(
177 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
178 event.item['author-avatar'],
179 event.item['author-name'],
185 element.find(".fc-event-title").html(
186 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
187 event.item['author-avatar'],
188 event.item['author-name'],
199 var args=location.href.replace(baseurl,"").split("/");
200 if (args.length>=4) {
201 $j("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
205 var hash = location.hash.split("-")
206 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
210 switch(window.autocompleteType) {
212 var a = $j("#recip").autocomplete({
213 serviceUrl: baseurl + '/acl',
216 onSelect: function(value,data) {
217 $j("#recip-complete").val(data);
221 case 'contacts-head':
222 var a = $j("#contacts-search").autocomplete({
223 serviceUrl: baseurl + '/acl',
227 a.setOptions({ params: { type: 'a' }});
230 $j(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
236 /* if(window.autoCompleteType == "display-head") {
237 //$j(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
238 // make auto-complete work in more places
239 //$j(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
240 $j(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
243 // Add Colorbox for viewing Network page images
244 //var cBoxClasses = new Array();
245 $j(".wall-item-body a img").each(function(){
246 var aElem = $j(this).parent();
247 var imgHref = aElem.attr("href");
249 // We need to make sure we only put a Colorbox on links to Friendica images
250 // We'll try to do this by looking for links of the form
251 // .../photo/ab803d8eg08daf85023adfec08 (with nothing more following), in hopes
252 // that that will be unique enough
253 if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
255 // Add a unique class to all the images of a certain post, to allow scrolling through
256 var cBoxClass = $j(this).closest(".wall-item-body").attr("id") + "-lightbox";
257 $j(this).addClass(cBoxClass);
259 // if( $j.inArray(cBoxClass, cBoxClasses) < 0 ) {
260 // cBoxClasses.push(cBoxClass);
265 photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo
266 rel: cBoxClass //$j(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0]
270 /*$j.each(cBoxClasses, function(){
271 $j('.'+this).colorbox({
281 // update pending count //
284 $j("nav").bind('nav-update', function(e,data){
285 var elm = $j('#pending-update');
286 var register = $j(data).find('register').text();
287 if (register=="0") { register=""; elm.hide();} else { elm.show(); }
295 $j("#cnftheme").click(function(){
299 href: baseurl + "/admin/themes/" + $("#id_theme :selected").val(),
300 onComplete: function(){
301 $j("div#fancybox-content form").submit(function(e){
302 var url = $j(this).attr('action');
303 // can't get .serialize() to work...
305 $j(this).find("input").each(function(){
306 data[$j(this).attr('name')] = $j(this).val();
308 $j(this).find("select").each(function(){
309 data[$j(this).attr('name')] = $j(this).children(":selected").val();
311 console.log(":)", url, data);
313 $j.post(url, data, function(data) {
314 if(timer) clearTimeout(timer);
329 function homeRedirect() {
330 $j('html').fadeOut('slow', function(){
331 window.location = baseurl + "/login";
336 if(typeof window.photoEdit != 'undefined') {
338 $j(document).keydown(function(event) {
340 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
341 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
346 function showEvent(eventid) {
348 baseurl + '/events/?id='+eventid,
350 $j.colorbox({html:data});
351 $j.colorbox.resize();
356 function initCrop() {
357 function onEndCrop( coords, dimensions ) {
358 $( 'x1' ).value = coords.x1;
359 $( 'y1' ).value = coords.y1;
360 $( 'x2' ).value = coords.x2;
361 $( 'y2' ).value = coords.y2;
362 $( 'width' ).value = dimensions.width;
363 $( 'height' ).value = dimensions.height;
366 Event.observe( window, 'load', function() {
367 new Cropper.ImgWithPreview(
370 previewWrap: 'previewWrap',
375 ratioDim: { x: 100, y:100 },
384 $j(document).mouseup(function (clickPos) {
386 var sysMenu = $j("#system-menu-list");
387 var sysMenuLink = $j(".system-menu-link");
388 var contactsMenu = $j("#contacts-menu-list");
389 var contactsMenuLink = $j(".contacts-menu-link");
390 var networkMenu = $j("#network-menu-list");
391 var networkMenuLink = $j(".network-menu-link");
393 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
394 hideNavMenu("#system-menu-list");
396 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
397 hideNavMenu("#contacts-menu-list");
399 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
400 hideNavMenu("#network-menu-list");
405 function getPageContent(url) {
407 var pos = $j('.main-container').position();
409 $j('.main-container').css('margin-left', pos.left);
410 $j('.main-content-container').hide(0, function () {
411 $j('.main-content-loading').show(0);
414 $j.get(url, function(html) {
415 console.log($j('.main-content-container').html());
416 $j('.main-content-container').html( $j('.main-content-container', html).html() );
417 console.log($j('.main-content-container').html());
418 $j('.main-content-loading').hide(function() {
419 $j('.main-content-container').fadeIn(800,function() {
420 $j('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
427 function showNavMenu(menuID) {
429 if(window.navMenuTimeout[menuID + '-closing']) {
430 window.navMenuTimeout[menuID + '-closing'] = false;
431 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
434 window.navMenuTimeout[menuID + '-opening'] = true;
436 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
437 $j(menuID).slideDown('fast').show();
438 window.navMenuTimeout[menuID + '-opening'] = false;
443 function hideNavMenu(menuID) {
445 if(window.navMenuTimeout[menuID + '-opening']) {
446 window.navMenuTimeout[menuID + '-opening'] = false;
447 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
450 window.navMenuTimeout[menuID + '-closing'] = true;
452 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
453 $j(menuID).slideUp('fast');
454 window.navMenuTimeout[menuID + '-closing'] = false;
465 function InitMCEEditor(editorData) {
466 var tinyMCEInitConfig = {
469 //editor_selector: // SPECIFIC
470 //elements: // SPECIFIC
471 plugins : "bbcode,paste,autoresize,inlinepopups",
472 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
473 theme_advanced_buttons2 : "",
474 theme_advanced_buttons3 : "",
475 theme_advanced_toolbar_location : "top",
476 theme_advanced_toolbar_align : "center",
477 theme_advanced_blockformats : "blockquote,code",
478 gecko_spellcheck : true,
479 paste_text_sticky : true, // COUPLED WITH paste PLUGIN
480 entity_encoding : "raw",
481 add_unload_trigger : false,
482 remove_linebreaks : false,
483 //force_p_newlines : false,
484 //force_br_newlines : true,
485 forced_root_block : 'div',
486 //convert_urls: false, //SPECIFIC?
487 content_css: baseurl + "/view/custom_tinymce.css",
488 theme_advanced_path : false,
489 file_browser_callback : "fcFileBrowser",
490 //setup : // SPECIFIC
493 if(window.editSelect != 'none') {
494 $j.extend(tinyMCEInitConfig, editorData);
495 tinyMCE.init(tinyMCEInitConfig);
497 else if(typeof editorData.plaintextFn == 'function') {
498 (editorData.plaintextFn)();
505 function initEditor(cb){
508 $j("#profile-jot-text-loading").show();
511 mode : "specific_textareas",
512 editor_selector : "profile-jot-text",
513 auto_focus : "profile-jot-text",
514 //plugins : "bbcode,paste,autoresize,inlinepopups",
515 //paste_text_sticky : true,
516 convert_urls : false,
517 setup : function(ed) {
519 ed.onKeyDown.add(function(ed,e) {
524 ed.onKeyUp.add(function(ed, e) {
525 var txt = tinyMCE.activeEditor.getContent();
526 match = txt.match(/@([^ \n]+)$/);
528 if(cPopup === null) {
529 cPopup = new ACPopup(this,baseurl+"/acl");
531 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
532 if(! cPopup.ready) cPopup = null;
535 if(cPopup !== null) { cPopup.close(); cPopup = null; }
538 textlen = txt.length;
539 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
540 $j('#profile-jot-desc').html(window.isPublic);
543 $j('#profile-jot-desc').html(' ');
549 $j('#character-counter').removeClass('red');
550 $j('#character-counter').removeClass('orange');
551 $j('#character-counter').addClass('grey');
553 if((textlen > 140) && (textlen <= 420)) {
554 $j('#character-counter').removeClass('grey');
555 $j('#character-counter').removeClass('red');
556 $j('#character-counter').addClass('orange');
559 $j('#character-counter').removeClass('grey');
560 $j('#character-counter').removeClass('orange');
561 $j('#character-counter').addClass('red');
563 $j('#character-counter').text(textlen);
566 ed.onInit.add(function(ed) {
567 ed.pasteAsPlainText = true;
568 $j("#profile-jot-text-loading").hide();
569 $j(".jothidden").show();
570 if (typeof cb!="undefined") cb();
574 plaintextFn : function() {
575 $j("#profile-jot-text-loading").hide();
576 $j("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
577 $j("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
578 $j(".jothidden").show();
579 if (typeof cb!="undefined") cb();
582 InitMCEEditor(editorData);
585 $j("a#jot-perms-icon").colorbox({
587 'transition' : 'elastic'
590 if (typeof cb!="undefined") cb();
594 function enableOnUser(){
601 function msgInitEditor() {
603 mode : "specific_textareas",
604 editor_selector : "prvmail-text",
605 //plugins : "bbcode,paste",
606 //paste_text_sticky : true,
607 convert_urls : false,
608 //theme_advanced_path : false,
609 setup : function(ed) {
611 ed.onKeyDown.add(function(ed,e) {
616 ed.onKeyUp.add(function(ed, e) {
617 var txt = tinyMCE.activeEditor.getContent();
618 match = txt.match(/@([^ \n]+)$/);
620 if(cPopup === null) {
621 cPopup = new ACPopup(this,baseurl+"/acl");
623 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
624 if(! cPopup.ready) cPopup = null;
627 if(cPopup !== null) { cPopup.close(); cPopup = null; }
630 textlen = txt.length;
631 if(textlen != 0 && $j('#jot-perms-icon').is('.unlock')) {
632 $j('#profile-jot-desc').html(window.isPublic);
635 $j('#profile-jot-desc').html(' ');
639 ed.onInit.add(function(ed) {
640 ed.pasteAsPlainText = true;
641 var editorId = ed.editorId;
642 var textarea = $j('#'+editorId);
643 if (typeof(textarea.attr('tabindex')) != "undefined") {
644 $j('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
645 textarea.attr('tabindex', null);
649 plaintextFn : function() {
650 $j("#prvmail-text").contact_autocomplete(baseurl+"/acl");
653 InitMCEEditor(editorData);
657 function contactInitEditor() {
660 elements : "contact-edit-info",
663 InitMCEEditor(editorData);
667 function eventInitEditor() {
670 //plugins : "bbcode,paste",
671 //paste_text_sticky : true,
672 //theme_advanced_path : false,
673 setup : function(ed) {
674 ed.onInit.add(function(ed) {
675 ed.pasteAsPlainText = true;
679 InitMCEEditor(editorData);
683 function profInitEditor() {
686 //plugins : "bbcode,paste",
687 //paste_text_sticky : true,
688 //theme_advanced_path : false,
689 setup : function(ed) {
690 ed.onInit.add(function(ed) {
691 ed.pasteAsPlainText = true;
695 InitMCEEditor(editorData);
703 function addeditortext(textElem, data) {
704 if(window.editSelect == 'none') {
705 var currentText = $j(textElem).val();
706 $j(textElem).val(currentText + data);
709 tinyMCE.execCommand('mceInsertRawHTML',false,data);
712 function jotVideoURL() {
713 reply = prompt(window.vidURL);
714 if(reply && reply.length) {
715 addeditortext("#profile-jot-text", '[video]' + reply + '[/video]');
719 function jotAudioURL() {
720 reply = prompt(window.audURL);
721 if(reply && reply.length) {
722 addeditortext("#profile-jot-text", '[audio]' + reply + '[/audio]');
727 function jotGetLocation() {
729 /* if(navigator.geolocation) {
731 navigator.geolocation.getCurrentPosition(function(position) {
732 var lat = position.coords.latitude;
733 var lng = position.coords.longitude;
737 url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
738 jsonp: 'json_callback',
739 contentType: 'application/json',
741 success: function(json) {
743 var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
744 $j('#jot-location').val(locationDisplay);
745 $j('#jot-display-location').html('Location: '+locationDisplay);
746 $j('#jot-display-location').show();
753 reply = prompt(window.whereAreU, $j('#jot-location').val());
754 if(reply && reply.length) {
755 $j('#jot-location').val(reply);
759 reply = prompt(window.whereAreU, $j('#jot-location').val());
760 if(reply && reply.length) {
761 $j('#jot-location').val(reply);
765 function jotShare(id) {
766 if ($j('#jot-popup').length != 0) $j('#jot-popup').show();
768 $j('#like-rotator-' + id).show();
769 $j.get('share/' + id, function(data) {
770 if (!editor) $j("#profile-jot-text").val("");
771 initEditor(function(){
772 addeditortext("#profile-jot-text", data);
773 $j('#like-rotator-' + id).hide();
774 $j(window).scrollTop(0);
780 function jotClearLocation() {
781 $j('#jot-coord').val('');
782 $j('#profile-nolocation-wrapper').hide();
786 function jotGetLink() {
787 reply = prompt(window.linkURL);
788 if(reply && reply.length) {
789 reply = bin2hex(reply);
790 $j('#profile-rotator').show();
791 $j.get('parse_url?binurl=' + reply, function(data) {
792 addeditortext(window.jotId, data);
793 $j('#profile-rotator').hide();
799 function linkdropper(event) {
800 var linkFound = event.dataTransfer.types.contains("text/uri-list");
802 event.preventDefault();
806 function linkdrop(event) {
807 var reply = event.dataTransfer.getData("text/uri-list");
808 //event.target.textContent = reply;
809 event.preventDefault();
810 if(reply && reply.length) {
811 reply = bin2hex(reply);
812 $j('#profile-rotator').show();
813 $j.get('parse_url?binurl=' + reply, function(data) {
814 /* if(window.jotId == "#profile-jot-text") {
815 if (!editor) $j("#profile-jot-text").val("");
816 initEditor(function(){
817 addeditortext(window.jotId, data);
818 $j('#profile-rotator').hide();
822 addeditortext(window.jotId, data);
823 $j('#profile-rotator').hide();
830 if(typeof window.geoTag === 'function') window.geoTag();
837 function confirmDelete() { return confirm(window.delItem); }
839 function deleteCheckedItems(delID) {
840 if(confirm(window.delItems)) {
844 $j(delID + '-rotator').show();
845 $j('.item-select').each( function() {
846 if($j(this).is(':checked')) {
847 if(checkedstr.length != 0) {
848 checkedstr = checkedstr + ',' + $j(this).val();
851 checkedstr = $j(this).val();
855 $j.post('item', { dropitems: checkedstr }, function(data) {
856 window.location.reload();
861 function itemTag(id) {
862 reply = prompt(window.term);
863 if(reply && reply.length) {
864 reply = reply.replace('#','');
868 $j('body').css('cursor', 'wait');
870 $j.get('tagger/' + id + '?term=' + reply, NavUpdate);
871 /*if(timer) clearTimeout(timer);
872 timer = setTimeout(NavUpdate,3000);*/
878 function itemFiler(id) {
880 var bordercolor = $j("input").css("border-color");
882 $j.get('filer/', function(data){
883 $j.colorbox({html:data});
884 $j.colorbox.resize();
885 $j("#id_term").keypress(function(){
886 $j(this).css("border-color",bordercolor);
888 $j("#select_term").change(function(){
889 $j("#id_term").css("border-color",bordercolor);
892 $j("#filer_save").click(function(e){
894 reply = $j("#id_term").val();
895 if(reply && reply.length) {
897 $j('body').css('cursor', 'wait');
898 $j.get('filer/' + id + '?term=' + reply, NavUpdate);
899 /* if(timer) clearTimeout(timer);
900 timer = setTimeout(NavUpdate,3000);*/
904 $j("#id_term").css("border-color","#FF0000");
917 function insertFormatting(comment,BBcode,id) {
919 var tmpStr = $j("#comment-edit-text-" + id).val();
920 if(tmpStr == comment) {
922 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
923 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
924 openMenu("comment-edit-submit-wrapper-" + id);
925 $j("#comment-edit-text-" + id).val(tmpStr);
928 textarea = document.getElementById("comment-edit-text-" +id);
929 if (document.selection) {
931 selected = document.selection.createRange();
932 if (BBcode == "url"){
933 selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
935 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
936 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
937 var start = textarea.selectionStart;
938 var end = textarea.selectionEnd;
939 if (BBcode == "url"){
940 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
942 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
947 function cmtBbOpen(id) {
948 $j("#comment-edit-bb-" + id).show();
950 function cmtBbClose(id) {
951 $j("#comment-edit-bb-" + id).hide();
954 function commentOpen(obj,id) {
955 if(obj.value == window.commentEmptyText) {
957 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
958 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
959 $j("#mod-cmnt-wrap-" + id).show();
960 openMenu("comment-edit-submit-wrapper-" + id);
963 function commentClose(obj,id) {
964 if(obj.value == "") {
965 obj.value = window.commentEmptyText;
966 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
967 $j("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
968 $j("#mod-cmnt-wrap-" + id).hide();
969 closeMenu("comment-edit-submit-wrapper-" + id);
974 function commentInsert(obj,id) {
975 var tmpStr = $j("#comment-edit-text-" + id).val();
976 if(tmpStr == window.commentEmptyText) {
978 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
979 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
980 openMenu("comment-edit-submit-wrapper-" + id);
982 var ins = $j(obj).html();
983 ins = ins.replace("<","<");
984 ins = ins.replace(">",">");
985 ins = ins.replace("&","&");
986 ins = ins.replace(""",'"');
987 $j("#comment-edit-text-" + id).val(tmpStr + ins);
990 function qCommentInsert(obj,id) {
991 var tmpStr = $j("#comment-edit-text-" + id).val();
992 if(tmpStr == window.commentEmptyText) {
994 $j("#comment-edit-text-" + id).addClass("comment-edit-text-full");
995 $j("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
996 openMenu("comment-edit-submit-wrapper-" + id);
998 var ins = $j(obj).val();
999 ins = ins.replace("<","<");
1000 ins = ins.replace(">",">");
1001 ins = ins.replace("&","&");
1002 ins = ins.replace(""",'"');
1003 $j("#comment-edit-text-" + id).val(tmpStr + ins);
1007 /*function showHideCommentBox(id) {
1008 if( $j('#comment-edit-form-' + id).is(':visible')) {
1009 $j('#comment-edit-form-' + id).hide();
1012 $j('#comment-edit-form-' + id).show();