// JavaScript Document var last_comment_where = ""; var last_comment_what = ""; var comment_form = '
' + '' + '' + '' + '  (norėdami įkelti trailerį galite pasinaudoti <embed> kodu)' + '
' + '' + '
'; var comment_link = ''; jQuery(document).ready(function(){ //jQuery("a[id*='rate']").css("color", "white"); jQuery("a[id*='rate']").hover( function () { if (jQuery(this).attr("name")) { jQuery(this).css("cursor", "pointer"); } }, function () { jQuery(this).css("cursor", "default"); } ); jQuery("a[id*='rate']").click(function(){ id = jQuery(this).attr("id"); if (jQuery(this).attr("name")) { jQuery.ajax({ type: "POST", url: "/rating.php", data: "name="+id, cache: false, success: function(html){ tid = jQuery("span[id='"+id.replace(">", "").replace("<","")+"']").attr("id"); jQuery("span[id='"+tid+"']").text(parseInt(jQuery("span[id='"+tid+"']").text())+parseInt(html)); } }); } id = id.replace('<','>'); jQuery("img[id='"+id+"']").attr("src","/img/up_gr.gif"); jQuery("a[id='"+id+"']").removeAttr("name"); jQuery("a[id='"+id+"']").css("cursor", "default"); jQuery("a[id='"+id+"']").removeAttr("id"); id = id.replace('>','<'); jQuery("img[id='"+id+"']").attr("src","/img/down_gr.gif"); jQuery("a[id='"+id+"']").removeAttr("name"); jQuery("a[id='"+id+"']").css("cursor", "default"); jQuery("a[id='"+id+"']").removeAttr("id"); }); }); function SSubmit(e) { var comment = jQuery("#comment").val(); var parent_nr = jQuery("input#parent_nr").val(); var this_nr = jQuery("input#this_nr").val(); var deep = jQuery("input#deep").val(); var dataString = 'comment=' + comment + '&this_nr='+ this_nr +'&deep=' + deep; if(comment=='') { alert('Prašome parašyti ką nors.'); } else { jQuery.ajax({ type: "POST", url: "/commentajax.php", data: dataString, cache: false, success: function(html){ if (this_nr == 0) { if (jQuery("div#an > *").attr('id') != 'first') { jQuery("div[id*='comment']:last").after(html); } else { jQuery("div#an").html(html); jQuery("div[id*='comment']:first").after('
'+comment_form+comment_link+'
'); } } else { jQuery("div#comment_"+parent_nr).after(html); } reg = new RegExp(/id="comment_([^"]+)"/gi); id = html.match(reg).toString(); id = RegExp.$1; if (last_comment_where) { jQuery(last_comment_where).show(); jQuery(last_comment_what).html(""); jQuery(last_comment_what).hide(); } index = jQuery("div[id*='comment']").index(jQuery("div#comment_"+id)); index--; if (index > -1) { jQuery.scrollTo(jQuery("a[class='comment']").eq(index), 1500); } jQuery("div#comment_"+id).hide(); jQuery("div#comment_"+id).fadeIn("slow"); jQuery("div#comment_"+id).css("backgroundColor","#fffbe7"); jQuery("div#comment_"+id).animate({backgroundColor: "#fffff"}, 4000); jQuery('input#parent_nr').val(0); jQuery('input#this_nr').val(0); jQuery('input#deep').val(0); jQuery('#comment').val(""); jQuery('#comment').focus(); } }); } return false; } function showme() { jQuery(last_comment_where).show(); jQuery(last_comment_what).html(""); jQuery(last_comment_what).hide(); last_comment_where = ""; last_comment_what = ""; jQuery("a#main_label").after(comment_form); jQuery("a#main_label").hide(); jQuery("form#post_form").hide(); jQuery("form#post_form").fadeIn("slow"); } function Komentuoti(e) { var unreg = ''; if (!unreg) { jQuery(e).parent().html('Norint pakomentuoti reikia prisijungti arba užsiregistruoti'); return false; } var index = jQuery("a[class='comment']").index(e); var its = jQuery(e).attr('name'); test = its.split('::'); parent_nr = parseInt(test[0]); this_nr = parseInt(test[1]); deep = parseInt(test[2]); //deep = parseInt(jQuery("div#comment_"+this_nr).css("margin-left")) + 30 + 'px'; if (last_comment_where != "") { jQuery(last_comment_where).show(); jQuery(last_comment_what).html(""); jQuery(last_comment_what).hide(); } else { jQuery("form#post_form").html(""); jQuery("form#post_form").hide(); jQuery("a#main_label").fadeIn("slow"); } last_comment_where = jQuery(e); last_comment_what = jQuery("#reply_"+this_nr); jQuery(e).hide(); jQuery("div#reply_"+this_nr).html(comment_form); jQuery("form#post_form").show(); jQuery("div#reply_"+this_nr).fadeIn("slow"); jQuery('form#post_form #comment').focus(); //jQuery('#comment').val("current: "+parent_nr+'::'+this_nr+'::'+deep+"\r\n"); var kiekis = jQuery("a[class='comment']").get(); var viso = kiekis.length; var nr; var z=0; for(i=index+1;i= curr_deep) i = viso; if (curr_parent_nr == this_nr || deep < curr_deep) { parent_nr = curr_this_nr; z++; } } if (z==0) { parent_nr = this_nr; } jQuery('input#parent_nr').val(parent_nr); jQuery('input#this_nr').val(this_nr); jQuery('input#deep').val(deep); //jQuery('#comment').val(parent_nr+'::'+this_nr+'::'+deep); }