function ajaxUpdatePostNCall(instance,requestURL,para,instance2,requestURL2){ $(instance).update(''); requestURL = requestURL + '?' + new Date().getTime(); var myAjax = new Ajax.Updater(instance, requestURL, { method: 'post', parameters: para, evalScripts: true, onComplete: function(){ var cookieLan = readCookie("lan"); if(cookieLan=="cn"){ tc2sc(instance); } var myAjax2 = new Ajax.Updater(instance2, requestURL2, { method: 'get', parameters: para, evalScripts: true, onComplete: function(transport){ if(!transport.responseText.blank()){ $(instance2).show(); }else{ $(instance2).hide(); } } }); } }); } function ajaxUpdateFeeds(instance,requestURL,para,loader){ $(loader).update(''); requestURL = requestURL + "?" + new Date().getTime(); var myAjax = new Ajax.Updater(instance, requestURL, { method: 'get', parameters: para, evalScripts: true, onComplete: function(){ $(loader).update(''); var cookieLan = readCookie("lan"); if(cookieLan=="cn"){ tc2sc(instance); } } }); } focus_item = 'dummy'; function change_comment_form(feed_id){ if(focus_item=='dummy'){//dummy 直接 appear var styles = $H({ display: "block" }); var styles2 = $H({ width: "450px"}); $('my_comment_cover'+feed_id).setStyle(styles.toObject()); $('my_comment_btn'+feed_id).setStyle(styles.toObject()); $('my_comment_content'+feed_id).setStyle(styles2.toObject()); $('add_comment_text'+feed_id).setStyle(styles2.toObject()); if($('add_comment_text'+feed_id).value=='Write a comment...'){ $('add_comment_text'+feed_id).value=''; } focus_item = feed_id; return false; }else{ var styles = $H({ display: "none" }); var styles2 = $H({ width: "485px"}); $('my_comment_cover'+focus_item).setStyle(styles.toObject()); $('my_comment_btn'+focus_item).setStyle(styles.toObject()); $('my_comment_content'+focus_item).setStyle(styles2.toObject()); $('add_comment_text'+focus_item).setStyle(styles2.toObject()); //$('add_comment_text'+focus_item).value='Write a comment...'; if($('add_comment_text'+focus_item).value==''){ $('add_comment_text'+focus_item).value='Write a comment...'; } styles = $H({ display: "block" }); styles2 = $H({ width: "450px"}); $('my_comment_cover'+feed_id).setStyle(styles.toObject()); $('my_comment_btn'+feed_id).setStyle(styles.toObject()); $('my_comment_content'+feed_id).setStyle(styles2.toObject()); $('add_comment_text'+feed_id).setStyle(styles2.toObject()); if($('add_comment_text'+feed_id).value=='Write a comment...'){ $('add_comment_text'+feed_id).value=''; } focus_item = feed_id; return false; } } function feedSendComment(feed_id,type,thing_id,owner_id){ var comment = $('add_comment_text'+feed_id).value; if(comment=='Write a comment...'||comment==''){ return; }else{ ajaxUpdatePost('comment-block'+feed_id,'/db_includes/ajax_add_comment_action.php','comment='+encodeURIComponent(comment)+'&type='+type+'&thing_id='+thing_id+'&owner_id='+owner_id+'&feed_id='+feed_id); $('add_comment_text'+feed_id).value=''; } } function sz(t) { a = t.value.split('\n'); b=0; for (x=0;x < a.length; x++) { if (a[x].length >= 35) b+= Math.floor(a[x].length/35); } b+= a.length; var newpx = (b*15)+'px'; var styles2 = $H({ height: newpx}); if((b*15) <= 200) t.setStyle(styles2.toObject()); }