<commit_before>/* global django,Downcoder,ContentEditor */
/* eslint indent:[2,4] */
/* eslint comma-dangle:[2,"never"] */
django.jQuery(function($){
    // Patch up urlify maps to generate nicer slugs in german
    if(typeof(Downcoder) != 'undefined'){
        Downcoder.Initialize() ;
        Downcoder.map['ö'] = Downcoder.map['Ö'] = 'oe';
        Downcoder.map['ä'] = Downcoder.map['Ä'] = 'ae';
        Downcoder.map['ü'] = Downcoder.map['Ü'] = 'ue';
    }

    window.ContentEditor = {
        addContent: function addContent(plugin) {
            $('#' + plugin + '_set-group .add-row a').click();
        }
    };

    // Add basic structure. There is always at least one inline group if
    // we even have any plugins.
    $('.inline-group:first').before(
        '<div class="tabs regions"></div>' +
        '<div class="module">' +
        '<div class="order-machine"></div><div class="machine-control"></div>' +
        '</div>'
    );

    // .dataset.context instead of getAttribute would be nicer
    $.extend(window.ContentEditor, JSON.parse(
        document.getElementById('content-editor-context').getAttribute('data-context')));
    var orderMachine = $('.order-machine');

    function moveEmptyFormsToEnd() {
        orderMachine.append(orderMachine.find('.empty-form').detach());
    }

    function reorderInlines(context) {
        context = context || orderMachine;
        var inlines = context.find('.inline-related');
        inlines.not('.empty-form').each(function() {
            $(document).trigger('content-editor:deactivate', [$(this)]);
        });
        inlines.detach();
        inlines.sort(function inlinesCompareFunction(a, b) {
            var aOrdering = $(a).find('.field-ordering input').val() || 1e9;
            var bOrdering = $(b).find('.field-ordering input').val() || 1e9;<commit_msg>Do not run JS is context data is not available<commit_after>/* global django,Downcoder,ContentEditor */
/* eslint indent:[2,4] */
/* eslint comma-dangle:[2,"never"] */
django.jQuery(function($){
    // Patch up urlify maps to generate nicer slugs in german
    if(typeof(Downcoder) != 'undefined'){
        Downcoder.Initialize() ;
        Downcoder.map['ö'] = Downcoder.map['Ö'] = 'oe';
        Downcoder.map['ä'] = Downcoder.map['Ä'] = 'ae';
        Downcoder.map['ü'] = Downcoder.map['Ü'] = 'ue';
    }

    var context = document.getElementById('content-editor-context');
    if (!context) return;

    window.ContentEditor = {
        addContent: function addContent(plugin) {
            $('#' + plugin + '_set-group .add-row a').click();
        }
    };

    // .dataset.context instead of getAttribute would be nicer
    $.extend(window.ContentEditor, JSON.parse(context.getAttribute('data-context')));

    // Add basic structure. There is always at least one inline group if
    // we even have any plugins.
    $('.inline-group:first').before(
        '<div class="tabs regions"></div>' +
        '<div class="module">' +
        '<div class="order-machine"></div><div class="machine-control"></div>' +
        '</div>'
    );

    var orderMachine = $('.order-machine');

    function moveEmptyFormsToEnd() {
        orderMachine.append(orderMachine.find('.empty-form').detach());
    }

    function reorderInlines(context) {
        context = context || orderMachine;
        var inlines = context.find('.inline-related');
        inlines.not('.empty-form').each(function() {
            $(document).trigger('content-editor:deactivate', [$(this)]);
        });
        inlines.detach();
        inlines.sort(function inlinesCompareFunction(a, b) {
            var aOrdering = $(a).find('.field-ordering input').val() || 1e9;
            var bOrdering = $(b).find('.field-ordering input').val() || 1e9;
{'fraction_non_alphanumeric': 0.17799094058086865, 'fraction_numerical': 0.0037303490540900614, 'mean_word_length': 2.830612244897959, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6715992', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1105, 'n_words': 225}