<commit_before>var base_url = "{{ globals.base_url_general }}",
    base_cache = "{{ globals.cache_dir }}",
    version_id = "v_{{ globals.v }}",
    base_static = "{{ globals.base_static_noversion }}",
    is_mobile = {{ globals.mobile }},
    current_user = {{ current_user.user_id }},
    current_user_admin = {% if current_user.admin %}true{% else %}false{% endif %},
    touchable = false,
    loadedJavascript = [],
    do_partial = {% if globals.allow_partial %}true{% else %}false{% endif %},
    lastScrollTop = 0;

if ((typeof window.history === 'object') && (do_partial || navigator.userAgent.match(/meneame/i))) {
    do_partial = true;
}

var now = (new Date);
var now_ts = now.getTime();

function to_date(index) {
    var str;
    var $e = $(this);
    var ts = $e.data('ts');

    if (typeof ts !== 'number' || !ts) {
        return;
    }

    ts *= 1000;

    var d = new Date(ts);

    var dd = function(d) {
        return (d < 10) ? ("0" + d) : d;
    };

    var diff = Math.floor((now_ts - ts) / 1000);

    if (diff < 3600 && diff > 0) {
        if (diff < 60) {
            str = "{% trans _('hace') %} " + diff + " {% trans _('seg') %}";
        } else {
            str = "{% trans _('hace') %} " + Math.floor(diff / 60) + " {% trans _('min') %}";
        }
    } else {
        str = "";

        if (diff > 43200) { /* 12 hs */
            str += dd(d.getDate()) + "/" + dd(d.getMonth() + 1);

            if (now.getFullYear() != d.getFullYear()) {
                str += "/" + d.getFullYear();
            }
        }

        str += " " + dd(d.getHours()) + ":" + dd(d.getMinutes());
    }

    $e.attr('title', ($e.attr('title') || '') + str);

    if (!$e.hasClass("novisible")) {
        $e.html(str);
    }
}

function redirect(url) {
    document.location = url;
}

function menealo(user, id) {
    var content = "id=" + id + "&user=" + user + "&key=" + base_key + "&l=" + link_id + "&u=" + encodeURIComponent(document.referrer);
    var url = base_url + "backend/menealo?" + content;

    disable_vote_link(id, -1, "...", '');

    $.getJSON(url, function(data) {
        parseLinkAnswer(id, data);
    });

    reportAjaxStats('vote', 'link');
}

var votePending = [];

function setVotePending(key, id, value) {
    var key = 'c' + id,
        $voted, $notvoted;

    if ((typeof votePending[key] !== 'undefined') && votePending[key]) {
        clearTimeout(votePending[key]);
    }

    if (value > 0) {
        $voted = 'p';
        $notvoted = 'n';
    } else {
        $voted = 'n';
        $notvoted = 'p';
    }

    $voted = $('#vc-' + $voted + '-' + id);
    $notvoted = $('#vc-' + $notvoted + '-' + id);

    if ($voted.hasClass('voted')) {
        $voted.removeClass('voted pending');
        return false;
    }

    $voted.addClass('voted pending');
    $notvoted.removeClass('voted pending');

    return true;
}

function menealo_comment(user, id, value) {
    var key = 'c' + id;

    if (!setVotePending(key, id, value)) {
        return;
    }

    votePending[key] = setTimeout(function() {
        var content = "id=" + id + "&user=" + user + "&value=" + value + "&key=" + base_key + "&l=" + link_id;
        var url = base_url + "backend/menealo_comment?" + content;

        $.getJSON(url, function(data) {
            update_comment_vote(id, value, data);
        });

        reportAjaxStats('vote', 'comment');

        votePending[key] = null;
    }, 3000);
}

function menealo_post(user, id, value) {
    var key = 'c' + id;

    if (!setVotePending(key, id, value)) {
        return;
    }

    votePending[key] = setTimeout(function() {
        var content = "id=" + id + "&user=" + user + "&value=" + value + "&key=" + base_key + "&l=" + link_id;
        var url = base_url + "backend/menealo_post?" + content;

        $.getJSON(url, function(data) {
            update_comment_vote(id, value, data);
        });

        reportAjaxStats('vote', 'post');

        votePending[key] = null;
    }, 3000);
}

