<commit_before>
// SICKHEAD PROPRIETARY INFORMATION
//
// This software is supplied under the terms of a license agreement 
// or nondisclosure agreement and may not be copied or disclosed 
// except in accordance with the terms of that agreement.
//
//  Copyright (c) Sickhead Games, LLC
//  All Rights Reserved
//  www.sickheadgames.com

///////////////////////////////////////////////////////////////////////////////
// JQuery Extensions

jQuery.fn.exists = function () { return ($(this).length > 0); }

jQuery.fn.pulse = function (duration, easing, props_to, props_from)
{
    var elem = this;

    // Pulse out.
	elem.animate(
		props_to,
        {
            duration: duration,
            easing: easing,
            queue: true,
        });
    
    // Pulse back in.
	elem.animate(
		props_from,
        {
            duration: duration,
            easing: easing,
            queue: true,
            complete: function () { elem.pulse(duration, easing, props_to, props_from); }
        });
}


///////////////////////////////////////////////////////////////////////////////
// TeamCity Stuff

function update_projects()
{
    // Load the projects from the TeamCity server.
    $.ajax({
        dataType: "json",
        url: "./teamcity.php",
        timeout: 10000,
        cache: false,
    })
    .done(function (projects)
    {
        var newCards = new Array();

        $.each(projects, function (i, project) {
            var cardId = "tc_" + project.id;
            if (!$("#" + cardId).exists())
                $("#builds_content").append('<div id="parent_' + cardId + '" class="project_card">' + project.name + '<div id="' + cardId + '" class="project_card"><div>');

            update_builds("#" + cardId, project);

            newCards.push("#parent_" + cardId);
        });

        // Delete old cards.
        $("#builds_content").children().not(newCards.toString()).remove();

        // Refresh this data in a little bit.
        setTimeout(update_projects, 3000);
    })
    .fail(function (jqXHR, textStatus, errorThrown)
    {
        // Wait longer to refresh... don't hammer the
        // server over and over if its not responding.
        setTimeout(update_projects, 20000);
    });
}

function update_builds(projectId, project)
{
	var newCards = new Array();

	$.each(project.builds, function(i, build)
	{
		var cardId = "tc_"+ build.id;
		var card = $("#"+cardId);
		if (!card.exists())
		{
			$(projectId).append('<div id="'+ cardId + '"class="build_card_' + build.status +'">' + build.name + '<div>');
			card = $("#"+cardId);
		}
		else
		{
			// Change the state.						
			card.attr('class', 'build_card_' + build.status);
			card.text(build.name);
		}

	    // Store some build state on the card so we 
	    // can react to changes in the state.
		var wasRunning = card.data('running') == true;
		var startRunning = !wasRunning && build.running == true;
		var buildFailed = card.data('status') == "SUCCESS" && build.status == "FAILED";
		var buildSuccess = card.data('status') == "FAILED" && build.status == "SUCCESS";
		card.data('running', build.running);
		card.data('status', build.status);

	    // Play the success and failure sounds.
        if (buildFailed)
            $.playSound('./build_failed.mp3');
        if (buildSuccess)
            $.playSound('./build_success.mp3');
        if (startRunning)
            $.playSound('./build_running.mp3');

		// If the build is running then start pulsing the card.							
        if (build.running && !wasRunning)
		    card.pulse(500, 'linear', { opacity: 0.25 }, { opacity: 1 });
		else
		{
		    // Reset the css state.
		    card.stop(true);
		    card.removeAttr('style');
        }

		newCards.push("#"+cardId);
	});

	// Delete old cards.
	$(projectId).children().not(newCards.toString()).remove();
}<commit_msg>Fixed triggering of build running sound effect.<commit_after>
// SICKHEAD PROPRIETARY INFORMATION
//
// This software is supplied under the terms of a license agreement 
// or nondisclosure agreement and may not be copied or disclosed 
// except in accordance with the terms of that agreement.
//
//  Copyright (c) Sickhead Games, LLC
//  All Rights Reserved
//  www.sickheadgames.com

///////////////////////////////////////////////////////////////////////////////
// JQuery Extensions

jQuery.fn.exists = function () { return ($(this).length > 0); }

jQuery.fn.pulse = function (duration, easing, props_to, props_from)
{
    var elem = this;

    // Pulse out.
	elem.animate(
		props_to,
        {
            duration: duration,
            easing: easing,
            queue: true,
        });
    
    // Pulse back in.
	elem.animate(
		props_from,
        {
            duration: duration,
            easing: easing,
            queue: true,
            complete: function () { elem.pulse(duration, easing, props_to, props_from); }
        });
}


///////////////////////////////////////////////////////////////////////////////
// TeamCity Stuff

function update_projects()
{
    // Load the projects from the TeamCity server.
    $.ajax({
        dataType: "json",
        url: "./teamcity.php",
        timeout: 10000,
        cache: false,
    })
    .done(function (projects)
    {
        var newCards = new Array();

        $.each(projects, function (i, project) {
            var cardId = "tc_" + project.id;
            if (!$("#" + cardId).exists())
                $("#builds_content").append('<div id="parent_' + cardId + '" class="project_card">' + project.name + '<div id="' + cardId + '" class="project_card"><div>');

            update_builds("#" + cardId, project);

            newCards.push("#parent_" + cardId);
        });

        // Delete old cards.
        $("#builds_content").children().not(newCards.toString()).remove();

        // Refresh this data in a little bit.
        setTimeout(update_projects, 3000);
    })
    .fail(function (jqXHR, textStatus, errorThrown)
    {
        // Wait longer to refresh... don't hammer the
        // server over and over if its not responding.
        setTimeout(update_projects, 20000);
    });
}

function update_builds(projectId, project)
{
	var newCards = new Array();

	$.each(project.builds, function(i, build)
	{
		var cardId = "tc_"+ build.id;
		var card = $("#"+cardId);
		if (!card.exists())
		{
			$(projectId).append('<div id="'+ cardId + '"class="build_card_' + build.status +'">' + build.name + '<div>');
			card = $("#"+cardId);
		}
		else
		{
			// Change the state.						
			card.attr('class', 'build_card_' + build.status);
			card.text(build.name);
		}

	    // Store some build state on the card so we 
	    // can react to changes in the state.
		var wasRunning = card.data('running');
		var startRunning = !wasRunning && build.running == "true";
		var buildFailed = card.data('status') == "SUCCESS" && build.status == "FAILED";
		var buildSuccess = card.data('status') == "FAILED" && build.status == "SUCCESS";
		card.data('running', build.running == "true");
		card.data('status', build.status);

	    // Play the success and failure sounds.
        if (buildFailed)
            $.playSound('./build_failed.mp3');
        if (buildSuccess)
            $.playSound('./build_success.mp3');
        if (startRunning)
            $.playSound('./build_running.mp3');

		// If the build is running then start pulsing the card.							
        if (build.running && !wasRunning)
		    card.pulse(500, 'linear', { opacity: 0.25 }, { opacity: 1 });
        else if (!build.running && wasRunning)
		{
		    // Reset the css state.
		    card.stop(true);
		    card.removeAttr('style');
        }

		newCards.push("#"+cardId);
	});

	// Delete old cards.
	$(projectId).children().not(newCards.toString()).remove();
}
{'fraction_non_alphanumeric': 0.18961946673569766, 'fraction_numerical': 0.0064716541548019675, 'mean_word_length': 2.065053550178501, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1719683', 'n_tokens_mistral': 2419, 'n_tokens_neox': 2229, 'n_words': 595}