<commit_before>$(function(){
    var root = window || {};
    root = root.GravJS = root.GravJS || {};

    //Make it global because used by ./forms/form.js
    root.currentValues = getState();
    var clickedLink;

    // selectize
    var pageFilter = $('input.page-filter'),
        pageTypes = pageFilter.data('template-types'),
        options = [
            {flag: 'Modular', key: 'Modular', cat: 'mode'},
            {flag: 'Visible', key: 'Visible', cat: 'mode'},
            {flag: 'Routable', key: 'Routable', cat: 'mode'},
            {flag: 'Published', key: 'Published', cat: 'mode'},
            {flag: 'Non-Modular', key: 'NonModular', cat: 'mode'},
            {flag: 'Non-Visible', key: 'NonVisible', cat: 'mode'},
            {flag: 'Non-Routable', key: 'NonRoutable', cat: 'mode'},
            {flag: 'Non-Published', key: 'NonPublished', cat: 'mode'},
        ];

    if (pageFilter && pageTypes) {
        jQuery.each(pageTypes, function(key, name){
            options.push({flag: name, key: key, cat: 'type'});
        })

        pageFilter.selectize({
            maxItems: null,
            valueField: 'key',
            labelField: 'flag',
            searchField: ['flag', 'key'],
            options: options,
            optgroups: [
                {id: 'mode', name: 'Page Modes'},
                {id: 'type', name: 'Page Types'},
            ],
            optgroupField: 'cat',
            optgroupLabelField: 'name',
            optgroupValueField: 'id',
            optgroupOrder: ['mode', 'type'],
            plugins: ['optgroup_columns']
        });
    }

    var childrenToggles = $('[data-toggle="children"]'),
        storage = sessionStorage.getItem('grav:admin:pages'),
        collapseAll = function(store) {
            childrenToggles.each(function(i, element){
                var icon = $(element).find('.page-icon'),
                    open = icon.hasClass('children-open'),
                    key = $(element).closest('[data-nav-id]').data('nav-id'),
                    children = $(element).closest('li.page-item').find('ul:first');

                if (open) {
                    children.hide();
                    if (store) delete storage[key];
                    icon.removeClass('children-open').addClass('children-closed');<commit_msg>Fix for JS error in Safari private browsing, #272<commit_after>$(function(){
    var root = window || {};
    root = root.GravJS = root.GravJS || {};

    //Make it global because used by ./forms/form.js
    root.currentValues = getState();
    var clickedLink;

    // selectize
    var pageFilter = $('input.page-filter'),
        pageTypes = pageFilter.data('template-types'),
        options = [
            {flag: 'Modular', key: 'Modular', cat: 'mode'},
            {flag: 'Visible', key: 'Visible', cat: 'mode'},
            {flag: 'Routable', key: 'Routable', cat: 'mode'},
            {flag: 'Published', key: 'Published', cat: 'mode'},
            {flag: 'Non-Modular', key: 'NonModular', cat: 'mode'},
            {flag: 'Non-Visible', key: 'NonVisible', cat: 'mode'},
            {flag: 'Non-Routable', key: 'NonRoutable', cat: 'mode'},
            {flag: 'Non-Published', key: 'NonPublished', cat: 'mode'},
        ];

    if (pageFilter && pageTypes) {
        jQuery.each(pageTypes, function(key, name){
            options.push({flag: name, key: key, cat: 'type'});
        })

        pageFilter.selectize({
            maxItems: null,
            valueField: 'key',
            labelField: 'flag',
            searchField: ['flag', 'key'],
            options: options,
            optgroups: [
                {id: 'mode', name: 'Page Modes'},
                {id: 'type', name: 'Page Types'},
            ],
            optgroupField: 'cat',
            optgroupLabelField: 'name',
            optgroupValueField: 'id',
            optgroupOrder: ['mode', 'type'],
            plugins: ['optgroup_columns']
        });
    }

    try {
        sessionStorage.setItem('sessionStorage', 1);
        sessionStorage.removeItem('sessionStorage');
    } catch (e) {
        Storage.prototype._setItem = Storage.prototype.setItem;
        Storage.prototype.setItem = function() {};
    }

    var childrenToggles = $('[data-toggle="children"]'),
        storage = sessionStorage.getItem('grav:admin:pages'),
        collapseAll = function(store) {
            childrenToggles.each(function(i, element){
                var icon = $(element).find('.page-icon'),
                    open = icon.hasClass('children-open'),
                    key = $(element).closest('[data-nav-id]').data('nav-id'),
                    children = $(element).closest('li.page-item').find('ul:first');

                if (open) {
                    children.hide();
                    if (store) delete storage[key];
                    icon.removeClass('children-open').addClass('children-closed');
{'fraction_non_alphanumeric': 0.1680277664352797, 'fraction_numerical': 0.0008166598611678236, 'mean_word_length': 1.9744990892531875, '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': '5296233', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1343, 'n_words': 307}