<commit_before>package net.yested.ext.jquery

import jquery.JQuery
import jquery.jq
import net.yested.core.utils.setChild
import org.w3c.dom.HTMLElement

@native fun JQuery.fadeOut(duration: Int, callback:()->Unit): JQuery = noImpl;
@native fun JQuery.fadeIn(duration: Int, callback:()->Unit): JQuery = noImpl;
@native fun JQuery.slideUp(duration: Int = 400, callback:(()->Unit)? = null): JQuery = noImpl
@native fun JQuery.slideDown(duration: Int = 400, callback:(()->Unit)? = null): JQuery = noImpl
@native fun JQuery.show(callback:()->Unit): JQuery = noImpl;
@native fun JQuery.hide(callback:()->Unit): JQuery = noImpl;
@native fun JQuery.children(selector: String): JQuery = noImpl

fun JQuery.slideUpTableRow(duration:Int = 400, callback:(()->Unit)? = null): JQuery {
    var callbackDone = false
    return children("td").slideUp(duration).children("*").slideUp(duration) {
        if (!callbackDone) { callbackDone = true; callback?.invoke() }
    }
}

fun JQuery.slideDownTableRow(duration:Int = 400, callback:(()->Unit)? = null): JQuery {
    var callbackDone = false
    return children("td").slideDown(duration).children("*").slideDown(duration) {
        if (!callbackDone) { callbackDone = true; callback?.invoke() }
    }
}

private val DURATION = 200
private val SLIDE_DURATION = DURATION * 2

interface Effect {
    fun apply(htmlElement: HTMLElement, callback: Function0<Unit>? = null)
}

interface BiDirectionEffect {
    fun applyIn(htmlElement: HTMLElement, callback: Function0<Unit>? = null)
    fun applyOut(htmlElement: HTMLElement, callback: Function0<Unit>? = null)<commit_msg>Use window.setTimeout for callback of slideUpRow/slideDownRow.<commit_after>package net.yested.ext.jquery

import jquery.JQuery
import jquery.jq
import net.yested.core.utils.setChild
import org.w3c.dom.HTMLElement
import kotlin.browser.window

@native fun JQuery.fadeOut(duration: Int, callback:()->Unit): JQuery = noImpl;
@native fun JQuery.fadeIn(duration: Int, callback:()->Unit): JQuery = noImpl;
@native fun JQuery.slideUp(duration: Int = 400, callback:(()->Unit)? = null): JQuery = noImpl
@native fun JQuery.slideDown(duration: Int = 400, callback:(()->Unit)? = null): JQuery = noImpl
@native fun JQuery.show(callback:()->Unit): JQuery = noImpl;
@native fun JQuery.hide(callback:()->Unit): JQuery = noImpl;
@native fun JQuery.children(selector: String): JQuery = noImpl

fun JQuery.slideUpTableRow(duration:Int = 400, callback:(()->Unit)? = null): JQuery {
    children("td").slideUp(duration).children("*").slideUp(duration)
    if (callback != null) {
        window.setTimeout({
            callback()
        }, duration)
    }
    return this
}

fun JQuery.slideDownTableRow(duration:Int = 400, callback:(()->Unit)? = null): JQuery {
    children("td").slideDown(duration).children("*").slideDown(duration)
    if (callback != null) {
        window.setTimeout({
            callback()
        }, duration)
    }
    return this
}

private val DURATION = 200
private val SLIDE_DURATION = DURATION * 2

interface Effect {
    fun apply(htmlElement: HTMLElement, callback: Function0<Unit>? = null)
}

interface BiDirectionEffect {
    fun applyIn(htmlElement: HTMLElement, callback: Function0<Unit>? = null)
    fun applyOut(htmlElement: HTMLElement, callback: Function0<Unit>? = null)
{'fraction_non_alphanumeric': 0.14654126213592233, 'fraction_numerical': 0.012135922330097087, 'mean_word_length': 4.814814814814815, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '3307074', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1016, 'n_words': 246}