403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/HostingSpaces/admin/chatme24.com/wwwroot/update/update-chameleon-4.6-4.7/_server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/HostingSpaces/admin/chatme24.com/wwwroot/update/update-chameleon-4.6-4.7/_server//wall_edge.js
var CWall = function() {

	var $this = this;
    this.dur=500;
    this.scrollDelta = 500;
    this.scrollBlock = false;
    this.oldItemsExists = false;
    this.isProfileWall = 0;
    this.singleItemMode = true;
    this.isFriendResponse = 0;

    this.setData = function(data){
        for (var key in data) {
            //console.log('WALL DATA: ' + key + '=' + data[key]);
            $this[key] = data[key];
        }
    }

    this.itemsInfo = {};
    this.itemInfoSet = function(id, like, comment, commentsCount, isViewed, listLikeUser, section) {
		var info=$this.itemsInfo[id] = ($this.itemsInfo[id] || {})
		info.like=(like||info.like);
		info.comment=(comment||info.comment);
		info.commentsCount=(commentsCount||info.commentsCount);
        info.listLikeUser=listLikeUser||info.listLikeUser;
        info.section=section||info.section||'';
		$this.commentsLoadMoreStatus(id, info.commentsCount, isViewed);
        console.log('Wall ItemInfoSet:', id, info);
	}

    this.commentsCacheRemoveByCid = function(id, cid) {
		if (!$this.commentsCache[id][cid]) return
		delete $this.commentsCache[id][cid];
		$this.commentsVisible[id]--;
	}

    this.itemInfoDelete = function(id) {
		delete $this.itemsInfo[id];
		$this.commentsCacheRemoveById(id);
	}

    this.init = function(){
        console.log('Wall INIT');
        $this.wallItems=$jq('#wall_items');
        $this.inputPostAdd=$('#wall_item_add').keydown(doOnEnter($this.itemAdd)).autosize();
        $this.$itemAddLoader=$('#wall_item_add_loader');
        $this.$scriptUpdate=$('#wall_script_ajax');
        $this.$placeholder=$('#wall_placeholder').clone();
        $('#wall_placeholder').remove();
        $this.$loadAnimationBl=$('.wall_load_old_items');
        $this.$loadAnimation=$('#load_animation');
        $this.$wallNoItems=$('#wall_no_items');
        $this.$feedComment=$('#wall_item_comment_clone').clone();
        $('#wall_item_comment_clone').remove();
        $this.initGoTo();
        $this.initAddImage();

        $jq('body').on('click', function(e){
            $this.hideMoreMenu(e);
        })
    }

    this.hideMoreMenu = function(e){
        var $targ=$(e.target);
        if(!$targ.closest('.bl_wall')[0])return;
        if(e){
            if($targ.is('.more_menu_collapse')||$targ.closest('.more_menu_collapse')[0]){
                return;
            }
        }
        $('.more_menu_collapse.in', '.bl_wall').collapse('hide');
    }

    this.updaterTimer = false;
    this.stopUdater = false;
    this.autoUpdateTimeout = 10000;
    this.updaterInit = function(){
        console.log('clWall.updaterInit');
        if ($this.stopUdater)return;
        $this.singleItemMode = false;
        clearTimeout($this.updaterTimer);
        $this.updaterTimer = setTimeout($this.updater, $this.autoUpdateTimeout);
    }

    this.updater = function() {
        if ($this.stopUdater) return;
        clearTimeout($this.updaterTimer);
		$this.setPostIdMax($this.firstPostId);

		var url='wall_ajax.php?cmd=update&last_item_id='+$this.getPostIdMax()+'&wall_uid='+$this.uid,
            data={//last_comment_id: $this.itemComments[$this.OnePostId]||0,
				  items: $this.itemsInfo,
                  comments: $this.commentsCache,
                  is_see:$this.onlySeeFriends,
                  is_profile_wall:$this.isProfileWall,
                  type_wall:'friends'};
		$.post(url,data, function(res){
            if($this.stopUdater)return;
            var items=$this.checkDataAjax(res,1);
            if(items && (items=trim(items))){
                //$this.checkToSeeWall(items);
                if(items!='no'&&items!='no_post')$this.updateItems(items);
                var $html=$(items), $liked=$html.filter('.who_liked');
                if($liked[0]){
                    $liked.each(function(){
                        $this.likeChange(this.id,$(this))
                    })
                }
                var $comments=$html.filter('.wall_item_one_comment');
                if ($comments[0]){
                    //console.log('UPDATE COMMENTS',$comments);
                    return;
                    var $comment,i=0;
                    (function fu(){
						$comment=$comments.eq(i);
						if(!$comment[0]){
							return;
						}
                        var send=$comment.data('send');
						if (!$('#'+$comment[0].id)[0] && !$('#wall_item_comment_'+send)){
                            var id=$comment.data('post'),cid=$comment[0].id.replace('wall_item_comment_', ''),
                                fn=$this.itemComments[id]>cid?'appendTo':'prependTo';
                            $this.addCommentToBl($comment, id, fn, function(){
                                i++;fu();
                            })
						}else{
                            i++;fu();
                        }
					})()
                }
            }
            $this.updaterInit();
        })
    }


    this.initAddImage = function(){

        $this.addImageWall=$('#add_image_wall');
        $this.addImageUploadWall=$('#add_image_upload_wall');

        $('#wall_frm_upload_image').submit(function(e){
            var frm = $(this), file = frm.find('input[type=file]'),
                fileName = file.attr('name'), formData = new FormData(),
                error = '';
                $.each(file[0].files, function(i, file){
                    if ("image/jpeg,image/png,image/gif".indexOf(file.type) === -1) {
                        error = $this.langParts['accept_file_types'];
                        return false;
                    }else if (file.size > $this.maxFileSize) {
                        error = $this.langParts['max_file_size'];
                        return false;
                    }
                    formData.append(fileName, file);
                });
                if (error) {
                    console.log('ERRROR', error);
                    //customShowTip('#add_image_wall','null',error,'.footer',7);
                    return false;
                }
                $this.processUploadImage=true;
                $this.addImageWall.hide();
                $this.$itemAddLoader.removeClass('hidden');

                var xhr = new XMLHttpRequest();
                xhr.open("POST", url_ajax+'?cmd=upload_image_wall&input_name=' + fileName);
                xhr.onreadystatechange = function() {
                    if (xhr.readyState == 4) {
                        if(xhr.status == 200) {
                            var data = xhr.responseText;
                            data = checkDataAjax(data);
                            if (data) {
                                $this.$itemAddLoader.addClass('hidden');
                                $this.processUploadImage = false;
                                if (data!='complete_upload_image') {
                                    $this.addImageWall.show();
                                    //customShowTip('#add_image_wall','null',error,'.footer',7);
                                } else {
                                    $this.addImageUploadWall.show();
                                    $this.isImageLoaded=true;
                                }
                            }
                        }
                    }
                };
                xhr.send(formData);
                return false;
        });
    }

    this.changeUploadImage = function($file) {
        $file.parent('form').find('input[type=submit]').click();
    }

    this.clickUpload = function($file) {
        $file.next('input[type=reset]').click();
    }

    this.clearUploadImage = function(){
        $this.processUploadImage=false;
        $this.isImageLoaded=false;
        $this.addImageUploadWall.hide();
        $this.addImageWall.show();
    }

    this.initGoTo = function(){
        var durGo='500ms', goTop=$('#wall_up')[0], wCont=$('#wall_items')[0],
        top=0, lastTop=0, scrolling, hidden=1, lastPos=0,
		transform=('webkitTransform' in document.body.style)?'webkitTransform':'transform',
		transition=('transition' in document.body.style)?'transition':'webkitTransition';
        var onresize=function(){
            top=$jq('body').scrollTop();
            if (!scrolling && wCont.offsetHeight<500+window.innerHeight) {
                goTop.style[transition]=hidden++?'none':0;
                goTop.style[transform]='translateY('+(lastPos=top>300?-window.innerHeight-105:0)+'px)';
                return
            }
            var pos=183, dur=durGo;
            if ((top)>500) {
			if (!scrolling) lastTop=top;
			var d=window.innerHeight-wCont.getBoundingClientRect().bottom+20;
			if (goTop.className) {goTop.className=''; goTop.title=l('to_the_top')};
			if (hidden) {pos=d>10?window.innerHeight+105:0};
			if (d>70) {pos=d+100; dur=hidden?durGo:'none'};
			hidden=0;
            }else if (top<200 && !goTop.className && lastTop) {
			goTop.className='down'; goTop.title=l('to_the_post_last_read');
            } else if (!goTop.className&&!scrolling) {pos=lastTop=0; hidden=0}
            if (pos==lastPos) return;
            goTop.style[transition]='all '+dur+', left 0s';
            goTop.style[transform]='translateY(-'+(lastPos=pos)+'px)';
        }
        $jq('body').on('scroll', onresize);
        $win.on('resize', onresize);
        $(goTop).click(function() {
            scrolling=1
            $('body, html').stop().animate({scrollTop:lastTop*$(goTop).is('.down')}, parseInt(durGo), function(){scrolling=0})
        })
    }

    this.initStyle = function(){
        var fn=function(){
            var w=$jq('#wall_items').width();
            $jq('#wall_custom_style')[0].innerHTML=[
                ".wall_video_post .one_media_vimeo, .video-js, .video_native, .video-js object, .video_native object{height:", Math.round(w/1.777777), "px;}",
                ".wall_video_post .one_media_youtube, .wall_video_post .one_media_metacafe{height:", Math.round(w/1.24675), "px;}",
                ".comment_text_cont .one_media_vimeo{height:", Math.round((w-80)/1.777777), "px;}",
                ".comment_text_cont .one_media_youtube, .comment_text_cont .one_media_metacafe{height:", Math.round((w-80)/1.24675), "px;}",
                ].join("");
        }
        fn();
        //getEventOrientation()
        //getTimeOrientation();
        $win.on('resize', function(){setTimeout(fn,1)});
    }

    this.postIdMax = 0;
    this.setPostIdMax = function(id){
		if(id > $this.getPostIdMax()) {
			$this.postIdMax = id;
		}
	}

    this.getPostIdMax = function(){
		return $this.postIdMax;
	}

    $this.lastPostId = 0;
    this.setPostLastId = function(id){
		$this.lastPostId=id;
	}

    this.firstPostId = 0;
    this.setPostFirstId = function(id){
		$this.firstPostId=id;
	}

    this.isAuthOnly = function(value) {
		if (value == 'please_login') {
			redirectToLoginPage();
			return false;
		}
		return true;
	}

    this.isBlocked = function(value) {
		if(trim(value) == 'you_are_blocked') {
			alertCustom(MSG_YOU_ARE_IN_BLOCK_LIST);
			return true;
		}
		return false;
	}

    this.checkDataAjax = function(data, isCheckBlocked) {
        isCheckBlocked=isCheckBlocked||0;
        data=getDataAjax(data);
        if(data){
            if (!$this.isAuthOnly(data)) {
                return false;
            }
            if(!isCheckBlocked&&$this.isBlocked(data)) {
                return false;
            }
            return data;
        }else{return false}
    }


    this.preparePost = function() {
        return $this.$placeholder.clone().hide().attr('id', '')
               .prependTo($this.wallItems).addClass('prependTo');
    }

    //this.sendAjaxAdd=0;
    this.isImageLoaded=false;
    this.processUploadImage=false;
    this.itemAdd = function() {
        var post=$.trim($this.inputPostAdd.val());
        if($this.processUploadImage)return false;
        if(!post&&!$this.isImageLoaded)return false;

        $this.inputPostAdd.val('').trigger('autosize');
        $this.setPostIdMax($this.firstPostId);

        $this.$wallNoItems.slideUp(300);
        var $itemTemp=$this.preparePost(),$preview=$('.timeline-wrapper', $itemTemp),
        $item=[], isUpdateItem=false,
        fnUpdateItem=function(){
            if(!$item[0]||!isUpdateItem)return;
            isUpdateItem=false;
            var $next=$itemTemp.nextAll('.wall_post_item').eq(0).addClass('add_shadow_top');
            $preview.addClass('to_hide');
            var $itemUpdate=$('<div class="wall_post_item_update">').html($item.html())
            .appendTo($itemTemp).oneTransEnd(function(){
                $preview.remove();
                $itemUpdate.removeClass('wall_post_item_update to_show');
            }).toggleClass('to_show',0);
            console.log($itemUpdate.height()+20);
            $itemTemp.attr({id:$item[0].id, 'data-id':$item.data('id')})
                     .data('id',$item.data('id'))
                     .stop().animate({height: $itemUpdate.height()+20}, $this.dur, function() {
                                $this.checkTop();
                                $itemTemp.removeAttr('style');
                                $next.removeClass('add_shadow_top');
                            });
        }
        $itemTemp.data('call',function(){
            isUpdateItem=true;
            fnUpdateItem();
        });
        $this.checkTop();
//return;
        //wall_video_post = 588/472 = 1.25
        //wall_one_video = 640/360 = 1.78
        //one_media_metacafe = 480/385
        //one_media_youtube = 480/385
        //one_media_vimeo = 400/225
        //return false;
        var url = 'wall_ajax.php?cmd=item&last_item_id='+$this.getPostIdMax()+'&wall_uid='+$this.uid,
            data={comment:post,
                  image_upload:$this.isImageLoaded}
		$.post(url, data, function(res) {
            var item=$this.checkDataAjax(res);
            if(item && item != 'empty comment'){
                var $data=$(trim(item));
                $this.$scriptUpdate.append($data.filter('script'));
                var $itemRes=$data.filter('div.wall_post_item').imagesLoaded(function(){
                    $item=$itemRes;
                    if(isUpdateItem)fnUpdateItem();
                })
            }
		})

        $this.clearUploadImage();
        return false;
	}

    this.checkTop = function() {
		if ($this.wallItems.offset().top-$jq('.navbar').height()>0 && !$('.wall_post_item:animated')[0]) {
            $('.wall_post_item.prependTo:hidden:last').slideDown($this.dur, function(){
                var call=$(this).removeClass('prependTo').data('call');
                if(typeof call=='function')call()
                $this.checkTop();
            }).scrollTop(5000);
		}
	}

    this.updateItems = function(data, insertFn, order, isPasteScript) {

        insertFn=insertFn||'prependTo';
        isPasteScript=isPasteScript||0;
        order=order||0;

        var $html=$(trim(data)),
            $items=$html.filter('div.wall_post_item'), t=$this.dur, $item, i=0;
        if(!isPasteScript)$this.$scriptUpdate.append($html.filter('script'));

        if (!order) {
            i=$items.length-1;
        }

        (function fu(){
			$('.bl_post_wall_items .add_shadow').removeClass('add_shadow')
            $item=$items.eq(i);
            if(!$item[0]){
                if(insertFn=='appendTo')$this.scrollBlock=false;
                return;
            }; if(!order)i--; else i++;
            if (!$('#'+$item[0].id)[0]){
                $item.hide()[insertFn]($this.wallItems).addClass(insertFn);
                $this.showNoItem();
				$item.prev().addClass('add_shadow');
                fu();
                $this.setLastItem();
            } else {fu()}
        })()

		if (insertFn=='prependTo') {
            $this.checkTop();
        } else {
            $this.showHistory($this.dur);
        }
    }

    this.setLastItem = function() {
        return;
        $('.wall_item').removeClass('last').last().addClass('last');
    }

    this.showNoItem = function() {
        $this.$wallNoItems[$('.wall_post_item')[0]?'slideUp':'slideDown']();
    }

    this.showHistory = function(dur) {
        dur*=.7;
        $('.wall_post_item.appendTo:hidden:first').slideDown(dur, function(){
            $(this).removeClass('appendTo');
            $this.showHistory(dur);
        }).scrollTop(5000);
	}

    /* History load */
    this.itemsHistoryLoadItems = function() {
        if ($this.stopUdater) return;
		$this.setPostIdMax($this.firstPostId);

        $this.$loadAnimation.addClass('to_show');

		var url = 'wall_ajax.php?cmd=items_old&id=' + $this.lastPostId + '&wall_uid=' + $this.uid
                  + '&is_see=' + $this.onlySeeFriends+ '&is_profile_wall='+$this.isProfileWall;
		$.get(url, function(res){
            $this.$loadAnimation.removeClass('to_show');
            var items=$this.checkDataAjax(res,1);
            if(items && (items=trim(items))){
                $this.updateItems(items, 'appendTo', 1);
            }
		})
	}

	this.itemsHistoryLoad = function() {
        $(function(){
            $jq('body').scroll(function() {
                if ($this.stopUdater)return false;
                var d=$doc.height()- $win.height() - $this.scrollDelta - $jq('.cham-footer-style-3').height();
                if ($this.oldItemsExists && !$this.scrollBlock && ($jq('body').scrollTop() > d)) {
                    $this.scrollBlock = true;
                    $this.itemsHistoryLoadItems();
                }
                $this.checkTop();
            })
        })
	}
    /* History load */

    /* Comments */
    this.itemComments = [];
    this.itemCommentsFirst = [];
    this.commentsCache = {};
    this.commentsVisible=[];
    this.commentsCacheAdd = function(id, cid) {
		if (!$this.commentsCache[id]) {$this.commentsCache[id]={}; $this.commentsVisible[id]=0}
		if ($this.commentsCache[id][cid]) return;
		$this.commentsVisible[id]++;
		$this.commentsCache[id][cid] = cid;
        if(!$this.itemComments[id]){
            $this.itemComments[id]=cid;
        }
        $this.itemComments[id]=Math.min($this.itemComments[id], cid)
        if(!$this.itemCommentsFirst[id]){
            $this.itemCommentsFirst[id]=cid;
        }
		$this.itemCommentsFirst[id]=Math.max($this.itemCommentsFirst[id], cid)
	}

    this.commentsCacheRemoveById = function(id) {
		delete $this.commentsCache[id];
	}

    this.itemCommentsSet = function(id, cid) {
        console.log('itemCommentsSet', $this.itemComments[id]);
		$this.itemComments[id] = cid;
	}

    this.itemExists = function(id, value) {
		var exists = true;
        if (value=='server_error') {
            console.log('SERVER ERROR');
            return false;
        }
		if (value=='not exists'||value=='deleted') {
			var $el=$('#wall_item_' + id);
			if (!$el[0]) return exists=false
			/*if (value=='deleted'){
                //$(('.feed_share_'+($el[0]||{}).className).replace('wall_shared_', ''))
                //.removeClass('shared').show(dur); // показываем кнопку "поделиться" у оригинала, если удалена зашареная запись
            }
*/
			var $els=$el.add('#wall_item_' + id+'~.wall_post_item'),
                $sh=$el.prev().addClass('add_shadow'),
                h=$el.height();
            $el.css({zIndex:0});

			if ($this.wallItems[0].getBoundingClientRect().bottom<$win.height()+h-50) {
                $el.oneTransEnd(function(){
                    $sh.removeClass('add_shadow');
                    $el.remove();
                    $this.showNoItem();
                }).css({marginTop: -h, transition: $this.dur+'ms'})
            } else {
                $els.last().oneTransEnd(function(){
                    $sh.removeClass('add_shadow');
                    $el.remove();
                    $els.css({transform: '', transition: '', marginTop: ''});
                    $this.showNoItem();
                },'transform').end().css({transform: 'translateY(-'+h+'px)', transition: $this.dur+'ms'})
            }
			$this.itemInfoDelete(id);
			exists = false;

			$this.itemInfoDelete(id);
			exists = false;
		}

		return exists;
	}

    this.getShowCommentClass = function() {
        return isMobile() ? 'to_hide_wall_mobile' : 'to_hide_wall';
    }

    this.addCommentToBl = function($comment, id, fn, call) {
        fn=fn||'appendTo';
        var $blComments=$('#wall_item_comments_'+id), cl=$this.getShowCommentClass();
        $this.showComment($comment.addClass(cl)[fn]($blComments),$blComments,call);
    }

    this.showComment = function($el,$blComments,call) {
        if (isMobile()) {
            $el.oneTransEnd(function(){
                $el.addClass('vis');
                $el.removeClass('to_hide_wall_mobile to_show_wall_mobile');
                if(typeof call=='function')call();
            }).toggleClass('to_show_wall_mobile',0);
        }else{
            setTimeout(function(){
            var h=$el.find('.comment_item_wrapper').outerHeight(true),
                css={height:h, opacity:1};
            $el.oneTransEnd(function(){
                $el.addClass('vis')
                $el.removeClass('to_hide_wall');
                $el.removeAttr('style');
                if(typeof call=='function')call();
                //$this.scrollTo($('#comments_replies_post_'+replyCid));
            }).css(css);
            },10)
        }
    }

    this.commentsLoadBlock = [];
    this.commentsLoad = function(id) {
		if ($this.commentsLoadBlock[id]) {
			return;
		} else {
			$this.commentsLoadBlock[id] = true;
		}
        var $loaderBl=$('#wall_load_more_comments_title_'+id).addChildrenLoader(),
            data={id:id, last_id:$this.itemComments[id], wall_uid:$this.uid};
		$.post('wall_ajax.php?cmd=comments_load', data , function(data){
            data=$this.checkDataAjax(data);
            var $blComments=$('#wall_item_comments_'+id);
            if (data && $blComments[0]) {
                var $data=$(data),
                    $comments=$data.find('.bl_comments > .item');
                    $('script.item_script', $data).appendTo($this.$scriptUpdate);
                    if ($comments[0]) {
                        var $comment,i=0,t=0;
                        (function fu(){
                            $comment=$comments.eq(i);
                            if(!$comment[0])return;
                            if(!$('#'+$comment[0].id)[0]){
                                $this.addCommentToBl($comment, id)
                            }//else{
                                i++;fu();
                            //}
                        })()
                    }
            }
            $loaderBl.removeChildrenLoader();
            $this.commentsLoadBlock[id] = false;
        })
	}

    this.visibleCommentsCounter = function(id,count) {
        count *=1;
        var $counterBl=$('#wall_comments_count_' + id),
            $counter=$counterBl.find('.comments_count');

        if($counterBl.data('count')==count) return;
        $counterBl.data('count',count);
        if(count){
            $counter.text(count);
            $counterBl.is('.to_hide')&&$counterBl.removeClass('to_hide');
        } else if(!$counterBl.is('.to_hide')) {
            $counterBl.oneTransEnd(function(){
                if(!$counterBl.data('count'))$counter.text(count);
            }).addClass('to_hide');
        }
    }

    this.commentsLoadMoreStatus = function(id, count, isViewed) {
		var $itemLoadMore = $('#wall_load_more_comments_' + id),
            q=count-($this.commentsVisible[id]||0),
            dur=$this.dur;
        $this.visibleCommentsCounter(id,count);
		if (q>0) {
            if (typeof isViewed != 'undefined' && isViewed != '') {
                $itemLoadMore[isViewed == 1?'addClass':'removeClass']('to_new');
            }
            if ($itemLoadMore.stop().slideDown(dur).data('q')==q) return;
            $itemLoadMore.data('q',q);
            if (q > 1){
                $('.more_title',$itemLoadMore).html(l('load_more_comments')).children('span').html(q);
            } else {
                $('.more_title',$itemLoadMore).html(l('load_more_comment_one'));
            }
		} else {
			$itemLoadMore.stop().slideUp(dur);
		}
	}
    /* Comments */
    /* Like */
    this.likeChange = function(id,$cont) {
        var $blLikes=$('#'+id);
        if(!$blLikes[0]||$blLikes.is('.animate'))return;
        $blLikes.addClass('animate');
        var id0=id.replace('feed_like_result_','');
        if(!$cont[0]){
            $this.itemsInfo[id0].listLikeUser='';
        }
        $('#feed_like_'+id0)[$this.itemsInfo[id0].listLikeUser.indexOf($this.guid) === -1?'removeClass':'addClass']('wall_like_hidden');
        if(!$cont[0]||!$this.itemsInfo[id0].listLikeUser){
            $blLikes.slideUp($this.dur,function(){
                $blLikes.removeClass('animate');
                $blLikes.find('.who_liked_bl').empty();
            });
            return;
        }

        var $el=$cont.find('.who_liked_bl');

        if($blLikes.is(':hidden')){
            $blLikes.find('.who_liked_bl').html($el.html()).end().slideDown($this.dur,function(){
                $blLikes.removeClass('animate');
            })
        }else{
            var $blF=$blLikes.find('.who_liked_bl:last').addClass('to_top')
                    .delay(1).toggleClass('to_top to_state_op',0);
            $blLikes.prepend($el.addClass('to_top_op').delay(1)
            .oneTransEnd(function(){
                $blF.remove();
                $el.removeClass('to_state');
                $blLikes.removeClass('animate');
            }).toggleClass('to_top_op to_state',0));
        }
    }

    this.likeAddAjax={};
    this.likeAdd = function(id, $link,cmd) {
		$link=$link||$('#feed_like_hand_' + id);
        if($this.likeAddAjax[id])return;
        $this.likeAddAjax[id]=true;
        $link.addChildrenLoader();

        var data={id:id,wall_uid:$this.uid};
        cmd=cmd||'like';
		$.post('wall_ajax.php?cmd='+cmd,data, function(data){
            $link.removeChildrenLoader();
            data=$this.checkDataAjax(data);
            if(data && $this.itemExists(id, data)){
                var $likes=$(data).filter('.who_liked');
                $this.$scriptUpdate.append($(data).filter('script'));
                $this.likeChange('feed_like_result_'+id,$likes);
            }
            $this.likeAddAjax[id]=false;
        })
	}

	this.likeDelete = function(id, $link) {
        $this.likeAdd(id, $link, 'unlike');
	}
    /* Like */
    /* Delete */
    this.confirmItemDelete = function(id) {
        if ($this.stopUdater) return;
        confirmCustom(l('are_you_sure'), function(){$this.itemDelete(id)}, l('confirm_delete_post'));
        $('#wall_item_more_menu_'+id).closest('.more_menu_collapse').collapse('hide');
    }

    this.itemDelete = function(id) {
        if ($this.stopUdater) return;
        $this.itemExists(id, 'deleted');
		var url = 'wall_ajax.php?cmd=item_delete&id='+id+'&wall_uid='+$this.uid;
		$.post(url, $this.checkDataAjax);
		return false;
	}
    /* Delete */
    /* Comment */
    this.scrollTo = function($el,h){
        h=h||$el.height();
        var top=$el.offset().top,wh=$win.height(),
            d=top+$jq('body').scrollTop()+h-wh+12,
            d1=ajax_login_status ? $('.navbar').height() : 0;
        if((top+d1)<wh)return;
        $('body, html').stop().animate({scrollTop:d},300,'easeOutCubic');
    }

    this.initFeedComment = function(id,fn) {
        var $inp=$(id);
        if(!$inp[0])return;
        if(typeof fn!='function')fn=$this.commentAdd;
        $inp.autosize({isSetScrollHeight:false,callback:function(){}}).keydown(doOnEnter(fn));
    }

    this.initFeedCommentReplies = function(id) {
        $this.initFeedComment('#wall_comment_area_replies_'+id,$this.commentAddReplies)
    }

    this.commentAddReplies = function(inp) {
        var $inp=$(inp),comment=trim($inp.val());
        if(!comment){
            $inp.val('').trigger('autosize').focus();
            return false;
        }
    }

    this.commentAdd = function(inp) {
        var $inp=$(inp),comment=trim($inp.val());
        if(!comment){
            $inp.val('').trigger('autosize').focus();
            return false;
        }

        var section=$inp.data('section'),
            param=$inp.data('param'),
            param_user=$inp.data('param_user'),
            send = +new Date,
            id=inp.id.replace('wall_comment_area_', ''),
            //lastId=$this.itemComments[id]?$this.itemComments[id]:0,
            url = 'wall_ajax.php?cmd=comment&id='+id+'&wall_uid='+$this.uid,//'&last_id='+lastId+

            $comment=$this.$feedComment.clone().attr({id:'wall_item_comment_'+send,'data-post':id}).data('post',id),
            $node=$comment.find('.comment_text_cont').html(strToHtml(comment));

        $inp.val('').trigger('autosize',function(){
            $this.addCommentToBl($comment, id, 'prependTo')
        })
        var $linkDelete=$comment.find('.comm_tick').addClass('to_hide');

        comment=emojiToHtml(comment);
        if (section == 'vids') {
            param = 'v_'+param;
        }
        var data={comment:comment,send:send,section:section,photo_id:param,photo_user_id:param_user};
        console.log(data);
        //return false;
        $.post(url,data,function(res){
            var data=$this.checkDataAjax(res);
            if(data && $this.itemExists(id, data)){
                var $rComm=$(data).filter('.wall_item_one_comment');
                if ($rComm[0]) {
                    $this.$scriptUpdate.append($rComm.find('script'));

                    var cid=$rComm[0].id.replace('wall_item_comment_', '');
                    $comment[0].id=$rComm[0].id;
console.log(cid);
                    $linkDelete.find('ul').attr('id', 'wall_item_comment_more_menu_'+cid);
                    $linkDelete.find('.icon_chevron_down').attr('data-target', '#wall_item_comment_more_menu_'+cid)
                               .data('target', '#wall_item_comment_more_menu_'+cid);
                    $linkDelete.find('a').click(function(){
                        $this.confirmCommentDelete(id, cid);
                        return false;
                    })
                    $linkDelete.removeClass('to_hide');
                    $comment.find('.comments_replies_post').attr('id', 'wall_feed_comment_replies_'+cid);
                    $comment.find('textarea').attr('id', 'wall_comment_area_replies_'+cid);

                    $this.initFeedCommentReplies(cid);

                    $comment.find('.comment_action_list_reply').click(function(){
                        console.log(11111111111, cid);
                        $this.commentShow(cid, true);
                        return false;
                    })

                    $comment.find('.comment_action_list').removeClass('to_hide');


                    var $text=$rComm.find('.comment_text_cont').addClass('wrap'),
                        txt=$text.html();
                    if(txt!=$node.html()){
                        var h=$node.height();
                        $node.height($node.height());
                        $text.insertAfter($node).imagesLoaded(function(){
                            var h1=$text.height();
                            $text.height(h).removeClass('wrap').stop().animate({height: h1}, $this.dur, function() {
                                $text.removeAttr('style');
                            });
                            $node.remove();
                        })
                    }
                }else{
                    // удалить коммент
                }
            } else {
                // удалить коммент
            }
            return;
        })

        return false;
	}

    this.commentShow = function(id, replies) {
        replies=replies||0;

        var $frmReply=$('#wall_feed_comment_'+(replies?'replies_':'')+id);
        if(!$frmReply[0])return;

        var isHidden=$frmReply.is(':hidden'),d=0,dl=isIE ? 20 : 5,
            $input=$('textarea',$frmReply);

        var name='', nameMy;
        if (replies) {
            nameMy=$frmReply.find('.photo > a').attr('title') + ' ';
            name=$frmReply.closest('.comment_item_wrapper').find('.photo > a').attr('title') + ' ';
            if(nameMy==name)name='';
        }
        $input.val(name);
        enterCaret($input[0],'');

        var isMob=isMobile();
        if (isMob) {
            $win.one('resize',function(){
                $this.scrollTo($frmReply)
            })
        }
        if (isHidden) {
            $frmReply.animate({opacity:'toggle', height:'toggle', margin:'toggle'},
                                 {duration:$this.dur*.5,specialEasing:{opacity:'linear'},
                                  step:function(h,fx){
                                        if(!isMob && fx.prop=='height' && (h-d) > dl){
                                            $this.scrollTo($frmReply,h)
                                            d=h;
                                        }
                                  },
                                  complete:function(){
                                      $input.trigger('autosize').focus();
                                  }})
        } else {
            if (!isMob) {
                $this.scrollTo($frmReply)
            }
            $input.trigger('autosize').focus();
        }
        return;
	}

    this.confirmCommentDelete = function(id,cid) {
        if ($this.stopUdater) return;
        confirmCustom(l('are_you_sure'), function(){$this.commentDelete(id,cid)}, l('confirm_delete_comment'));
        $('#wall_item_comment_more_menu_'+cid).closest('.more_menu_collapse').collapse('hide');
    }

    this.commentDelete = function(id, cid) {
        var data={id:id, cid:cid, last_id:$this.itemComments[id], wall_uid:$this.uid};
        $this.commentHide(id, cid);
		$.post('wall_ajax.php?cmd=comment_delete',data,function(res){
            var data=$this.checkDataAjax(res);
            if(data && $this.itemExists(id, data)){
                var $data=$(data);
                $this.$scriptUpdate.append($data.filter('script'))
                var $comment=$data.filter('.wall_item_one_comment');
                if($comment[0]){
                    $this.addCommentToBl($comment, id)
                }
            }
        })

		return false;
	}

    this.commentHide = function(id, cid) {
        var $el=$('#wall_item_comment_' + cid);
        if(!$el[0]||$el.is('.trans'))return;
        $el.addClass('trans');

        /*var $sh=$el.prev().addClass('add_shadow_comm'),*/
        var h=$el.find('.comment_item_wrapper').outerHeight(true);
		//$el.css({overflow:'hidden'}).animate({height:0,opacity:0}, $this.dur, function(){
            //$el.remove()
        //});
        $el.height(h).addClass('to_remove').oneTransEnd(function(){
            $el.remove();
        },'height').delay(10).toggleClass('to_remove_end',0)

        $this.itemsInfo[id].commentsCount--;
		$this.commentsLoadMoreStatus(id, $this.itemsInfo[id].commentsCount);
    }

    this.commentDeleteFromPage = function(id, cid) {
		if (!$this.commentsCache[id][cid]) return;
        console.log('clWall.commentDeleteFromPage', id, cid);
        $this.commentHide(id, cid);
		$this.commentsCacheRemoveByCid(id, cid);
	}
    /* Comment */


	$(function(){
        $this.init();
	})

	return this;
}

Youez - 2016 - github.com/yon3zu
LinuXploit