Вход Регистрация
Файл: static/plugins/base/js/avatar_user_select.js
Строк: 60
<?php
var AvatarUserSelect = function( list, contextId ){
    
this.list = list;
    
this.resultList = [];
    
this.$context = $('#'+contextId);
}

AvatarUserSelect.prototype = {
    
init: function(){
        var 
self this;
        $.
eachthis.list,
            function(
indexdata){
                $(
'#'+data.linkId).click(
                    function(){
                        var 
uai self.findIndex(data.userId);
                        if( 
uai == null ){
                            
self.resultList.push(data.userId);
                            $(
this).addClass('peep_mild_green');
                        }else{
                             
self.resultList.splice(uai1);
                            $(
this).removeClass('peep_mild_green');
                        }

                        var 
$countNode = $('div.count_label'self.$context);

                        if( 
$countNode.length )
                        {
                            
$countNode.html($('input.count_label'self.$context).val().replace("#count#"self.resultList.length));
                        }

                        $( 
'.submit_cont input'self.$context ).val($('input.button_label').val().replace("#count#"self.resultList.length));

                    }
                );
            }
        );

        $(
'input.submit',this.$context).click(function(){
            
self.submit();
        });
    },

    
findIndex: function( value ){

        for( var 
0this.resultList.lengthi++){
            if( 
value == this.resultList[i] ){
                return 
i;
            }
        }
        return 
null;
    },

    
reset: function(){
        $(
'a.selected'this.$context).removeClass('selected');
        
this.resultList = [];
    },

    
submit: function(){
        if( 
this.resultList.length == )
        {
            
PEEP.warning(PEEP.getLanguageText('base''avatar_user_select_empty_list_message'));
            return;
        }
        
PEEP.trigger('base.avatar_user_list_select', [this.resultList]);
    }
}
?>
Онлайн: 1
Реклама