<commit_before>import Vue from 'vue';
import $ from 'jquery';
import './vue/comment.js';

let $newTranslationButton = $(".translate_subtitle");
$newTranslationButton.on("click", function() {
    $("#new-translation-opts").toggleClass("hidden");
});

$("a[disabled]").on("click", function(e) {
    e.preventDefault();
    return false;
});

$("a[data-action='delete']").on("click", function(e) {
    let subId = $(this).data("id");
    alertify.confirm("¿Estás seguro de querer borrar este subtítulo? Esta acción no es reversible.", function() {
        window.location = "/subtitles/"+subId+"/delete";
    });
});


let comments = new Vue({
    el: '#subtitle-comments',
    data: {
        newComment: '',
        comments: [
        ]
    },
    methods: {
        publishComment: function() {
            let comment = this.newComment;
            this.newComment = '';

            $.ajax({
                url: '/episodes/'+epId+'/comments/submit',
                method: 'POST',
                data: {<commit_msg>Remember last selected new translation language from the language dropdown<commit_after>import Vue from 'vue';
import $ from 'jquery';
import './vue/comment.js';

let $newTranslationButton = $(".translate_subtitle");
$newTranslationButton.on("click", function() {
    $("#new-translation-opts").toggleClass("hidden");
});

$("a[disabled]").on("click", function(e) {
    e.preventDefault();
    return false;
});

$("a[data-action='delete']").on("click", function(e) {
    let subId = $(this).data("id");
    alertify.confirm("¿Estás seguro de querer borrar este subtítulo? Esta acción no es reversible.", function() {
        window.location = "/subtitles/"+subId+"/delete";
    });
});

$(function() {
    let lastLangVal = localStorage.getItem("last-selected-translation-lang");
    
    if(lastLangVal !== null) {
        $("#translate-to-lang").val(lastLangVal);
    }
});

$("#translate-to-lang").on("change", function() {
    localStorage.setItem("last-selected-translation-lang", $(this).val());
});

let comments = new Vue({
    el: '#subtitle-comments',
    data: {
        newComment: '',
        comments: [
        ]
    },
    methods: {
        publishComment: function() {
            let comment = this.newComment;
            this.newComment = '';

            $.ajax({
                url: '/episodes/'+epId+'/comments/submit',
                method: 'POST',
                data: {
{'fraction_non_alphanumeric': 0.18579686209744012, 'fraction_numerical': 0.0, 'mean_word_length': 2.7859375, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '946575', 'n_tokens_mistral': 729, 'n_tokens_neox': 722, 'n_words': 144}