<commit_before>$.fn.giftCombo = function (option) {
    option = option || {}
    var classIn = option.classIn || 'gift-combo-in'
    var classOut = option.classOut || 'gift-combo-out'
    // var oneGift =  option.oneGift || new Function
    // var oneCombo = option.oneCombo || new Function
    // var allCombo = option.allCombo || new Function
    var transitionEffects = null
    var $this = $(this)
    var combo = 0
    var that = this
    this.giftQueue = []
    this.isGifting = false

    function allTransitionEnd () {
        for (var key in transitionEffects) {
            if (transitionEffects.hasOwnProperty(key) && transitionEffects[key] === false) {
                return false;
            }
        }
        return true;
    }
    $this.on('transitionend', function (e) {
        // all transition end

        if (!transitionEffects) {
            transitionEffects = {}
            var style = window.getComputedStyle($this[0], null)
            var properties = style.getPropertyValue('transition-property').split(', ')
            $.each(properties, function (index, property) {
                transitionEffects[property] = false
            })
            if (transitionEffects[e.originalEvent.propertyName] !== undefined) {
                transitionEffects[e.originalEvent.propertyName] = true;
            }
        }

        console.log(transitionEffects)
        if (allTransitionEnd()) {
            transitionEffects = null
            if ($this.hasClass(classIn) && !$this.hasClass(classOut)) {
                $this.removeClass(classIn).addClass(classOut)
            } else if ($this.hasClass(classOut) && !$this.hasClass(classIn)) {
                that.giftQueue[0].count--
                $this.css('transition', 'none')
                $this.removeClass(classOut)
                $this[0].clientWidth
                $this.css('transition', '')
                gifting()
            }

        }
    })
    function gifting () {
        if (that.giftQueue.length) {
            if (that.giftQueue[0].count) {
                combo++
                $this.text(combo)
                $this.addClass(classIn)
            } else {
                combo = 0
                that.giftQueue.shift()
                gifting()
            }
        } else {
          	$this.text('')
            that.isGifting = false
        }
    }

    this.send = function (data) {
        this.giftQueue.push(data)
        if (!this.isGifting) {
            this.isGifting = true
            gifting()
        }
    }
    return this
}

var $giftTrigger = $('#gift-trigger')
var $giftCombo = $('#gift-combo').giftCombo({
    // oneGift: function (data) {
    //     console.log(data)
    // },
    // oneCombo: function (data) {
    //     console.log(data)
    // },
    // allCombo: function (data) {
    //     console.log(data)
    // }
})
$giftTrigger.on('click', function () {
    var data = {
        count: 0 | Math.random() * 5 + 3,
        // name: ['张三', '李四', '王五', '赵六'][0 | Math.random() * 4]
    }
    $giftCombo.send({
        count: data.count
    })
})
<commit_msg>animation instead of transition<commit_after>$.fn.giftCombo = function (option) {
    option = option || {}
    var classActive = option.classActive || 'gift-combo-active'
    // var oneGift =  option.oneGift || new Function
    // var oneCombo = option.oneCombo || new Function
    // var allCombo = option.allCombo || new Function
    var $this = $(this)
    var combo = 0
    var that = this
    this.giftQueue = []
    this.isGifting = false

    $this.on('animationend', function (e) {
        if ($this.hasClass(classActive)) {
            that.giftQueue[0].count--
            $this.removeClass(classActive)
            $this[0].clientWidth
            gifting()
        }
    })
    function gifting () {
        if (that.giftQueue.length) {
            if (that.giftQueue[0].count) {
                combo++
                $this.text(combo)
                $this.addClass(classActive)
            } else {
                combo = 0
                that.giftQueue.shift()
                gifting()
            }
        } else {
          	$this.text('')
            that.isGifting = false
        }
    }

    this.send = function (data) {
        this.giftQueue.push(data)
        if (!this.isGifting) {
            this.isGifting = true
            gifting()
        }
    }
    return this
}

var $giftTrigger = $('#gift-trigger')
var $giftCombo = $('#gift-combo').giftCombo({
    // oneGift: function (data) {
    //     console.log(data)
    // },
    // oneCombo: function (data) {
    //     console.log(data)
    // },
    // allCombo: function (data) {
    //     console.log(data)
    // }
})
$giftTrigger.on('click', function () {
    var data = {
        count: 0 | Math.random() * 3 + 3,
        // name: ['张三', '李四', '王五', '赵六'][0 | Math.random() * 4]
    }
    $giftCombo.send({
        count: data.count
    })
})

{'fraction_non_alphanumeric': 0.14256825075834176, 'fraction_numerical': 0.004246713852376138, 'mean_word_length': 1.6266595857673924, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '858919', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1511, 'n_words': 285}