<commit_before>// hypermock.js

// TODO: better drag-to-create functionality

function updateTools() {
    $('.tool').removeClass('selected');
    $('.tool[data-tool="' + editor.selectedTool.name + '"]').addClass('selected');
    $('.preview').toggleClass('toolSelected', editor.selectedTool !== Editor.PointerTool);
}

function updatePreview() {
    var bounds = editor.newTagPreview;
    $('.overlayPreview').css(bounds !== null ?
        {display: 'block', left: bounds.x, top: bounds.y, width: bounds.width, height: bounds.height} :
        {display: 'none'});
}


$('.tool').click(function() {
    editor.selectTool($(this).data('tool'));
    updateTools();
    return false;
});

$('.preview').mousedown(function(e) {
    if(editor.selectedTool !== Editor.PointerTool) {
        editor.startNewTag(e.clientX, e.clientY);
        updatePreview();
    }
    return false;
});
$('.preview, .overlayPreview').mousemove(function(e) {
    editor.updateNewTag(e.clientX, e.clientY);
    // TODO: remove this once callbacks are in place
    if(editor.newTagPreview !== null)
        updatePreview();
    return false;
});
$('.preview, .overlayPreview').mouseup(function(e) {
    //editor.endNewTag();
    // TODO: remove this once callbacks are in place
    if(editor.newTagPreview === null)
        return false;
    var tag = editor.endNewTag();
    updatePreview();
    // TODO: create tag element and begin editing it<commit_msg>More function labels.<commit_after>// hypermock.js

// TODO: better drag-to-create functionality


// Update functions
function updateTools() {
    $('.tool').removeClass('selected');
    $('.tool[data-tool="' + editor.selectedTool.name + '"]').addClass('selected');
    $('.preview').toggleClass('toolSelected', editor.selectedTool !== Editor.PointerTool);
}

function updatePreview() {
    var bounds = editor.newTagPreview;
    $('.overlayPreview').css(bounds !== null ?
        {display: 'block', left: bounds.x, top: bounds.y, width: bounds.width, height: bounds.height} :
        {display: 'none'});
}


// Event handlers
$('.tool').click(function() {
    editor.selectTool($(this).data('tool'));
    updateTools();
    return false;
});

$('.preview').mousedown(function(e) {
    if(editor.selectedTool !== Editor.PointerTool) {
        editor.startNewTag(e.clientX, e.clientY);
        updatePreview();
    }
    return false;
});
$('.preview, .overlayPreview').mousemove(function(e) {
    editor.updateNewTag(e.clientX, e.clientY);
    // TODO: remove this once callbacks are in place
    if(editor.newTagPreview !== null)
        updatePreview();
    return false;
});
$('.preview, .overlayPreview').mouseup(function(e) {
    //editor.endNewTag();
    // TODO: remove this once callbacks are in place
    if(editor.newTagPreview === null)
        return false;
    var tag = editor.endNewTag();
    updatePreview();
    // TODO: create tag element and begin editing it
{'fraction_non_alphanumeric': 0.17566173942935717, 'fraction_numerical': 0.0, 'mean_word_length': 3.5397815912636506, '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': '1980132', 'n_tokens_mistral': 863, 'n_tokens_neox': 856, 'n_words': 187}