<commit_before>/*
 * Copyright (c) 2013-2016 CoNWeT Lab., Universidad Politécnica de Madrid
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* globals $, MashupPlatform, JSONEditor, StyledElements*/

(function () {

    "use strict";

    var MP = MashupPlatform;
    var layout;
    var stack_n;

    var createbtn, playbtn, runbtn, stepbtn, sendbtn, dropbtn;

    var recording = false;

    var modes = ['code', 'form', 'text', 'tree', 'view'];

    var TEXT = 'textoutput'; // Output endpoint

    var editor;

    var stack = [];

    var typeSelector;

    var init = function init() {
        var action_buttons;

        layout = new StyledElements.VerticalLayout();
        layout.insertInto(document.body);
        layout.north.addClassName('header');
        layout.north.appendChild(new StyledElements.Fragment('<h4 class="text-primary">Type: <span id="type-data">No data</span><div id="buttons"></div></h4>'));

        // Create the data-type selector
        var typed = $("#type-data")[0];
        var parent = typed.parentNode;
        parent.removeChild(typed);
        createTypeSelectors();
        typeSelector.insertInto(parent);

        // Create the remaining events count
        stack_n = document.createElement('div');
        document.getElementById('buttons').appendChild(stack_n);
        stack_n.className = 'badge badge-info';
        stack_n.textContent = '0';

        // Create and bind action buttons
        action_buttons = document.createElement('div');
        action_buttons.className = 'btn-group';
        document.getElementById('buttons').appendChild(action_buttons);

        playbtn = new StyledElements.Button({'class': 'btn-danger fa fa-circle', 'title': 'Start recording events'});
        playbtn.addEventListener("click", play_action).insertInto(action_buttons);

        createbtn = new StyledElements.Button({'class': 'btn-info fa fa-plus', 'title': 'Create new event'});
        createbtn.addEventListener("click", create_action).insertInto(action_buttons);

        runbtn = new StyledElements.Button({'class': 'btn-info fa fa-fast-forward', 'title': 'Launch all pending events'});
        runbtn.addEventListener('click', run_action).insertInto(action_buttons);

        stepbtn = new StyledElements.Button({'class': 'btn-info fa fa-step-forward', 'title': 'Launch current event'});
        stepbtn.addEventListener('click', step_action).insertInto(action_buttons);

        sendbtn = new StyledElements.Button({'class': 'btn-info fa fa-play', 'title': 'Launch and keep current event'});
        sendbtn.addEventListener('click', send_action).insertInto(action_buttons);

        dropbtn = new StyledElements.Button({'class': 'btn-info fa fa-trash', 'title': 'Drop current event'});
        dropbtn.addEventListener('click', drop_action).insertInto(action_buttons);

        // Disable the buttons
        setdisable_btns(true);

        // Set the editor options
        var options = {
            mode: 'tree',
            modes: modes,
            error: function (err) {
                window.alert(err.toString());
            }
        };

        //Create the editor
        layout.center.addClassName('jsoncontainer');
        editor = new JSONEditor(layout.center.wrapperElement, options);

        //Create loading animation
        layout.center.addClassName('loading').disable();

        editor.setMode("text");
        editor.setText('');
<commit_msg>Remove window.alert<commit_after>/*
 * Copyright (c) 2013-2016 CoNWeT Lab., Universidad Politécnica de Madrid
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* globals $, MashupPlatform, JSONEditor, StyledElements*/

(function () {

    "use strict";

    var MP = MashupPlatform;
    var layout;
    var stack_n;

    var createbtn, playbtn, runbtn, stepbtn, sendbtn, dropbtn;

    var recording = false;

    var modes = ['code', 'form', 'text', 'tree', 'view'];

    var TEXT = 'textoutput'; // Output endpoint

    var editor;

    var stack = [];

    var typeSelector;

    var init = function init() {
        var action_buttons;

        layout = new StyledElements.VerticalLayout();
        layout.insertInto(document.body);
        layout.north.addClassName('header');
        layout.north.appendChild(new StyledElements.Fragment('<h4 class="text-primary">Type: <span id="type-data">No data</span><div id="buttons"></div></h4>'));

        // Create the data-type selector
        var typed = $("#type-data")[0];
        var parent = typed.parentNode;
        parent.removeChild(typed);
        createTypeSelectors();
        typeSelector.insertInto(parent);

        // Create the remaining events count
        stack_n = document.createElement('div');
        document.getElementById('buttons').appendChild(stack_n);
        stack_n.className = 'badge badge-info';
        stack_n.textContent = '0';

        // Create and bind action buttons
        action_buttons = document.createElement('div');
        action_buttons.className = 'btn-group';
        document.getElementById('buttons').appendChild(action_buttons);

        playbtn = new StyledElements.Button({'class': 'btn-danger fa fa-circle', 'title': 'Start recording events'});
        playbtn.addEventListener("click", play_action).insertInto(action_buttons);

        createbtn = new StyledElements.Button({'class': 'btn-info fa fa-plus', 'title': 'Create new event'});
        createbtn.addEventListener("click", create_action).insertInto(action_buttons);

        runbtn = new StyledElements.Button({'class': 'btn-info fa fa-fast-forward', 'title': 'Launch all pending events'});
        runbtn.addEventListener('click', run_action).insertInto(action_buttons);

        stepbtn = new StyledElements.Button({'class': 'btn-info fa fa-step-forward', 'title': 'Launch current event'});
        stepbtn.addEventListener('click', step_action).insertInto(action_buttons);

        sendbtn = new StyledElements.Button({'class': 'btn-info fa fa-play', 'title': 'Launch and keep current event'});
        sendbtn.addEventListener('click', send_action).insertInto(action_buttons);

        dropbtn = new StyledElements.Button({'class': 'btn-info fa fa-trash', 'title': 'Drop current event'});
        dropbtn.addEventListener('click', drop_action).insertInto(action_buttons);

        // Disable the buttons
        setdisable_btns(true);

        // Set the editor options
        var options = {
            mode: 'tree',
            modes: modes,
            error: function (err) {
                MP.widget.log(err.toString());
            }
        };

        //Create the editor
        layout.center.addClassName('jsoncontainer');
        editor = new JSONEditor(layout.center.wrapperElement, options);

        //Create loading animation
        layout.center.addClassName('loading').disable();

        editor.setMode("text");
        editor.setText('');

{'fraction_non_alphanumeric': 0.12634783711784853, 'fraction_numerical': 0.004059368260814411, 'mean_word_length': 3.11482254697286, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2679895', 'n_tokens_mistral': 2146, 'n_tokens_neox': 2055, 'n_words': 583}