function update_comment_vote(id, value, data) {
    if (data.error) {
        mDialog.notify("{% trans _('Error:') %} " + data.error, 5);
        return false;
    }

    $('#vc-' + id).html('' + data.votes);
    $('#vk-' + id).html('<i class="icon-karma">K</i> ' + data.karma);

    if (value < 0) {
        var $voted = $('#vc-n-' + id);<commit_msg>Updated 3 seconds to vote change to 2<commit_after>var base_url = "{{ globals.base_url_general }}",
    base_cache = "{{ globals.cache_dir }}",
    version_id = "v_{{ globals.v }}",
    base_static = "{{ globals.base_static_noversion }}",
    is_mobile = {{ globals.mobile }},
    current_user = {{ current_user.user_id }},
    current_user_admin = {% if current_user.admin %}true{% else %}false{% endif %},
    touchable = false,
    loadedJavascript = [],
    do_partial = {% if globals.allow_partial %}true{% else %}false{% endif %},
    lastScrollTop = 0;

if ((typeof window.history === 'object') && (do_partial || navigator.userAgent.match(/meneame/i))) {
    do_partial = true;
}

var now = (new Date);
var now_ts = now.getTime();

function to_date(index) {
    var str;
    var $e = $(this);
    var ts = $e.data('ts');

    if (typeof ts !== 'number' || !ts) {
        return;
    }

    ts *= 1000;

    var d = new Date(ts);

    var dd = function(d) {
        return (d < 10) ? ("0" + d) : d;
    };

    var diff = Math.floor((now_ts - ts) / 1000);

    if (diff < 3600 && diff > 0) {
        if (diff < 60) {
            str = "{% trans _('hace') %} " + diff + " {% trans _('seg') %}";
        } else {
            str = "{% trans _('hace') %} " + Math.floor(diff / 60) + " {% trans _('min') %}";
        }
    } else {
        str = "";

        if (diff > 43200) { /* 12 hs */
            str += dd(d.getDate()) + "/" + dd(d.getMonth() + 1);

            if (now.getFullYear() != d.getFullYear()) {
                str += "/" + d.getFullYear();
            }
        }

        str += " " + dd(d.getHours()) + ":" + dd(d.getMinutes());
    }

    $e.attr('title', ($e.attr('title') || '') + str);

    if (!$e.hasClass("novisible")) {
        $e.html(str);
    }
}

function redirect(url) {
    document.location = url;
}

function menealo(user, id) {
    var content = "id=" + id + "&user=" + user + "&key=" + base_key + "&l=" + link_id + "&u=" + encodeURIComponent(document.referrer);
    var url = base_url + "backend/menealo?" + content;

    disable_vote_link(id, -1, "...", '');

    $.getJSON(url, function(data) {
        parseLinkAnswer(id, data);
    });

    reportAjaxStats('vote', 'link');
}

var votePending = [];

function setVotePending(key, id, value) {
    var key = 'c' + id,
        $voted, $notvoted;

    if ((typeof votePending[key] !== 'undefined') && votePending[key]) {
        clearTimeout(votePending[key]);
    }

    if (value > 0) {
        $voted = 'p';
        $notvoted = 'n';
    } else {
        $voted = 'n';
        $notvoted = 'p';
    }

    $voted = $('#vc-' + $voted + '-' + id);
    $notvoted = $('#vc-' + $notvoted + '-' + id);

    if ($voted.hasClass('voted')) {
        $voted.removeClass('voted pending');
        return false;
    }

    $voted.addClass('voted pending');
    $notvoted.removeClass('voted pending');

    return true;
}

function menealo_comment(user, id, value) {
    var key = 'c' + id;

    if (!setVotePending(key, id, value)) {
        return;
    }

    votePending[key] = setTimeout(function() {
        var content = "id=" + id + "&user=" + user + "&value=" + value + "&key=" + base_key + "&l=" + link_id;
        var url = base_url + "backend/menealo_comment?" + content;

        $.getJSON(url, function(data) {
            update_comment_vote(id, value, data);
        });

        reportAjaxStats('vote', 'comment');

        votePending[key] = null;
    }, 2000);
}

function menealo_post(user, id, value) {
    var key = 'c' + id;

    if (!setVotePending(key, id, value)) {
        return;
    }

    votePending[key] = setTimeout(function() {
        var content = "id=" + id + "&user=" + user + "&value=" + value + "&key=" + base_key + "&l=" + link_id;
        var url = base_url + "backend/menealo_post?" + content;

        $.getJSON(url, function(data) {
            update_comment_vote(id, value, data);
        });

        reportAjaxStats('vote', 'post');

        votePending[key] = null;
    }, 2000);
}

function update_comment_vote(id, value, data) {
    if (data.error) {
        mDialog.notify("{% trans _('Error:') %} " + data.error, 5);
        return false;
    }

    $('#vc-' + id).html('' + data.votes);
    $('#vk-' + id).html('<i class="icon-karma">K</i> ' + data.karma);

    if (value < 0) {
        var $voted = $('#vc-n-' + id);
{'fraction_non_alphanumeric': 0.20193637621023514, 'fraction_numerical': 0.009681881051175657, 'mean_word_length': 2.319433817903596, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 13, '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': '7341359', 'n_tokens_mistral': 3238, 'n_tokens_neox': 3067, 'n_words': 654}