<commit_before><div id="initcmsnavadmin" style="display: none;"></div>
<script>/*<![CDATA[*/
{% spaceless %}
    {# Caution: the contents of this file are processed by Twig before loading
                them as JavaScript source code. Always use '/*' comments instead
                of '//' comments to avoid impossible-to-debug side-effects #}

    (function () {
        {% if 'top' == position %}
        var initcmsnavadmin = document.getElementById('initcmsnavadmin');
        document.body.insertBefore(
                document.body.removeChild(initcmsnavadmin),
                document.body.firstChild
        );
        {% endif %}

        loadBar(
                '{{ path("_initcms_admin_navbar", {'page_id': page_id ? page_id : 0}) }}',
                setUpBar
        );

    })();

    var noop = function () {};

    if (!window.jQuery) {
        var jqscript = document.createElement('script');
        jqscript.setAttribute("type", "text/javascript");
        jqscript.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js");
        document.getElementsByTagName("head")[0].appendChild(jqscript);
    }

    function loadDropdown() {
        +function ($) {
            'use strict';
            var backdrop = '.dropdown-backdrop';
            var toggle   = '[data-toggle="dropdown"]';
            var Dropdown = function (element) {
                $(element).on('click.bs.dropdown', this.toggle)
            };

            Dropdown.VERSION = '3.2.0';

            Dropdown.prototype.toggle = function (e) {
                var $this = $(this);

                if ($this.is('.disabled, :disabled')) return;

                var $parent  = getParent($this);
                var isActive = $parent.hasClass('open');

                clearMenus();
                if (!isActive) {
                    if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
                        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
                    }

                    var relatedTarget = { relatedTarget: this };
                    $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget));

                    if (e.isDefaultPrevented()) return;

                    $this.trigger('focus');

                    $parent
                            .toggleClass('open')
                            .trigger('shown.bs.dropdown', relatedTarget)
                }

                return false
            };

            Dropdown.prototype.keydown = function (e) {
                if (!/(38|40|27)/.test(e.keyCode)) return;

                var $this = $(this);

                e.preventDefault();
                e.stopPropagation();

                if ($this.is('.disabled, :disabled')) return;

                var $parent  = getParent($this);
                var isActive = $parent.hasClass('open');

                if (!isActive || (isActive && e.keyCode == 27)) {
                    if (e.which == 27) $parent.find(toggle).trigger('focus');
                    return $this.trigger('click')
                }

                var desc = ' li:not(.divider):visible a';
                var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc);

                if (!$items.length) return;

                var index = $items.index($items.filter(':focus'));

                if (e.keyCode == 38 && index > 0)                 index--;
                if (e.keyCode == 40 && index < $items.length - 1) index++ ;
                if (!~index)                                      index = 0;

                $items.eq(index).trigger('focus')
            };

            function clearMenus(e) {
                if (e && e.which === 3) return;
                $(backdrop).remove();
                $(toggle).each(function () {
                    var $parent = getParent($(this));
                    var relatedTarget = { relatedTarget: this };
                    if (!$parent.hasClass('open')) return;
                    $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget));
                    if (e.isDefaultPrevented()) return;
                    $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
                })
            }

            function getParent($this) {
                var selector = $this.attr('data-target');

                if (!selector) {
                    selector = $this.attr('href');
                    selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '');
                }

                var $parent = selector && $(selector);

                return $parent && $parent.length ? $parent : $this.parent()
            }


            function Plugin(option) {
                return this.each(function () {
                    var $this = $(this);
                    var data  = $this.data('bs.dropdown');

                    if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)));
                    if (typeof option == 'string') data[option].call($this)
                })
            }

            var old = $.fn.dropdown;

            $.fn.dropdown             = Plugin;
            $.fn.dropdown.Constructor = Dropdown;


            $.fn.dropdown.noConflict = function () {
                $.fn.dropdown = old;
                return this
            };

            $(document)
                    .on('click.bs.dropdown.data-api', clearMenus)
                    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
                    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
                    .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)

        }(window.jQuery);
    }

    function loadBar(url, onSuccess, onError, options) {
        var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
        options = options || {};
        xhr.open(options.method || 'GET', url, true);
        xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
        xhr.onreadystatechange = function () {
            if (4 === xhr.readyState && 200 === xhr.status) {
                (onSuccess || noop)(xhr);
            } else if (4 === xhr.readyState && xhr.status != 200) {
                (onError || noop)(xhr);
            }
        };
        xhr.send('');
    };

    function setUpBar(xhr) {
        var initcmsnavadmin = document.getElementById('initcmsnavadmin');
        initcmsnavadmin.innerHTML = xhr.responseText;
        initcmsnavadmin.style.display = 'block';
        if(!jQuery.isFunction(jQuery.fn.dropdown)){
            loadDropdown();
        }
        jQuery('.navbar-initcms').show();

    };
{% endspaceless %}
/*]]>*/</script><commit_msg>load only if logged in<commit_after><!-- load bar -->
{% if is_granted('ROLE_SONATA_ADMIN') %}
<div id="initcmsnavadmin" style="display: none;"></div>
<script>/*<![CDATA[*/
{% spaceless %}
    {# Caution: the contents of this file are processed by Twig before loading
                them as JavaScript source code. Always use '/*' comments instead
                of '//' comments to avoid impossible-to-debug side-effects #}

    (function () {
        {% if 'top' == position %}
        var initcmsnavadmin = document.getElementById('initcmsnavadmin');
        document.body.insertBefore(
                document.body.removeChild(initcmsnavadmin),
                document.body.firstChild
        );
        {% endif %}

        loadBar(
                '{{ path("_initcms_admin_navbar", {'page_id': page_id ? page_id : 0}) }}',
                setUpBar
        );

    })();

    var noop = function () {};

    if (!window.jQuery) {
        var jqscript = document.createElement('script');
        jqscript.setAttribute("type", "text/javascript");
        jqscript.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js");
        document.getElementsByTagName("head")[0].appendChild(jqscript);
    }

    function loadDropdown() {
        +function ($) {
            'use strict';
            var backdrop = '.dropdown-backdrop';
            var toggle   = '[data-toggle="dropdown"]';
            var Dropdown = function (element) {
                $(element).on('click.bs.dropdown', this.toggle)
            };

            Dropdown.VERSION = '3.2.0';

            Dropdown.prototype.toggle = function (e) {
                var $this = $(this);

                if ($this.is('.disabled, :disabled')) return;

                var $parent  = getParent($this);
                var isActive = $parent.hasClass('open');

                clearMenus();
                if (!isActive) {
                    if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
                        $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
                    }

                    var relatedTarget = { relatedTarget: this };
                    $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget));

                    if (e.isDefaultPrevented()) return;

                    $this.trigger('focus');

                    $parent
                            .toggleClass('open')
                            .trigger('shown.bs.dropdown', relatedTarget)
                }

                return false
            };

            Dropdown.prototype.keydown = function (e) {
                if (!/(38|40|27)/.test(e.keyCode)) return;

                var $this = $(this);

                e.preventDefault();
                e.stopPropagation();

                if ($this.is('.disabled, :disabled')) return;

                var $parent  = getParent($this);
                var isActive = $parent.hasClass('open');

                if (!isActive || (isActive && e.keyCode == 27)) {
                    if (e.which == 27) $parent.find(toggle).trigger('focus');
                    return $this.trigger('click')
                }

                var desc = ' li:not(.divider):visible a';
                var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc);

                if (!$items.length) return;

                var index = $items.index($items.filter(':focus'));

                if (e.keyCode == 38 && index > 0)                 index--;
                if (e.keyCode == 40 && index < $items.length - 1) index++ ;
                if (!~index)                                      index = 0;

                $items.eq(index).trigger('focus')
            };

            function clearMenus(e) {
                if (e && e.which === 3) return;
                $(backdrop).remove();
                $(toggle).each(function () {
                    var $parent = getParent($(this));
                    var relatedTarget = { relatedTarget: this };
                    if (!$parent.hasClass('open')) return;
                    $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget));
                    if (e.isDefaultPrevented()) return;
                    $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
                })
            }

            function getParent($this) {
                var selector = $this.attr('data-target');

                if (!selector) {
                    selector = $this.attr('href');
                    selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '');
                }

                var $parent = selector && $(selector);

                return $parent && $parent.length ? $parent : $this.parent()
            }


            function Plugin(option) {
                return this.each(function () {
                    var $this = $(this);
                    var data  = $this.data('bs.dropdown');

                    if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)));
                    if (typeof option == 'string') data[option].call($this)
                })
            }

            var old = $.fn.dropdown;

            $.fn.dropdown             = Plugin;
            $.fn.dropdown.Constructor = Dropdown;


            $.fn.dropdown.noConflict = function () {
                $.fn.dropdown = old;
                return this
            };

            $(document)
                    .on('click.bs.dropdown.data-api', clearMenus)
                    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
                    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
                    .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)

        }(window.jQuery);
    }

    function loadBar(url, onSuccess, onError, options) {
        var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
        options = options || {};
        xhr.open(options.method || 'GET', url, true);
        xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
        xhr.onreadystatechange = function () {
            if (4 === xhr.readyState && 200 === xhr.status) {
                (onSuccess || noop)(xhr);
            } else if (4 === xhr.readyState && xhr.status != 200) {
                (onError || noop)(xhr);
            }
        };
        xhr.send('');
    };

    function setUpBar(xhr) {
        var initcmsnavadmin = document.getElementById('initcmsnavadmin');
        initcmsnavadmin.innerHTML = xhr.responseText;
        initcmsnavadmin.style.display = 'block';
        if(!jQuery.isFunction(jQuery.fn.dropdown)){
            loadDropdown();
        }
        jQuery('.navbar-initcms').show();

    };
{% endspaceless %}
/*]]>*/</script>
{% endif %}
<!-- end load bar -->
{'fraction_non_alphanumeric': 0.15251324645567807, 'fraction_numerical': 0.005012172418731205, 'mean_word_length': 1.5529153719612503, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2359285', 'n_tokens_mistral': 3935, 'n_tokens_neox': 3583, 'n_words': 704}