All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.sparkdebugtools.js.sparkdebugtools_shrink-stackframes.js Maven / Gradle / Ivy

$(".frame").addClass("tryShrink");

$("body").on("click", ".expander", function () {
    var groupId = $(this).attr("id");
    $(this).remove();
    $("." + groupId).removeClass("shrunk");
});

setTimeout(function() { //failsafe
    $(".frames-container").css("display", "block");
}, 500);

// If you're reading this... I'm sorry.
(function shrinkingTime(runsLeft) {
    var tryShrink = $(".frame.tryShrink");
    var beginIndex = 0;
    var endIndex = tryShrink.length;
    for (var i = 0; i < tryShrink.length; i++) {
        if (!$(tryShrink[i]).hasClass("has-code")) {
            beginIndex = i;
            break;
        }
    }
    for (var i = 0; i < tryShrink.length; i++) {
        if (i > beginIndex && $(tryShrink[i]).hasClass("has-code")) {
            endIndex = i;
            break;
        }
    }
    var shrink = tryShrink.slice(beginIndex, endIndex);
    var groupId = "g" + $(shrink[0]).find(".frame-index").text() + "-" + $(shrink[shrink.length - 1]).find(".frame-index").text();
    for (var i = 0; i < shrink.length; i++) {
        $(shrink[i]).removeClass("tryShrink");
        if (shrink.length > 3) {
            if (i == beginIndex) {
                $(shrink[i]).after('
Show ' + (shrink.length - 2) + ' empty frames
'); } if (i > 0 && i < shrink.length - 1) { $(shrink[i]).addClass("shrunk " + groupId); } } } tryShrink = $(".frame.tryShrink"); for (var i = 0; i < tryShrink.length; i++) { if (!$(tryShrink[i]).hasClass("has-code") && runsLeft > 0) { shrinkingTime(runsLeft - 1); break; } if(i === tryShrink.length-1) { //all done $(".frames-container").css("display", "block"); } } })(10); //max runs




© 2015 - 2024 Weber Informatics LLC | Privacy Policy