indexareascript.blade.php 6.55 KB
<script>

  function search_ofriends()
  {
	var searchstr = $("#search_ofriends").val();
	if(searchstr.length >= 4)
	{
	  doAjax('social?stype=search_ofriends&srch_data='+searchstr+'&stage='+lastvarUrl,'','online_friends_top','ajax_onlinefriends','singlefail','POST');
	}
  }
  
<?php $wall_type_arr=array("activity","personal","photo","link","attachment","notes","question","test");foreach($wall_type_arr as $walltype){ ?>
$("#{!!$walltype!!}wallul").parent().bind("scroll",function(){
  //console.log(""+$("#{!!$walltype!!}wallul").parent().scrollTop()+" "+$("#{!!$walltype!!}wallul").parent().prop('scrollHeight')+" "+$("#{!!$walltype!!}wallul").parent().height());

  var diff=$("#{!!$walltype!!}wallul").parent().prop('scrollHeight')-$("#{!!$walltype!!}wallul").parent().scrollTop()-$("#{!!$walltype!!}wallul").parent().height();

  if(diff<100&&$("#{!!$walltype!!}lastdate").val()!="")
  {
  var idprepend=$("#{!!$walltype!!}lastdate").val();
  idprepend=idprepend.replace(/-/g,"");
  idprepend=idprepend.replace(/:/g,"");
  idprepend=idprepend.replace(/ /g,"");

  show_wall_feeds("{!!$walltype!!}",1);
  $("#"+idprepend+"{!!$walltype!!}walldivul").css({"display":"none"});
  }

});
<?php } ?>
  
  var lastwallfeed='activity';
  function show_wall_feeds(ptype,flag)
  {
    if(ptype=='')ptype=lastwallfeed;
    if(ptype=='')ptype='activity';
    lastwallfeed=ptype;
    
    var filter="All_Posts";
    var hashtags=encodeURIComponent($("#"+ptype+"filterhashtags").val());

    if(flag!=1) {$("#"+ptype+"lastdate").val("");$("#"+ptype+"wallul").html("<br><br><br><br><br>");}
    if($("#"+ptype+"wall_filter").val() != '')filter = $("#"+ptype+"wall_filter").val();
    
    var idprepend=$("#"+ptype+"lastdate").val();
    idprepend=idprepend.replace(/-/g,"");
    idprepend=idprepend.replace(/:/g,"");
    idprepend=idprepend.replace(/ /g,"");
    if(flag==1){$("#"+idprepend+ptype+"wallul").html("<br><br><br><br><br>");}//<center><img src='assets/images/loading.gif' width=50px></center>
    
    doAjax('social/{!!Auth::user()->id!!}?show=wall&wall='+ptype+'&filter='+filter+'&lastdate='+$("#"+ptype+"lastdate").val()+'&hashtags='+hashtags,'',idprepend+ptype+"wallul",ptype+'ajax_wall_show','singlefail','GET', function(){
	  //if($("#wallsdivpp").length)$("#"+ptype+"wallul").height($("#wall_feed").height()-$("#wallsdivpp").height()-$("#"+ptype+"wallsdivppp").height());
    });
  }
  function socialhashtagsearch(str)
  {
    $("#"+lastwallfeed+"filterhashtags").val(str);
    $("#"+lastwallfeed+"wall_filter").val("");
    show_wall_feeds('',0);
  }
  function popupProfileSocial(uid)
  {
//     $("#welcome_wizard_body").html("");
//     doAjax('social?stype=load_frnddetails&show_user='+uid,'','welcome_wizard_body','ajax_profile_update','singlefail','POST');
//     $("#welcome_wizard").modal('show');
//     
//     $('#welcome_wizard').on('hidden.bs.modal', function () {
//         $("#welcome_wizard_body").html("");
//     });
  }
  function checkpostcomment(e,postid,value,userid)
  {
    var keycode= e.keyCode || e.which;
    if(keycode==13&&value!='')
    {
      var putdata="stype=comment&postid="+postid+"&cdata="+value;
      doAjax('social?userid='+userid,putdata,'','ajax_post_create','singlefail','POST',function(){
      
      });
      return false;
    }
    return true;
  }
  function storecommentsuccess(postid,cdata,dt)
  {
    $("#postbox_"+postid+" div:last").before(" \
    <div class='media innerAll margin-none bg-gray-light border-top border-bottom'> \
      <img src='{!!Auth::user()->fetchphotothumb()!!}' alt='photo' class='media-object pull-left' width='35'> \
      <div class='media-body'> \
	    <a href='javascript:void(0);' class='strong'>{!!Auth::user()->dispname()!!}</a> "+cdata+" \
	      <a href='#delete_comm_confirm' data-toggle='modal'><i class='fa fa-trash-o pull-right' onclick='$('#del_comm').attr({'delete':"+postid+", 'time':'"+dt+"'});' style='color:#DFDFDF'></i></a> \
	    <div class='timeline-bottom'> \
	      <i class='fa fa-clock-o'></i> Just Now \
	    </div>   \
      </div> \
    </div> \
    ");
    $("#commentbox_"+postid).val("");
  }
  function expandWall()
  {
	$("#postin_area_tops").slideToggle();
	$("#postin_area_top").slideToggle();
	
	if($("#expand_wall").attr("class")=="btn btn-default")
	{
	  $("#expand_wall_txt").html("Hide Write Post");
	  $("#expand_wall").attr("class", "btn btn-default filled");
	  $("#expand_wall_icon").attr("class", "fa fa-th-large");
	}
	else
	{
	  $("#expand_wall_txt").html("Write Post");
	  $("#expand_wall").attr("class", "btn btn-default");
	  $("#expand_wall_icon").attr("class", "fa fa-th");
	}
  }
  function sindexmenu(str,elem)
  {
     $(".ssm").removeClass("active");
     $(elem).parent().addClass("active");
     doAjax('social/{!!Auth::user()->id!!}?show='+str,'','socialrightall','ajax_wall_show','singlethis','GET');return false;
  }

  function plusonpost(count,postid)
  {
    if(!$("#post_t"+count+"_"+postid).hasClass('text-primary'))
    {
      $("#post_t1_"+postid).removeClass("text-primary");
      $("#post_t2_"+postid).removeClass("text-primary");
      $("#post_t3_"+postid).removeClass("text-primary");
      for(i=1;i<=count;i++)$("#post_t"+i+"_"+postid).toggleClass("text-primary");
    }
    else
    {
      $("#post_t1_"+postid).removeClass("text-primary");
      $("#post_t2_"+postid).removeClass("text-primary");
      $("#post_t3_"+postid).removeClass("text-primary");
      count=0;
    }
    
    $("#post_t1_"+postid+"_eps").html(parseInt($("#post_t1_"+postid+"_eps").attr('oldvalttl'))-parseInt($("#post_t1_"+postid+"_eps").attr('oldmyval'))+count);
    
    
    doAjax('social?userid={!!Auth::user()->id!!}','stype=likepost&postid='+postid+'&count='+count,'','ajax_post_create','singlefail','POST');
    
  }
  function del_comment(commentid,postid)
  {
	doAjax('social?stype=del_comment&delc_id='+commentid+'&delp_id='+postid,'','','ajax_comment_delete','singlefail','POST');
  }

  function delete_post(id)
  {
	doAjax('social?stype=del_post&delp_id='+id,'','','ajax_delete_post','singlefail','POST');
  }
  function share_post(id,shareacl,sharecaption)
  {
	var varstr='&shrp_id='+id;
	if(shareacl != '')
	  varstr+= "&shareacl="+shareacl;
	if(sharecaption != '')
	  varstr+= "&sharecaption="+sharecaption;

	doAjax('social?stype=share_post'+varstr,'','','ajax_share_post','singlefail','POST');
  }
  function spam_post(id,reason)
  {
    doAjax('social?stype=spam_post&id='+id+'&reason='+reason,'','','ajax_spam_post','singlefail','POST');
  }
  
  var filterkeyuptimer=null;
  function filterhashkeyup(str)
  {
    clearTimeout(filterkeyuptimer);
    filterkeyuptimer = setTimeout(function(){show_wall_feeds('');}, 1500);
  }
</script>