<commit_before>
$(document).ready(function() {

	$(".like-btn").click(function () {

		var status 		  = $(this).attr("like-status");
		var like_count	  = $(this).html();
		var favoriteCount = $("#favorite").html();

		if (status === "like")
		{
			$(this).removeClass("like");
			$(this).addClass("dislike");
			$(this).attr("like-status", "dislike");

			likeEpisode()

			like_count = Number(like_count) + 1;
			favoriteCount = Number(favoriteCount) + 1;

			$(this).text( " " + like_count);
			$("#favorite").html(favoriteCount);
		}

		if (status === "dislike")
		{
			$(this).removeClass("dislike");
			$(this).addClass("like");
			$(this).attr("like-status", "like");

			dislikeEpisode()

			like_count = Number(like_count) - 1;
			favoriteCount = Number(favoriteCount) - 1;

			$(this).text(" " + like_count);
			$("#favorite").html(favoriteCount);

			//check if the string favorites is present in the current url
			if (/favorites/.test(window.location.pathname)) {
				location.reload();
			}
		}

		if (status === "must_login")
		{
			window.location = "/login";
		}

	})

	/*
	# Like Episode Function
	*/
	function likeEpisode()
	{
		var url 			= "/episode/like";
		var token 			= document.getElementById("token").value;
		var method 			= "POST";

	  	var data =
	    {
	        url         	: url,
	        method 			: method,
	        parameter   	:
	        {
	          _token		: token,
	          user_id		: document.getElementById("user_id").value,
	          episode_id	: document.getElementById("episode_id").value
	        }
	    }

		ajaxCall(data)
	}

	/*
	# Dislike Episode Function
	*/
	function dislikeEpisode()
	{
		var url 			= "/episode/unlike";
		var token 			= document.getElementById("token").value;
		var method 			= "post";

	  	var data =
	    {
	        url         	: url,
	        method 			: method,
	        parameter   	:
	        {
	          _token		: token,
	          user_id		: document.getElementById("user_id").value,
	          episode_id	: document.getElementById("episode_id").value
	        }
	    }

		ajaxCall(data)
	}

	/*
	# Ajax
	*/
	function ajaxCall(data)
	{
		$.ajax({
			url		: data.url,
			type	: data.method,
			data	: data.parameter,
			success: function (response)
			{
			},
			error: function()
			{
				alert("Are you sure you doing this the right way?");
			},
		});
	}
})<commit_msg>[Bug #116121723] Get element using<commit_after>
$(document).ready(function() {

    $(".like-btn").click(function () {

        var this_ = $(this);
        var status        = $(this).attr("like-status");
        var like_count    = $(this).html();
        var favoriteCount = $("#favorite").html();

        if (status === "like")
        {
            $(this).removeClass("like");
            $(this).addClass("dislike");
            $(this).attr("like-status", "dislike");

            likeEpisode()

            like_count = Number(like_count) + 1;
            favoriteCount = Number(favoriteCount) + 1;

            $(this).text( " " + like_count);
            $("#favorite").html(favoriteCount);
        }

        if (status === "dislike")
        {
            $(this).removeClass("dislike");
            $(this).addClass("like");
            $(this).attr("like-status", "like");

            dislikeEpisode(this_)

            like_count = Number(like_count) - 1;
            favoriteCount = Number(favoriteCount) - 1;

            $(this).text(" " + like_count);
            $("#favorite").html(favoriteCount);

            //check if the string favorites is present in the current url
            if (/favorites/.test(window.location.pathname)) {
                location.reload();
            }
        }

        if (status === "must_login")
        {
            window.location = "/login";
        }

    })

    /*
    # Like Episode Function
    */
    function likeEpisode()
    {
        var url             = "/episode/like";
        var token           = document.getElementById("token").value;
        var method          = "POST";

        var data =
        {
            url             : url,
            method          : method,
            parameter       :
            {
              _token        : token,
              user_id       : document.getElementById("user_id").value,
              episode_id    : document.getElementById("episode_id").value
            }
        }

        ajaxCall(data)
    }

    /*
    # Dislike Episode Function
    */
    function dislikeEpisode(this_)
    {
        var url             = "/episode/unlike";
        var token           = document.getElementById("token").value;
        var method          = "post";

        var data =
        {
            url             : url,
            method          : method,
            parameter       :
            {
              _token        : token,
              user_id       : document.getElementById("user_id").value,
              episode_id    : this_.attr("data-episode-id")
            }
        }

        ajaxCall(data)
    }

    /*
    # Ajax
    */
    function ajaxCall(data)
    {
        $.ajax({
            url     : data.url,
            type    : data.method,
            data    : data.parameter,
            success: function (response)
            {
            },
            error: function()
            {
                alert("Are you sure you doing this the right way?");
            },
        });
    }
})
{'fraction_non_alphanumeric': 0.14515532544378698, 'fraction_numerical': 0.003143491124260355, 'mean_word_length': 1.5905172413793103, '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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3259161', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1577, 'n_words': 297}