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

    var item;

    $('.episode_action').on('change', function() {

        /*
		# Get <select/> element that was clicked on
    	*/
        var actionType = $(this).val(),

            /*
		# Get <select/> element data-action
    	*/
        var action = $(this).find('option:selected').data('action');

        /*
		# Add class to parent element of the <select/> element
    	*/
        $(this).parent().closest('tr').prop('class', 'selected');


        if (actionType === 'view') {
            window.location = action;
        }

        if (actionType === 'delete') {
            deleteEpisode(action)
        };

        if (actionType === 'activate') {

            item = $(this).parent().closest('tr');
            activateEpisode(action)
        };
    });


    /*
    # Delete Episode Function
    */
    function deleteEpisode(episodeId) {
        var
            url = '/dashboard/episode/delete',
            token = document.getElementById('token').value,
            method = 'DELETE',
            episode_id = episodeId,
            functionName = arguments.callee.name;

        var data = {
            url: url,
            method: method,
            parameter: {
                _token: token,
                episode_id: episodeId
            }
        }

        swal({
                title: 'Delete Episode',
                text: 'You will not be able to recover this episode!',
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#DD6B55',
                confirmButtonText: 'Yes, delete it!',
                cancelButtonText: 'No, cancel!',
                closeOnCancelnConfirm: false,
                closeOnCancel: false
            },
            function(isConfirm) {
                if (isConfirm) {
                    ajaxCall(data, functionName)
                } else {
                    swal('Cancelled', 'Your episode is safe :)', 'error');
                }
            });
    }

    /*
    # Delete Episode Function
    */
    function activateEpisode(episodeId) {
        var
            url = '/dashboard/episode/activate',
            token = document.getElementById('token').value,
            method = 'PATCH',
            functionName = arguments.callee.name;

        var data = {
            url: url,
            method: method,
            parameter: {
                _token: token,
                episode_id: episodeId<commit_msg>[Chore 116206695] Refactor unncessary variables<commit_after>$(document).ready(function() {

    var item;

    $('.episode_action').on('change', function() {

        /*
		# Get <select/> element that was clicked on
    	*/
        var actionType = $(this).val(),

            /*
		# Get <select/> element data-action
    	*/
        var action = $(this).find('option:selected').data('action');

        /*
		# Add class to parent element of the <select/> element
    	*/
        $(this).parent().closest('tr').prop('class', 'selected');


        if (actionType === 'view') {
            window.location = action;
        }

        if (actionType === 'delete') {
            deleteEpisode(action)
        };

        if (actionType === 'activate') {

            item = $(this).parent().closest('tr');
            activateEpisode(action)
        };
    });


    /*
    # Delete Episode Function
    */
    function deleteEpisode(episodeId) {
        var
            url = '/dashboard/episode/delete',
            token = document.getElementById('token').value,
            method = 'DELETE',
            episode_id = episodeId,
            functionName = arguments.callee.name;

        var data = {
            url: url,
            method: method,
            parameter: {
                _token: token,
                episode_id: episodeId
            }
        }

        swal({
                title: 'Delete Episode',
                text: 'You will not be able to recover this episode!',
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#DD6B55',
                confirmButtonText: 'Yes, delete it!',
                cancelButtonText: 'No, cancel!',
                closeOnCancelnConfirm: false,
                closeOnCancel: false
            },
            function(isConfirm) {
                if (isConfirm) {
                    ajaxCall(data, functionName)
                } else {
                    swal('Cancelled', 'Your episode is safe :)', 'error');
                }
            });
    }

    /*
    # Delete Episode Function
    */
    function activateEpisode(episodeId) {

        var functionName = arguments.callee.name;
        var data = {
            url: '/dashboard/episode/activate',
            method: 'PATCH',
            parameter: {
                _token: document.getElementById('token').value,
                episode_id: episodeId
{'fraction_non_alphanumeric': 0.12198581560283688, 'fraction_numerical': 0.00303951367781155, 'mean_word_length': 1.419607843137255, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6502253', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1238, 'n_words': 283}