1 $(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 $("#profile-jot-text").focus(enableOnUser);
22 $("#profile-jot-text").click(enableOnUser);
24 $('.nav-menu-list, .nav-menu-icon').hover(function() {
25 showNavMenu($(this).attr('point'));
27 hideNavMenu($(this).attr('point'));
30 /* $('html').click(function() { $("#nav-notifications-menu" ).hide(); });*/
32 $('.group-edit-icon').hover(
34 $(this).addClass('icon'); $(this).removeClass('iconspacer');},
36 $(this).removeClass('icon'); $(this).addClass('iconspacer');}
39 $('.sidebar-group-element').hover(
41 id = $(this).attr('id');
42 $('#edit-' + id).addClass('icon'); $('#edit-' + id).removeClass('iconspacer');},
45 id = $(this).attr('id');
46 $('#edit-' + id).removeClass('icon');$('#edit-' + id).addClass('iconspacer');}
50 $('.savedsearchdrop').hover(
52 $(this).addClass('drop'); $(this).addClass('icon'); $(this).removeClass('iconspacer');},
54 $(this).removeClass('drop'); $(this).removeClass('icon'); $(this).addClass('iconspacer');}
57 $('.savedsearchterm').hover(
59 id = $(this).attr('id');
60 $('#drop-' + id).addClass('icon'); $('#drop-' + id).addClass('drophide'); $('#drop-' + id).removeClass('iconspacer');},
63 id = $(this).attr('id');
64 $('#drop-' + id).removeClass('icon');$('#drop-' + id).removeClass('drophide'); $('#drop-' + id).addClass('iconspacer');}
67 /* $('.nav-load-page-link').click(function() {
68 getPageContent( $(this).attr('href') );
69 hideNavMenu( '#' + $(this).closest('ul').attr('id') );
73 $('#id_share').change(function() {
75 if ($('#id_share').is(':checked')) {
76 $('#acl-wrapper').show();
79 $('#acl-wrapper').hide();
84 /* $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
86 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
87 selstr = $(this).text();
88 $('#jot-public').hide();
91 $('#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) { $('#profile-rotator').show(); },
103 onComplete: function(file,response) {
104 addeditortext(window.jotId, response);
105 $('#profile-rotator').hide();
110 if($('#wall-file-upload').length) {
111 var file_uploader = new window.AjaxUpload(
113 { action: 'wall_attach/'+window.nickname,
115 onSubmit: function(file,ext) { $('#profile-rotator').show(); },
116 onComplete: function(file,response) {
117 addeditortext(window.jotId, response);
118 $('#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 $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
137 $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
138 selstr = $(this).text();
139 $('#jot-perms-icon').removeClass('unlock').addClass('lock');
140 $('#jot-public').hide();
143 $('#jot-perms-icon').removeClass('lock').addClass('unlock');
144 $('#jot-public').show();
147 }).trigger('change');
150 if(window.aclType == "event_head") {
151 $('#events-calendar').fullCalendar({
152 events: baseurl + window.eventModuleUrl +'/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);
162 loading: function(isLoading, view) {
164 $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
168 eventRender: function(event, element, view) {
169 //console.log(view.name);
170 if (event.item['author-name']==null) return;
173 element.find(".fc-event-title").html(
174 "<img src='{0}' style='height:10px;width:10px'>{1} : {2}".format(
175 event.item['author-avatar'],
176 event.item['author-name'],
181 element.find(".fc-event-title").html(
182 "<img src='{0}' style='height:12px; width:12px'>{1}<p>{2}</p><p>{3}</p>".format(
183 event.item['author-avatar'],
184 event.item['author-name'],
190 element.find(".fc-event-title").html(
191 "<img src='{0}' style='height:24px;width:24px'>{1}<p>{2}</p><p>{3}</p>".format(
192 event.item['author-avatar'],
193 event.item['author-name'],
204 var args=location.href.replace(baseurl,"").split("/");
205 if (args.length>=5 && window.eventModeParams == 2) {
206 $("#events-calendar").fullCalendar('gotoDate',args[3] , args[4]-1);
207 } else if (args.length>=4 && window.eventModeParams == 1) {
208 $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
212 var hash = location.hash.split("-")
213 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
217 switch(window.autocompleteType) {
219 $("#recip").name_autocomplete(baseurl + '/acl', '', false, function(data) {
220 $("#recip-complete").val(data.id);
223 case 'contacts-head':
224 $("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
227 $("#contacts-search").keyup(function(event){
228 if(event.keyCode == 13){
229 $("#contacts-search").click();
232 $(".autocomplete-w1 .selected").keyup(function(event){
233 if(event.keyCode == 13){
234 $("#contacts-search").click();
239 $(".comment-wwedit-wrapper textarea").editor_autocomplete(baseurl+"/acl");
245 /* if(window.autoCompleteType == "display-head") {
246 //$(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
247 // make auto-complete work in more places
248 //$(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
249 $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
252 // Add Colorbox for viewing Network page images
253 //var cBoxClasses = new Array();
254 $(".wall-item-body a img").each(function(){
255 var aElem = $(this).parent();
256 var imgHref = aElem.attr("href");
258 // We need to make sure we only put a Colorbox on links to Friendica images
259 // We'll try to do this by looking for links of the form
260 // .../photo/ab803d8eg08daf85023adfec08 (with nothing more following), in hopes
261 // that that will be unique enough
262 if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
264 // Add a unique class to all the images of a certain post, to allow scrolling through
265 var cBoxClass = $(this).closest(".wall-item-body").attr("id") + "-lightbox";
266 $(this).addClass(cBoxClass);
268 // if( $.inArray(cBoxClass, cBoxClasses) < 0 ) {
269 // cBoxClasses.push(cBoxClass);
274 photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo
275 rel: cBoxClass //$(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0]
279 /*$.each(cBoxClasses, function(){
280 $('.'+this).colorbox({
290 // update pending count //
293 $("nav").bind('nav-update', function(e,data){
294 var elm = $('#pending-update');
295 var register = $(data).find('register').text();
296 if (register=="0") { register=""; elm.hide();} else { elm.show(); }
304 $("#cnftheme").click(function(){
308 href: baseurl + "/admin/themes/" + $("#id_theme :selected").val(),
309 onComplete: function(){
310 $("div#fancybox-content form").submit(function(e){
311 var url = $(this).attr('action');
312 // can't get .serialize() to work...
314 $(this).find("input").each(function(){
315 data[$(this).attr('name')] = $(this).val();
317 $(this).find("select").each(function(){
318 data[$(this).attr('name')] = $(this).children(":selected").val();
320 console.log(":)", url, data);
322 $.post(url, data, function(data) {
323 if(timer) clearTimeout(timer);
338 function homeRedirect() {
339 $('html').fadeOut('slow', function(){
340 window.location = baseurl + "/login";
345 if(typeof window.photoEdit != 'undefined') {
347 $(document).keydown(function(event) {
349 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
350 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
355 function showEvent(eventid) {
357 baseurl + window.eventModuleUrl + '/?id=' + eventid,
359 $.colorbox({html:data});
365 function doEventPreview() {
366 $('#event-edit-preview').val(1);
367 $.post('events',$('#event-edit-form').serialize(), function(data) {
368 $.colorbox({ html: data });
370 $('#event-edit-preview').val(0);
373 function initCrop() {
374 function onEndCrop( coords, dimensions ) {
375 $PR( 'x1' ).value = coords.x1;
376 $PR( 'y1' ).value = coords.y1;
377 $PR( 'x2' ).value = coords.x2;
378 $PR( 'y2' ).value = coords.y2;
379 $PR( 'width' ).value = dimensions.width;
380 $PR( 'height' ).value = dimensions.height;
383 Event.observe( window, 'load', function() {
384 new Cropper.ImgWithPreview(
387 previewWrap: 'previewWrap',
392 ratioDim: { x: 100, y:100 },
401 $(document).mouseup(function (clickPos) {
403 var sysMenu = $("#system-menu-list");
404 var sysMenuLink = $(".system-menu-link");
405 var contactsMenu = $("#contacts-menu-list");
406 var contactsMenuLink = $(".contacts-menu-link");
407 var networkMenu = $("#network-menu-list");
408 var networkMenuLink = $(".network-menu-link");
410 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
411 hideNavMenu("#system-menu-list");
413 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
414 hideNavMenu("#contacts-menu-list");
416 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
417 hideNavMenu("#network-menu-list");
422 function getPageContent(url) {
424 var pos = $('.main-container').position();
426 $('.main-container').css('margin-left', pos.left);
427 $('.main-content-container').hide(0, function () {
428 $('.main-content-loading').show(0);
431 $.get(url, function(html) {
432 console.log($('.main-content-container').html());
433 $('.main-content-container').html( $('.main-content-container', html).html() );
434 console.log($('.main-content-container').html());
435 $('.main-content-loading').hide(function() {
436 $('.main-content-container').fadeIn(800,function() {
437 $('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
444 function showNavMenu(menuID) {
446 if(window.navMenuTimeout[menuID + '-closing']) {
447 window.navMenuTimeout[menuID + '-closing'] = false;
448 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
451 window.navMenuTimeout[menuID + '-opening'] = true;
453 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
454 $(menuID).slideDown('fast').show();
455 window.navMenuTimeout[menuID + '-opening'] = false;
460 function hideNavMenu(menuID) {
462 if(window.navMenuTimeout[menuID + '-opening']) {
463 window.navMenuTimeout[menuID + '-opening'] = false;
464 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
467 window.navMenuTimeout[menuID + '-closing'] = true;
469 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
470 $(menuID).slideUp('fast');
471 window.navMenuTimeout[menuID + '-closing'] = false;
482 function InitMCEEditor(editorData) {
483 var tinyMCEInitConfig = {
486 //editor_selector: // SPECIFIC
487 //elements: // SPECIFIC
488 plugins : "bbcode,paste,autoresize,inlinepopups",
489 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
490 theme_advanced_buttons2 : "",
491 theme_advanced_buttons3 : "",
492 theme_advanced_toolbar_location : "top",
493 theme_advanced_toolbar_align : "center",
494 theme_advanced_blockformats : "blockquote,code",
495 gecko_spellcheck : true,
496 paste_text_sticky : true, // COUPLED WITH paste PLUGIN
497 entity_encoding : "raw",
498 add_unload_trigger : false,
499 remove_linebreaks : false,
500 //force_p_newlines : false,
501 //force_br_newlines : true,
502 forced_root_block : 'div',
503 //convert_urls: false, //SPECIFIC?
504 content_css: baseurl + "/view/custom_tinymce.css",
505 theme_advanced_path : false,
506 file_browser_callback : "fcFileBrowser",
507 //setup : // SPECIFIC
510 if(window.editSelect != 'none') {
511 $.extend(tinyMCEInitConfig, editorData);
512 tinyMCE.init(tinyMCEInitConfig);
514 else if(typeof editorData.plaintextFn == 'function') {
515 (editorData.plaintextFn)();
522 function initEditor(cb){
525 $("#profile-jot-text-loading").show();
528 mode : "specific_textareas",
529 editor_selector : "profile-jot-text",
530 auto_focus : "profile-jot-text",
531 //plugins : "bbcode,paste,autoresize,inlinepopups",
532 //paste_text_sticky : true,
533 convert_urls : false,
534 setup : function(ed) {
536 ed.onKeyDown.add(function(ed,e) {
541 ed.onKeyUp.add(function(ed, e) {
542 var txt = tinyMCE.activeEditor.getContent();
543 match = txt.match(/@([^ \n]+)$/);
545 if(cPopup === null) {
546 cPopup = new ACPopup(this,baseurl+"/acl");
548 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
549 if(! cPopup.ready) cPopup = null;
552 if(cPopup !== null) { cPopup.close(); cPopup = null; }
555 textlen = txt.length;
556 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
557 $('#profile-jot-desc').html(window.isPublic);
560 $('#profile-jot-desc').html(' ');
566 $('#character-counter').removeClass('red');
567 $('#character-counter').removeClass('orange');
568 $('#character-counter').addClass('grey');
570 if((textlen > 140) && (textlen <= 420)) {
571 $('#character-counter').removeClass('grey');
572 $('#character-counter').removeClass('red');
573 $('#character-counter').addClass('orange');
576 $('#character-counter').removeClass('grey');
577 $('#character-counter').removeClass('orange');
578 $('#character-counter').addClass('red');
580 $('#character-counter').text(textlen);
583 ed.onInit.add(function(ed) {
584 ed.pasteAsPlainText = true;
585 $("#profile-jot-text-loading").hide();
586 $(".jothidden").show();
587 if (typeof cb!="undefined") cb();
591 plaintextFn : function() {
592 $("#profile-jot-text-loading").hide();
593 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
594 $("#profile-jot-text").editor_autocomplete(baseurl+"/acl");
595 $(".jothidden").show();
596 if (typeof cb!="undefined") cb();
599 InitMCEEditor(editorData);
602 $("a#jot-perms-icon").colorbox({
604 'transition' : 'elastic'
607 if (typeof cb!="undefined") cb();
611 function enableOnUser(){
618 function msgInitEditor() {
620 mode : "specific_textareas",
621 editor_selector : "prvmail-text",
622 //plugins : "bbcode,paste",
623 //paste_text_sticky : true,
624 convert_urls : false,
625 //theme_advanced_path : false,
626 setup : function(ed) {
628 ed.onKeyDown.add(function(ed,e) {
633 ed.onKeyUp.add(function(ed, e) {
634 var txt = tinyMCE.activeEditor.getContent();
635 match = txt.match(/@([^ \n]+)$/);
637 if(cPopup === null) {
638 cPopup = new ACPopup(this,baseurl+"/acl");
640 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
641 if(! cPopup.ready) cPopup = null;
644 if(cPopup !== null) { cPopup.close(); cPopup = null; }
647 textlen = txt.length;
648 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
649 $('#profile-jot-desc').html(window.isPublic);
652 $('#profile-jot-desc').html(' ');
656 ed.onInit.add(function(ed) {
657 ed.pasteAsPlainText = true;
658 var editorId = ed.editorId;
659 var textarea = $('#'+editorId);
660 if (typeof(textarea.attr('tabindex')) != "undefined") {
661 $('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
662 textarea.attr('tabindex', null);
666 plaintextFn : function() {
667 $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
670 InitMCEEditor(editorData);
674 function contactInitEditor() {
677 elements : "contact-edit-info",
680 InitMCEEditor(editorData);
684 function eventInitEditor() {
687 //plugins : "bbcode,paste",
688 //paste_text_sticky : true,
689 //theme_advanced_path : false,
690 setup : function(ed) {
691 ed.onInit.add(function(ed) {
692 ed.pasteAsPlainText = true;
696 InitMCEEditor(editorData);
700 function profInitEditor() {
703 //plugins : "bbcode,paste",
704 //paste_text_sticky : true,
705 //theme_advanced_path : false,
706 setup : function(ed) {
707 ed.onInit.add(function(ed) {
708 ed.pasteAsPlainText = true;
712 InitMCEEditor(editorData);
720 function addeditortext(textElem, data) {
721 if(window.editSelect == 'none') {
722 var currentText = $(textElem).val();
723 $(textElem).val(currentText + data);
726 tinyMCE.execCommand('mceInsertRawHTML',false,data);
729 function jotVideoURL() {
730 reply = prompt(window.vidURL);
731 if(reply && reply.length) {
732 addeditortext("#profile-jot-text", '[video]' + reply + '[/video]');
736 function jotAudioURL() {
737 reply = prompt(window.audURL);
738 if(reply && reply.length) {
739 addeditortext("#profile-jot-text", '[audio]' + reply + '[/audio]');
744 function jotGetLocation() {
746 /* if(navigator.geolocation) {
748 navigator.geolocation.getCurrentPosition(function(position) {
749 var lat = position.coords.latitude;
750 var lng = position.coords.longitude;
754 url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
755 jsonp: 'json_callback',
756 contentType: 'application/json',
758 success: function(json) {
760 var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
761 $('#jot-location').val(locationDisplay);
762 $('#jot-display-location').html('Location: '+locationDisplay);
763 $('#jot-display-location').show();
770 reply = prompt(window.whereAreU, $('#jot-location').val());
771 if(reply && reply.length) {
772 $('#jot-location').val(reply);
776 reply = prompt(window.whereAreU, $('#jot-location').val());
777 if(reply && reply.length) {
778 $('#jot-location').val(reply);
782 function jotShare(id) {
783 if ($('#jot-popup').length != 0) $('#jot-popup').show();
785 $('#like-rotator-' + id).show();
786 $.get('share/' + id, function(data) {
787 if (!editor) $("#profile-jot-text").val("");
788 initEditor(function(){
789 addeditortext("#profile-jot-text", data);
790 $('#like-rotator-' + id).hide();
791 $(window).scrollTop(0);
797 function jotClearLocation() {
798 $('#jot-coord').val('');
799 $('#profile-nolocation-wrapper').hide();
803 function jotGetLink() {
804 reply = prompt(window.linkURL);
805 if(reply && reply.length) {
806 reply = bin2hex(reply);
807 $('#profile-rotator').show();
808 $.get('parse_url?binurl=' + reply, function(data) {
809 addeditortext(window.jotId, data);
810 $('#profile-rotator').hide();
816 function linkdropper(event) {
817 var linkFound = event.dataTransfer.types.contains("text/uri-list");
819 event.preventDefault();
823 function linkdrop(event) {
824 var reply = event.dataTransfer.getData("text/uri-list");
825 //event.target.textContent = reply;
826 event.preventDefault();
827 if(reply && reply.length) {
828 reply = bin2hex(reply);
829 $('#profile-rotator').show();
830 $.get('parse_url?binurl=' + reply, function(data) {
831 /* if(window.jotId == "#profile-jot-text") {
832 if (!editor) $("#profile-jot-text").val("");
833 initEditor(function(){
834 addeditortext(window.jotId, data);
835 $('#profile-rotator').hide();
839 addeditortext(window.jotId, data);
840 $('#profile-rotator').hide();
847 if(typeof window.geoTag === 'function') window.geoTag();
854 function confirmDelete() { return confirm(window.delItem); }
856 function deleteCheckedItems(delID) {
857 if(confirm(window.delItems)) {
861 $(delID + '-rotator').show();
862 $('.item-select').each( function() {
863 if($(this).is(':checked')) {
864 if(checkedstr.length != 0) {
865 checkedstr = checkedstr + ',' + $(this).val();
868 checkedstr = $(this).val();
872 $.post('item', { dropitems: checkedstr }, function(data) {
873 window.location.reload();
878 function itemTag(id) {
879 reply = prompt(window.term);
880 if(reply && reply.length) {
881 reply = reply.replace('#','');
885 $('body').css('cursor', 'wait');
887 $.get('tagger/' + id + '?term=' + reply, NavUpdate);
888 /*if(timer) clearTimeout(timer);
889 timer = setTimeout(NavUpdate,3000);*/
895 function itemFiler(id) {
897 var bordercolor = $("input").css("border-color");
899 $.get('filer/', function(data){
900 $.colorbox({html:data});
902 $("#id_term").keypress(function(){
903 $(this).css("border-color",bordercolor);
905 $("#select_term").change(function(){
906 $("#id_term").css("border-color",bordercolor);
909 $("#filer_save").click(function(e){
911 reply = $("#id_term").val();
912 if(reply && reply.length) {
914 $('body').css('cursor', 'wait');
915 $.get('filer/' + id + '?term=' + reply, NavUpdate);
916 /* if(timer) clearTimeout(timer);
917 timer = setTimeout(NavUpdate,3000);*/
921 $("#id_term").css("border-color","#FF0000");
934 function insertFormatting(comment,BBcode,id) {
936 var tmpStr = $("#comment-edit-text-" + id).val();
937 if(tmpStr == comment) {
939 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
940 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
941 openMenu("comment-edit-submit-wrapper-" + id);
942 $("#comment-edit-text-" + id).val(tmpStr);
945 textarea = document.getElementById("comment-edit-text-" +id);
946 if (document.selection) {
948 selected = document.selection.createRange();
949 if (BBcode == "url"){
950 selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
952 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
953 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
954 var start = textarea.selectionStart;
955 var end = textarea.selectionEnd;
956 if (BBcode == "url"){
957 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
959 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
964 function cmtBbOpen(id) {
965 $("#comment-edit-bb-" + id).show();
967 function cmtBbClose(id) {
968 $("#comment-edit-bb-" + id).hide();
971 function commentOpen(obj,id) {
972 if(obj.value == window.commentEmptyText) {
974 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
975 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
976 $("#mod-cmnt-wrap-" + id).show();
977 openMenu("comment-edit-submit-wrapper-" + id);
980 function commentClose(obj,id) {
981 if(obj.value == "") {
982 obj.value = window.commentEmptyText;
983 $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
984 $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
985 $("#mod-cmnt-wrap-" + id).hide();
986 closeMenu("comment-edit-submit-wrapper-" + id);
991 function commentInsert(obj,id) {
992 var tmpStr = $("#comment-edit-text-" + id).val();
993 if(tmpStr == window.commentEmptyText) {
995 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
996 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
997 openMenu("comment-edit-submit-wrapper-" + id);
999 var ins = $(obj).html();
1000 ins = ins.replace("<","<");
1001 ins = ins.replace(">",">");
1002 ins = ins.replace("&","&");
1003 ins = ins.replace(""",'"');
1004 $("#comment-edit-text-" + id).val(tmpStr + ins);
1007 function qCommentInsert(obj,id) {
1008 var tmpStr = $("#comment-edit-text-" + id).val();
1009 if(tmpStr == window.commentEmptyText) {
1011 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
1012 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
1013 openMenu("comment-edit-submit-wrapper-" + id);
1015 var ins = $(obj).val();
1016 ins = ins.replace("<","<");
1017 ins = ins.replace(">",">");
1018 ins = ins.replace("&","&");
1019 ins = ins.replace(""",'"');
1020 $("#comment-edit-text-" + id).val(tmpStr + ins);
1024 /*function showHideCommentBox(id) {
1025 if( $('#comment-edit-form-' + id).is(':visible')) {
1026 $('#comment-edit-form-' + id).hide();
1029 $('#comment-edit-form-' + id).show();