<commit_before>'use strict';

var counts = {
  object: 0
};

var schemaAjaxBlacklist = [];

var NetopeerGUI = angular.module('JSONedit', ['ui.sortable', 'ui.bootstrap', 'configurationTemplates', 'NetopeerGUIServices']);

NetopeerGUI.directive('ngModelOnblur', function() {
    // override the default input to update on blur
    // from http://jsfiddle.net/cn8VF/
    return {
        restrict: 'EAC',
        require: 'ngModel',
        link: function(scope, elm, attr, ngModelCtrl) {
            if (attr.type === 'radio' || attr.type === 'checkbox') return;
            
            elm.unbind('input').unbind('keydown').unbind('change');
            elm.bind('blur', function() {
                scope.$apply(function() {
                    ngModelCtrl.$setViewValue(elm.val());
                });         
            });
        }
    };
})
.directive('json', function($compile, $log, AjaxService, $cacheFactory, $rootScope) {
  return {
    restrict: 'E',
    scope: {
      child: '=',
      type: '@',
      defaultCollapsed: '=',
      hideCollapse: '=',
      key: '=',
      valueType: '=?valueType'
    },
    controller: function($scope) {},
    templateUrl: function(elem, attr){
        var type = attr.type;
        if (typeof type === 'undefined') {
            type = 'object';
        }
        type = type.charAt(0).toUpperCase() + type.slice(1);
        //return baseURL + '/bundles/fitmoduledefault/netopeerangular/templates/types/'+type+'.html';
        return 'types/'+type+'.html';
    },
    link: function(scope, element, attributes) {
        var stringName = "Text";
        var objectName = "Object";
        var arrayName = "Array";
        var listName = "List";
        var numberName = "Number";
        var urlName = "Url";
        var refName = "Reference";
        var boolName = "Boolean";
        var enumerationName = "Enumeration";
        var literalName = "Literal";

        scope.valueTypes = [stringName, objectName, arrayName, listName, numberName, urlName, refName, boolName, enumerationName, literalName];
        scope.sortableOptions = {
            axis: 'y',
            update: function(e, ui) {
                setParentChanged(scope.$parent);
                setIetfOperation('replace', scope.$parent.$parent.newkey, getParents($parent, 4).child, scope.$parent);
            }
        };
        if (scope.$parent.defaultCollapsed === undefined) {
            scope.collapsed = false;
        } else {
            scope.collapsed = scope.defaultCollapsed;
        }
        if (scope.collapsed) {
            scope.chevron = "fa-plus-square-o";
        } else {
            scope.chevron = "fa-minus-square-o";
        }
<commit_msg>netopeerangular: sorting array fix<commit_after>'use strict';

var counts = {
  object: 0
};

var schemaAjaxBlacklist = [];

var NetopeerGUI = angular.module('JSONedit', ['ui.sortable', 'ui.bootstrap', 'configurationTemplates', 'NetopeerGUIServices']);

NetopeerGUI.directive('ngModelOnblur', function() {
    // override the default input to update on blur
    // from http://jsfiddle.net/cn8VF/
    return {
        restrict: 'EAC',
        require: 'ngModel',
        link: function(scope, elm, attr, ngModelCtrl) {
            if (attr.type === 'radio' || attr.type === 'checkbox') return;
            
            elm.unbind('input').unbind('keydown').unbind('change');
            elm.bind('blur', function() {
                scope.$apply(function() {
                    ngModelCtrl.$setViewValue(elm.val());
                });         
            });
        }
    };
})
.directive('json', function($compile, $log, AjaxService, $cacheFactory, $rootScope) {
  return {
    restrict: 'E',
    scope: {
      child: '=',
      type: '@',
      defaultCollapsed: '=',
      hideCollapse: '=',
      key: '=',
      valueType: '=?valueType'
    },
    controller: function($scope) {},
    templateUrl: function(elem, attr){
        var type = attr.type;
        if (typeof type === 'undefined') {
            type = 'object';
        }
        type = type.charAt(0).toUpperCase() + type.slice(1);
        //return baseURL + '/bundles/fitmoduledefault/netopeerangular/templates/types/'+type+'.html';
        return 'types/'+type+'.html';
    },
    link: function(scope, element, attributes) {
        var stringName = "Text";
        var objectName = "Object";
        var arrayName = "Array";
        var listName = "List";
        var numberName = "Number";
        var urlName = "Url";
        var refName = "Reference";
        var boolName = "Boolean";
        var enumerationName = "Enumeration";
        var literalName = "Literal";

        scope.valueTypes = [stringName, objectName, arrayName, listName, numberName, urlName, refName, boolName, enumerationName, literalName];
        scope.sortableOptions = {
            axis: 'y',
            update: function(e, ui) {
                setParentChanged(scope.$parent);
                setIetfOperation('replace', getParents(scope.$parent, 1).newkey, getParents(scope.$parent, 1).child, getParents(scope.$parent, 4).child);
            }
        };

        if (scope.$parent.defaultCollapsed === undefined) {
            scope.collapsed = false;
        } else {
            scope.collapsed = scope.defaultCollapsed;
        }
        if (scope.collapsed) {
            scope.chevron = "fa-plus-square-o";
        } else {
            scope.chevron = "fa-minus-square-o";
        }

{'fraction_non_alphanumeric': 0.1494485294117647, 'fraction_numerical': 0.0022058823529411764, 'mean_word_length': 2.1487268518518516, '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': '4827780', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1573, 'n_words': 323}