<commit_before>
// Debug retina/non-retina by changing to 1/2
// window.devicePixelRatio = 1;

// Call this function and reload to enable liveReload when `grunt` is running
window.enableLiveReload = function(enable) {
    if ('localStorage' in window) {
        if (enable === true || typeof enable === 'undefined') {
            console.debug('Enabling LiveReload...')
            require(['//localhost:35729/livereload.js'], function() {
                console.debug('LiveReload successfully enabled');
            });
            localStorage.setItem('liveReloadEnabled', true);
        } else {
            console.debug('Disabling LiveReload')
            localStorage.removeItem('liveReloadEnabled');
        }
    }
}

window.switchLanguage = function(code) {
    var availableLocales = 'en es de fr it zh_TW'.split(' ');

    if (~availableLocales.indexOf(code)) {
        var parts = code.split('_');
        if (parts[0]) {
            localStorage.setItem('language', parts[0]);
        }
        if (parts[1]) {
            localStorage.setItem('country', parts[1]);
        }
        if (parts[2]) {
            localStorage.setItem('variant', parts[2]);
        }
        location.reload();
    } else console.error('Available Locales: ' + availableLocales.join(', '));
}

if ('localStorage' in window) {
    if (localStorage.getItem('liveReloadEnabled')) {
        enableLiveReload(true);
    }
}
window.gremlins = function() {
    require(['gremlins'], function(gremlins) {
        gremlins.createHorde()
        .gremlin(gremlins.species.formFiller())
        .gremlin(gremlins.species.clicker())
        .gremlin(
            gremlins.species.clicker()
            .clickTypes(['click'])
            .canClick(function(element) {
                return $(element).is('button,a,li') &&
                    $(element).closest('.logout').length === 0;
            }))
        .gremlin(gremlins.species.typer())
        .mogwai(gremlins.mogwais.fps())
        .unleash({nb: 1000});
    })
}

window.requestAnimationFrame =
    typeof window === 'undefined' ?
    function() { } :
    (
        window.requestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback) {
            setTimeout(callback, 1000 / 60);
        }
    );
window.TRANSITION_END = 'transitionend webkitTransitionEnd MSTransitionEnd oTransitionEnd otransitionend';
window.ANIMATION_END = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd oanimationend';

