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 $('#event-share-checkbox').change(function() {
75 if ($('#event-share-checkbox').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 + '/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);
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>=4) {
206 $("#events-calendar").fullCalendar('gotoDate',args[2] , args[3]-1);
210 var hash = location.hash.split("-")
211 if (hash.length==2 && hash[0]=="#link") showEvent(hash[1]);
215 switch(window.autocompleteType) {
217 var a = $("#recip").autocomplete({
218 serviceUrl: baseurl + '/acl',
221 onSelect: function(value,data) {
222 $("#recip-complete").val(data);
226 case 'contacts-head':
227 var a = $("#contacts-search").autocomplete({
228 serviceUrl: baseurl + '/acl',
232 a.setOptions({ params: { type: 'a' }});
235 $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
241 /* if(window.autoCompleteType == "display-head") {
242 //$(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
243 // make auto-complete work in more places
244 //$(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
245 $(".comment-wwedit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
248 // Add Colorbox for viewing Network page images
249 //var cBoxClasses = new Array();
250 $(".wall-item-body a img").each(function(){
251 var aElem = $(this).parent();
252 var imgHref = aElem.attr("href");
254 // We need to make sure we only put a Colorbox on links to Friendica images
255 // We'll try to do this by looking for links of the form
256 // .../photo/ab803d8eg08daf85023adfec08 (with nothing more following), in hopes
257 // that that will be unique enough
258 if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
260 // Add a unique class to all the images of a certain post, to allow scrolling through
261 var cBoxClass = $(this).closest(".wall-item-body").attr("id") + "-lightbox";
262 $(this).addClass(cBoxClass);
264 // if( $.inArray(cBoxClass, cBoxClasses) < 0 ) {
265 // cBoxClasses.push(cBoxClass);
270 photo: true, // Colorbox doesn't recognize a URL that don't end in .jpg, etc. as a photo
271 rel: cBoxClass //$(this).attr("class").match(/wall-item-body-[\d]+-lightbox/)[0]
275 /*$.each(cBoxClasses, function(){
276 $('.'+this).colorbox({
286 // update pending count //
289 $("nav").bind('nav-update', function(e,data){
290 var elm = $('#pending-update');
291 var register = $(data).find('register').text();
292 if (register=="0") { register=""; elm.hide();} else { elm.show(); }
300 $("#cnftheme").click(function(){
304 href: baseurl + "/admin/themes/" + $("#id_theme :selected").val(),
305 onComplete: function(){
306 $("div#fancybox-content form").submit(function(e){
307 var url = $(this).attr('action');
308 // can't get .serialize() to work...
310 $(this).find("input").each(function(){
311 data[$(this).attr('name')] = $(this).val();
313 $(this).find("select").each(function(){
314 data[$(this).attr('name')] = $(this).children(":selected").val();
316 console.log(":)", url, data);
318 $.post(url, data, function(data) {
319 if(timer) clearTimeout(timer);
334 function homeRedirect() {
335 $('html').fadeOut('slow', function(){
336 window.location = baseurl + "/login";
341 if(typeof window.photoEdit != 'undefined') {
343 $(document).keydown(function(event) {
345 if(window.prevLink != '') { if(event.ctrlKey && event.keyCode == 37) { event.preventDefault(); window.location.href = window.prevLink; }}
346 if(window.nextLink != '') { if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = window.nextLink; }}
351 function showEvent(eventid) {
353 baseurl + '/events/?id='+eventid,
355 $.colorbox({html:data});
361 function doEventPreview() {
362 $('#event-edit-preview').val(1);
363 $.post('events',$('#event-edit-form').serialize(), function(data) {
364 $.colorbox({ html: data });
366 $('#event-edit-preview').val(0);
369 function initCrop() {
370 function onEndCrop( coords, dimensions ) {
371 $PR( 'x1' ).value = coords.x1;
372 $PR( 'y1' ).value = coords.y1;
373 $PR( 'x2' ).value = coords.x2;
374 $PR( 'y2' ).value = coords.y2;
375 $PR( 'width' ).value = dimensions.width;
376 $PR( 'height' ).value = dimensions.height;
379 Event.observe( window, 'load', function() {
380 new Cropper.ImgWithPreview(
383 previewWrap: 'previewWrap',
388 ratioDim: { x: 100, y:100 },
397 $(document).mouseup(function (clickPos) {
399 var sysMenu = $("#system-menu-list");
400 var sysMenuLink = $(".system-menu-link");
401 var contactsMenu = $("#contacts-menu-list");
402 var contactsMenuLink = $(".contacts-menu-link");
403 var networkMenu = $("#network-menu-list");
404 var networkMenuLink = $(".network-menu-link");
406 if( !sysMenu.is(clickPos.target) && !sysMenuLink.is(clickPos.target) && sysMenu.has(clickPos.target).length === 0) {
407 hideNavMenu("#system-menu-list");
409 if( !contactsMenu.is(clickPos.target) && !contactsMenuLink.is(clickPos.target) && contactsMenu.has(clickPos.target).length === 0) {
410 hideNavMenu("#contacts-menu-list");
412 if( !networkMenu.is(clickPos.target) && !networkMenuLink.is(clickPos.target) && networkMenu.has(clickPos.target).length === 0) {
413 hideNavMenu("#network-menu-list");
418 function getPageContent(url) {
420 var pos = $('.main-container').position();
422 $('.main-container').css('margin-left', pos.left);
423 $('.main-content-container').hide(0, function () {
424 $('.main-content-loading').show(0);
427 $.get(url, function(html) {
428 console.log($('.main-content-container').html());
429 $('.main-content-container').html( $('.main-content-container', html).html() );
430 console.log($('.main-content-container').html());
431 $('.main-content-loading').hide(function() {
432 $('.main-content-container').fadeIn(800,function() {
433 $('.main-container').css('margin-left', 'auto'); // This sucks -- if the CSS specification changes, this will be wrong
440 function showNavMenu(menuID) {
442 if(window.navMenuTimeout[menuID + '-closing']) {
443 window.navMenuTimeout[menuID + '-closing'] = false;
444 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
447 window.navMenuTimeout[menuID + '-opening'] = true;
449 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
450 $(menuID).slideDown('fast').show();
451 window.navMenuTimeout[menuID + '-opening'] = false;
456 function hideNavMenu(menuID) {
458 if(window.navMenuTimeout[menuID + '-opening']) {
459 window.navMenuTimeout[menuID + '-opening'] = false;
460 clearTimeout(window.navMenuTimeout[menuID + '-timeout']);
463 window.navMenuTimeout[menuID + '-closing'] = true;
465 window.navMenuTimeout[menuID + '-timeout'] = setTimeout( function () {
466 $(menuID).slideUp('fast');
467 window.navMenuTimeout[menuID + '-closing'] = false;
478 function InitMCEEditor(editorData) {
479 var tinyMCEInitConfig = {
482 //editor_selector: // SPECIFIC
483 //elements: // SPECIFIC
484 plugins : "bbcode,paste,autoresize,inlinepopups",
485 theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
486 theme_advanced_buttons2 : "",
487 theme_advanced_buttons3 : "",
488 theme_advanced_toolbar_location : "top",
489 theme_advanced_toolbar_align : "center",
490 theme_advanced_blockformats : "blockquote,code",
491 gecko_spellcheck : true,
492 paste_text_sticky : true, // COUPLED WITH paste PLUGIN
493 entity_encoding : "raw",
494 add_unload_trigger : false,
495 remove_linebreaks : false,
496 //force_p_newlines : false,
497 //force_br_newlines : true,
498 forced_root_block : 'div',
499 //convert_urls: false, //SPECIFIC?
500 content_css: baseurl + "/view/custom_tinymce.css",
501 theme_advanced_path : false,
502 file_browser_callback : "fcFileBrowser",
503 //setup : // SPECIFIC
506 if(window.editSelect != 'none') {
507 $.extend(tinyMCEInitConfig, editorData);
508 tinyMCE.init(tinyMCEInitConfig);
510 else if(typeof editorData.plaintextFn == 'function') {
511 (editorData.plaintextFn)();
518 function initEditor(cb){
521 $("#profile-jot-text-loading").show();
524 mode : "specific_textareas",
525 editor_selector : "profile-jot-text",
526 auto_focus : "profile-jot-text",
527 //plugins : "bbcode,paste,autoresize,inlinepopups",
528 //paste_text_sticky : true,
529 convert_urls : false,
530 setup : function(ed) {
532 ed.onKeyDown.add(function(ed,e) {
537 ed.onKeyUp.add(function(ed, e) {
538 var txt = tinyMCE.activeEditor.getContent();
539 match = txt.match(/@([^ \n]+)$/);
541 if(cPopup === null) {
542 cPopup = new ACPopup(this,baseurl+"/acl");
544 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
545 if(! cPopup.ready) cPopup = null;
548 if(cPopup !== null) { cPopup.close(); cPopup = null; }
551 textlen = txt.length;
552 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
553 $('#profile-jot-desc').html(window.isPublic);
556 $('#profile-jot-desc').html(' ');
562 $('#character-counter').removeClass('red');
563 $('#character-counter').removeClass('orange');
564 $('#character-counter').addClass('grey');
566 if((textlen > 140) && (textlen <= 420)) {
567 $('#character-counter').removeClass('grey');
568 $('#character-counter').removeClass('red');
569 $('#character-counter').addClass('orange');
572 $('#character-counter').removeClass('grey');
573 $('#character-counter').removeClass('orange');
574 $('#character-counter').addClass('red');
576 $('#character-counter').text(textlen);
579 ed.onInit.add(function(ed) {
580 ed.pasteAsPlainText = true;
581 $("#profile-jot-text-loading").hide();
582 $(".jothidden").show();
583 if (typeof cb!="undefined") cb();
587 plaintextFn : function() {
588 $("#profile-jot-text-loading").hide();
589 $("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
590 $("#profile-jot-text").contact_autocomplete(baseurl+"/acl");
591 $(".jothidden").show();
592 if (typeof cb!="undefined") cb();
595 InitMCEEditor(editorData);
598 $("a#jot-perms-icon").colorbox({
600 'transition' : 'elastic'
603 if (typeof cb!="undefined") cb();
607 function enableOnUser(){
614 function msgInitEditor() {
616 mode : "specific_textareas",
617 editor_selector : "prvmail-text",
618 //plugins : "bbcode,paste",
619 //paste_text_sticky : true,
620 convert_urls : false,
621 //theme_advanced_path : false,
622 setup : function(ed) {
624 ed.onKeyDown.add(function(ed,e) {
629 ed.onKeyUp.add(function(ed, e) {
630 var txt = tinyMCE.activeEditor.getContent();
631 match = txt.match(/@([^ \n]+)$/);
633 if(cPopup === null) {
634 cPopup = new ACPopup(this,baseurl+"/acl");
636 if(cPopup.ready && match[1]!==cPopup.searchText) cPopup.search(match[1]);
637 if(! cPopup.ready) cPopup = null;
640 if(cPopup !== null) { cPopup.close(); cPopup = null; }
643 textlen = txt.length;
644 if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
645 $('#profile-jot-desc').html(window.isPublic);
648 $('#profile-jot-desc').html(' ');
652 ed.onInit.add(function(ed) {
653 ed.pasteAsPlainText = true;
654 var editorId = ed.editorId;
655 var textarea = $('#'+editorId);
656 if (typeof(textarea.attr('tabindex')) != "undefined") {
657 $('#'+editorId+'_ifr').attr('tabindex', textarea.attr('tabindex'));
658 textarea.attr('tabindex', null);
662 plaintextFn : function() {
663 $("#prvmail-text").contact_autocomplete(baseurl+"/acl");
666 InitMCEEditor(editorData);
670 function contactInitEditor() {
673 elements : "contact-edit-info",
676 InitMCEEditor(editorData);
680 function eventInitEditor() {
683 //plugins : "bbcode,paste",
684 //paste_text_sticky : true,
685 //theme_advanced_path : false,
686 setup : function(ed) {
687 ed.onInit.add(function(ed) {
688 ed.pasteAsPlainText = true;
692 InitMCEEditor(editorData);
696 function profInitEditor() {
699 //plugins : "bbcode,paste",
700 //paste_text_sticky : true,
701 //theme_advanced_path : false,
702 setup : function(ed) {
703 ed.onInit.add(function(ed) {
704 ed.pasteAsPlainText = true;
708 InitMCEEditor(editorData);
716 function addeditortext(textElem, data) {
717 if(window.editSelect == 'none') {
718 var currentText = $(textElem).val();
719 $(textElem).val(currentText + data);
722 tinyMCE.execCommand('mceInsertRawHTML',false,data);
725 function jotVideoURL() {
726 reply = prompt(window.vidURL);
727 if(reply && reply.length) {
728 addeditortext("#profile-jot-text", '[video]' + reply + '[/video]');
732 function jotAudioURL() {
733 reply = prompt(window.audURL);
734 if(reply && reply.length) {
735 addeditortext("#profile-jot-text", '[audio]' + reply + '[/audio]');
740 function jotGetLocation() {
742 /* if(navigator.geolocation) {
744 navigator.geolocation.getCurrentPosition(function(position) {
745 var lat = position.coords.latitude;
746 var lng = position.coords.longitude;
750 url: 'http://nominatim.openstreetmap.org/reverse?format=json&lat='+lat+'&lon='+lng,
751 jsonp: 'json_callback',
752 contentType: 'application/json',
754 success: function(json) {
756 var locationDisplay = json.address.building+', '+json.address.city+', '+json.address.state;
757 $('#jot-location').val(locationDisplay);
758 $('#jot-display-location').html('Location: '+locationDisplay);
759 $('#jot-display-location').show();
766 reply = prompt(window.whereAreU, $('#jot-location').val());
767 if(reply && reply.length) {
768 $('#jot-location').val(reply);
772 reply = prompt(window.whereAreU, $('#jot-location').val());
773 if(reply && reply.length) {
774 $('#jot-location').val(reply);
778 function jotShare(id) {
779 if ($('#jot-popup').length != 0) $('#jot-popup').show();
781 $('#like-rotator-' + id).show();
782 $.get('share/' + id, function(data) {
783 if (!editor) $("#profile-jot-text").val("");
784 initEditor(function(){
785 addeditortext("#profile-jot-text", data);
786 $('#like-rotator-' + id).hide();
787 $(window).scrollTop(0);
793 function jotClearLocation() {
794 $('#jot-coord').val('');
795 $('#profile-nolocation-wrapper').hide();
799 function jotGetLink() {
800 reply = prompt(window.linkURL);
801 if(reply && reply.length) {
802 reply = bin2hex(reply);
803 $('#profile-rotator').show();
804 $.get('parse_url?binurl=' + reply, function(data) {
805 addeditortext(window.jotId, data);
806 $('#profile-rotator').hide();
812 function linkdropper(event) {
813 var linkFound = event.dataTransfer.types.contains("text/uri-list");
815 event.preventDefault();
819 function linkdrop(event) {
820 var reply = event.dataTransfer.getData("text/uri-list");
821 //event.target.textContent = reply;
822 event.preventDefault();
823 if(reply && reply.length) {
824 reply = bin2hex(reply);
825 $('#profile-rotator').show();
826 $.get('parse_url?binurl=' + reply, function(data) {
827 /* if(window.jotId == "#profile-jot-text") {
828 if (!editor) $("#profile-jot-text").val("");
829 initEditor(function(){
830 addeditortext(window.jotId, data);
831 $('#profile-rotator').hide();
835 addeditortext(window.jotId, data);
836 $('#profile-rotator').hide();
843 if(typeof window.geoTag === 'function') window.geoTag();
850 function confirmDelete() { return confirm(window.delItem); }
852 function deleteCheckedItems(delID) {
853 if(confirm(window.delItems)) {
857 $(delID + '-rotator').show();
858 $('.item-select').each( function() {
859 if($(this).is(':checked')) {
860 if(checkedstr.length != 0) {
861 checkedstr = checkedstr + ',' + $(this).val();
864 checkedstr = $(this).val();
868 $.post('item', { dropitems: checkedstr }, function(data) {
869 window.location.reload();
874 function itemTag(id) {
875 reply = prompt(window.term);
876 if(reply && reply.length) {
877 reply = reply.replace('#','');
881 $('body').css('cursor', 'wait');
883 $.get('tagger/' + id + '?term=' + reply, NavUpdate);
884 /*if(timer) clearTimeout(timer);
885 timer = setTimeout(NavUpdate,3000);*/
891 function itemFiler(id) {
893 var bordercolor = $("input").css("border-color");
895 $.get('filer/', function(data){
896 $.colorbox({html:data});
898 $("#id_term").keypress(function(){
899 $(this).css("border-color",bordercolor);
901 $("#select_term").change(function(){
902 $("#id_term").css("border-color",bordercolor);
905 $("#filer_save").click(function(e){
907 reply = $("#id_term").val();
908 if(reply && reply.length) {
910 $('body').css('cursor', 'wait');
911 $.get('filer/' + id + '?term=' + reply, NavUpdate);
912 /* if(timer) clearTimeout(timer);
913 timer = setTimeout(NavUpdate,3000);*/
917 $("#id_term").css("border-color","#FF0000");
930 function insertFormatting(comment,BBcode,id) {
932 var tmpStr = $("#comment-edit-text-" + id).val();
933 if(tmpStr == comment) {
935 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
936 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
937 openMenu("comment-edit-submit-wrapper-" + id);
938 $("#comment-edit-text-" + id).val(tmpStr);
941 textarea = document.getElementById("comment-edit-text-" +id);
942 if (document.selection) {
944 selected = document.selection.createRange();
945 if (BBcode == "url"){
946 selected.text = "["+BBcode+"=http://]" + selected.text + "[/"+BBcode+"]";
948 selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
949 } else if (textarea.selectionStart || textarea.selectionStart == "0") {
950 var start = textarea.selectionStart;
951 var end = textarea.selectionEnd;
952 if (BBcode == "url"){
953 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
955 textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
960 function cmtBbOpen(id) {
961 $("#comment-edit-bb-" + id).show();
963 function cmtBbClose(id) {
964 $("#comment-edit-bb-" + id).hide();
967 function commentOpen(obj,id) {
968 if(obj.value == window.commentEmptyText) {
970 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
971 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
972 $("#mod-cmnt-wrap-" + id).show();
973 openMenu("comment-edit-submit-wrapper-" + id);
976 function commentClose(obj,id) {
977 if(obj.value == "") {
978 obj.value = window.commentEmptyText;
979 $("#comment-edit-text-" + id).removeClass("comment-edit-text-full");
980 $("#comment-edit-text-" + id).addClass("comment-edit-text-empty");
981 $("#mod-cmnt-wrap-" + id).hide();
982 closeMenu("comment-edit-submit-wrapper-" + id);
987 function commentInsert(obj,id) {
988 var tmpStr = $("#comment-edit-text-" + id).val();
989 if(tmpStr == window.commentEmptyText) {
991 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
992 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
993 openMenu("comment-edit-submit-wrapper-" + id);
995 var ins = $(obj).html();
996 ins = ins.replace("<","<");
997 ins = ins.replace(">",">");
998 ins = ins.replace("&","&");
999 ins = ins.replace(""",'"');
1000 $("#comment-edit-text-" + id).val(tmpStr + ins);
1003 function qCommentInsert(obj,id) {
1004 var tmpStr = $("#comment-edit-text-" + id).val();
1005 if(tmpStr == window.commentEmptyText) {
1007 $("#comment-edit-text-" + id).addClass("comment-edit-text-full");
1008 $("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
1009 openMenu("comment-edit-submit-wrapper-" + id);
1011 var ins = $(obj).val();
1012 ins = ins.replace("<","<");
1013 ins = ins.replace(">",">");
1014 ins = ins.replace("&","&");
1015 ins = ins.replace(""",'"');
1016 $("#comment-edit-text-" + id).val(tmpStr + ins);
1020 /*function showHideCommentBox(id) {
1021 if( $('#comment-edit-form-' + id).is(':visible')) {
1022 $('#comment-edit-form-' + id).hide();
1025 $('#comment-edit-form-' + id).show();