<commit_before>var init = {
    /*
     * Notice when (auto)depublish date is in the past
     * TODO: add timer, to check depublish date has passed during editing.
     *
     * @returns {undefined}
     */
    depublishTracking: function () {
        "use strict";

        var noticeID = 'dateDepublishNotice',
            msg = $('#datedepublish').data('notice');

        $('#datedepublish, #statusselect').on('change', function (){

            var status = $('#statusselect').val(),
                depublish = $('#datedepublish').val();

            // remove old notice
            $('.' + noticeID).remove();

            if (depublish === '') {
                return;
            }

            if (status === 'published' && moment(depublish + Bolt.conf('timezone.offset')) < moment()) {
                $('<div class="' + noticeID + ' alert alert-warning alert-dismissible">' +
                    '<button type="button" class="close" data-dismiss="alert">×</button>' + msg + '</div>')
                    .hide()
                    .insertAfter('.depublish-group')
                    .slideDown('fast');
            }

        });

        // trigger on load
        $('#datedepublish').trigger('change');

    },

    /*
     * Bind editfile field
     *
     * @param {object} data
     * @returns {undefined}
     *
     * @fires "Bolt.File.Save.Start"
     * @fires "Bolt.File.Save.Done"
     * @fires "Bolt.File.Save.Fail"
     * @fires "Bolt.File.Save.Always"
     */
    bindEditFile: function (data) {
        "use strict";

        var editor;

        if (typeof CodeMirror !== 'undefined') {
            editor = CodeMirror.fromTextArea(document.getElementById('form_contents'), {
                lineNumbers: true,
                autofocus: true,
                foldGutter: {
                    rangeFinder: CodeMirror.fold.indent
                },
                gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
                extraKeys: {
                    "Ctrl-Q": function(cm){
                        cm.foldCode(
                            cm.getCursor(),
                            {
                                rangeFinder: CodeMirror.fold.indent,
                                minFoldSize: 3
                            }
                        );
                    },
                },
                tabSize: 4,
                indentUnit: 4,
                indentWithTabs: false,
                readOnly: data.readonly
            });
            var newheight = $(window).height() - 312;
            if (newheight < 200) {
                newheight = 200;
            }
            editor.setSize(null, newheight);
        }

        $('#saveeditfile').on('click', function () {
            Bolt.events.fire('Bolt.File.Save.Start');<commit_msg>Adding extrakeys<commit_after>var init = {
    /*
     * Notice when (auto)depublish date is in the past
     * TODO: add timer, to check depublish date has passed during editing.
     *
     * @returns {undefined}
     */
    depublishTracking: function () {
        "use strict";

        var noticeID = 'dateDepublishNotice',
            msg = $('#datedepublish').data('notice');

        $('#datedepublish, #statusselect').on('change', function (){

            var status = $('#statusselect').val(),
                depublish = $('#datedepublish').val();

            // remove old notice
            $('.' + noticeID).remove();

            if (depublish === '') {
                return;
            }

            if (status === 'published' && moment(depublish + Bolt.conf('timezone.offset')) < moment()) {
                $('<div class="' + noticeID + ' alert alert-warning alert-dismissible">' +
                    '<button type="button" class="close" data-dismiss="alert">×</button>' + msg + '</div>')
                    .hide()
                    .insertAfter('.depublish-group')
                    .slideDown('fast');
            }

        });

        // trigger on load
        $('#datedepublish').trigger('change');

    },

    /*
     * Bind editfile field
     *
     * @param {object} data
     * @returns {undefined}
     *
     * @fires "Bolt.File.Save.Start"
     * @fires "Bolt.File.Save.Done"
     * @fires "Bolt.File.Save.Fail"
     * @fires "Bolt.File.Save.Always"
     */
    bindEditFile: function (data) {
        "use strict";

        var editor;

        if (typeof CodeMirror !== 'undefined') {
            editor = CodeMirror.fromTextArea(document.getElementById('form_contents'), {
                lineNumbers: true,
                autofocus: true,
                foldGutter: {
                    rangeFinder: CodeMirror.fold.indent
                },
                gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
                extraKeys: {
                    "Ctrl-Q": function(cm){
                        cm.foldCode(
                            cm.getCursor(),
                            {
                                rangeFinder: CodeMirror.fold.indent,
                                minFoldSize: 3
                            }
                        );
                    },
                    "Tab": function(cm) {
                        if (cm.somethingSelected()) {
                            cm.indentSelection("add");
                        } else {
                            cm.replaceSelection(cm.getOption("indentWithTabs")? "\t":
                            Array(cm.getOption("indentUnit") + 1).join(" "), "end", "+input");
                        }
                    },
                    "Ctrl-S": function() {
                         $('#saveeditfile').click();
                    },
                    "Ctrl-H": "replaceAll",
                },
                tabSize: 4,
                indentUnit: 4,
                indentWithTabs: false,
                readOnly: data.readonly
            });
            var newheight = $(window).height() - 312;
            if (newheight < 200) {
                newheight = 200;
            }
            editor.setSize(null, newheight);
        }

        $('#saveeditfile').on('click', function () {
            Bolt.events.fire('Bolt.File.Save.Start');
{'fraction_non_alphanumeric': 0.136086118251928, 'fraction_numerical': 0.004016709511568123, 'mean_word_length': 1.2472924187725631, 'pattern_counts': {'":': 6, '<': 15, '<?xml version=': 0, '>': 11, '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': '5066364', 'n_tokens_mistral': 1693, 'n_tokens_neox': 1564, 'n_words': 301}