require([
    'jquery',
    'jqueryui',
    'bootstrap',
    'es5shim',
    'es5sham',

    'flight/lib/compose',
    'flight/lib/registry',
    'flight/lib/advice',
    'flight/lib/logger',
    'flight/lib/debug',

     // Make underscore available everywhere
    'underscore',

    'util/visibility',
    'util/privileges',
    'util/vertex/urlFormatters',
    'util/messages',
    'service/user',

    'easing',
    'scrollStop',
    'bootstrap-datepicker',
    'bootstrap-timepicker',
    'util/jquery.flight',
    'util/jquery.removePrefixedClasses',

    'util/handlebars/helpers'
],
function(jQuery,
         jQueryui,
         bootstrap,
         es5shim,
         es5sham,
         compose,
         registry,
         advice,
         withLogging,
         debug,
         _,
         Visibility,
         Privileges,
         F,
         messages,
         UserService) {
    'use strict';

    // Make localization global
    if ('i18n' in window) {
        console.error('i18n function exists');
    }
    window.i18n = messages;

    var App, FullScreenApp, Login;

    configureApplication();

    function configureApplication() {
        // Flight Logging
        try {
            debug.enable(true);
            DEBUG.events.logNone();
        } catch(e) {
            console.warn('Error enabling DEBUG mode for flight, probably because Safari Private Browsing enabled', e);
        }

        // Default templating
        _.templateSettings.escape = /\{([\s\S]+?)\}/g;<commit_msg>Set default config to disable flight debug<commit_after>
// Debug retina/non-retina by changing to 1/2
// window.devicePixelRatio = 1;

// Call this function and reload to enable liveReload when `grunt` is running
window.enableLiveReload = function(enable) {
    if ('localStorage' in window) {
        if (enable === true || typeof enable === 'undefined') {
            console.debug('Enabling LiveReload...')
            require(['//localhost:35729/livereload.js'], function() {
                console.debug('LiveReload successfully enabled');
            });
            localStorage.setItem('liveReloadEnabled', true);
        } else {
            console.debug('Disabling LiveReload')
            localStorage.removeItem('liveReloadEnabled');
        }
    }
}

window.switchLanguage = function(code) {
    var availableLocales = 'en es de fr it zh_TW'.split(' ');

    if (~availableLocales.indexOf(code)) {
        var parts = code.split('_');
        if (parts[0]) {
            localStorage.setItem('language', parts[0]);
        }
        if (parts[1]) {
            localStorage.setItem('country', parts[1]);
        }
        if (parts[2]) {
            localStorage.setItem('variant', parts[2]);
        }
        location.reload();
    } else console.error('Available Locales: ' + availableLocales.join(', '));
}

if ('localStorage' in window) {
    if (localStorage.getItem('liveReloadEnabled')) {
        enableLiveReload(true);
    }
}
window.gremlins = function() {
    require(['gremlins'], function(gremlins) {
        gremlins.createHorde()
        .gremlin(gremlins.species.formFiller())
        .gremlin(gremlins.species.clicker())
        .gremlin(
            gremlins.species.clicker()
            .clickTypes(['click'])
            .canClick(function(element) {
                return $(element).is('button,a,li') &&
                    $(element).closest('.logout').length === 0;
            }))
        .gremlin(gremlins.species.typer())
        .mogwai(gremlins.mogwais.fps())
        .unleash({nb: 1000});
    })
}

window.requestAnimationFrame =
    typeof window === 'undefined' ?
    function() { } :
    (
        window.requestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        function(callback) {
            setTimeout(callback, 1000 / 60);
        }
    );
window.TRANSITION_END = 'transitionend webkitTransitionEnd MSTransitionEnd oTransitionEnd otransitionend';
window.ANIMATION_END = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd oanimationend';

require([
    'jquery',
    'jqueryui',
    'bootstrap',
    'es5shim',
    'es5sham',

    'flight/lib/compose',
    'flight/lib/registry',
    'flight/lib/advice',
    'flight/lib/logger',
    'flight/lib/debug',

     // Make underscore available everywhere
    'underscore',

    'util/visibility',
    'util/privileges',
    'util/vertex/urlFormatters',
    'util/messages',
    'service/user',

    'easing',
    'scrollStop',
    'bootstrap-datepicker',
    'bootstrap-timepicker',
    'util/jquery.flight',
    'util/jquery.removePrefixedClasses',

    'util/handlebars/helpers'
],
function(jQuery,
         jQueryui,
         bootstrap,
         es5shim,
         es5sham,
         compose,
         registry,
         advice,
         withLogging,
         debug,
         _,
         Visibility,
         Privileges,
         F,
         messages,
         UserService) {
    'use strict';

    // Make localization global
    if ('i18n' in window) {
        console.error('i18n function exists');
    }
    window.i18n = messages;

    var App, FullScreenApp, Login;

    configureApplication();

    function configureApplication() {
        // Flight Logging
        try {
            debug.enable(false);
            DEBUG.events.logNone();
        } catch(e) {
            console.warn('Error enabling DEBUG mode for flight, probably because Safari Private Browsing enabled', e);
        }

        // Default templating
        _.templateSettings.escape = /\{([\s\S]+?)\}/g;
{'fraction_non_alphanumeric': 0.1330398630471998, 'fraction_numerical': 0.008559550012227928, 'mean_word_length': 2.257268020708881, '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': '1770136', 'n_tokens_mistral': 2467, 'n_tokens_neox': 2333, 'n_words': 437}