<commit_before>var QueryScenario = Backbone.Model.extend({
    initialize: function(args, options) {
        this.query = options.query;
        this.query.workspace.bind('table:render', this.attach_listeners);
    },
    
        
    leaver: function() {
        alert('test');
    },
    
    attach_listeners: function(args) {
        $(args.workspace.el).find("td.data").click(function(event) {
            $target = $(event.target).hasClass('data') ?
                $(event.target).find('div') : $(event.target);
            var value = $target.attr('alt');
                        var pos = $target.attr('rel');
                        
            saving = function(e) {
                 if (e.keyCode == 13) {
                    this.value = value;
                    this.position = pos;
                    $target.text('');
                    alert('enter');
                 }
                 if (e.keyCode == 27 || e.keyCode == 9) {
                    $target..text('');
                    alert('esc');
                 }
                 (this.leaver);
                 
                return (false);


            };
            
            var $input = $("<input type='text' value='" + value + "' />")
                .keyup(saving);
            $target.html('').append($input);
        });
    },
    
    check_input: function(event) {
    },
    
    parse: function() {
        this.query.run();
    },

    url: function() {
        return this.query.url() + "/cell/" + this.position + "/" + this.value; 
    }
});<commit_msg>Somewhat working implementation of TOP SECRET feature<commit_after>var QueryScenario = Backbone.Model.extend({
    initialize: function(args, options) {
        // Maintain `this`
        _.bindAll(this, "attach_listeners", "clicked_cell", "save_writeback", 
            "cancel_writeback", "check_input");
        
        this.query = options.query;
        this.query.workspace.bind('table:render', this.attach_listeners);
    },
    
    attach_listeners: function(args) {
        $(args.workspace.el).find("td.data").click(this.clicked_cell);
    },
    
    clicked_cell: function(event) {
        $target = $(event.target).hasClass('data') ?
            $(event.target).find('div') : $(event.target);
        var value = $target.attr('alt');
                    var pos = $target.attr('rel');
        
        var $input = $("<input type='text' value='" + value + "' />")
            .keyup(this.check_input)
            .blur(this.cancel_writeback);
        $target.html('').append($input);
        $input.focus();
    },
    
    check_input: function(event) {
        if (event.which == 13) {
            this.save_writeback(event);
        } else if (event.which == 27 || event.which == 9) {
            this.cancel_writeback(event);
        }
         
        return false;
    },
    
    save_writeback: function(event) {
        var $input = $(event.target).closest('input');
        this.set({
            value: $input.val(),
            position: $input.parent().attr('rel')
        });
        this.save();
        var value = $input.val();
        $input.parent().text(value);
    },
    
    cancel_writeback: function(event) {
        var $input = $(event.target).closest('input');
        $input.parent().text($input.parent().attr('alt'));
    },
    
    parse: function() {
        this.query.run();
    },

    url: function() {
        return this.query.url() + "/cell/" + this.get('position') + 
            "/" + this.get('value'); 
    }
});
{'fraction_non_alphanumeric': 0.16737468139337297, 'fraction_numerical': 0.002832058906825262, 'mean_word_length': 1.6260223048327138, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '905922', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1006, 'n_words': 162}