{"size": 2812, "ext": "js", "max_stars_repo_path": "app/Application.js", "max_stars_repo_name": "LatinWarrior/MasteringExtJS5Client", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/Application.js", "max_issues_repo_name": "LatinWarrior/MasteringExtJS5Client", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/Application.js", "max_forks_repo_name": "LatinWarrior/MasteringExtJS5Client", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.3009708738, "max_line_length": 98, "alphanum_fraction": 0.5547652916}
/**
 * The main application class. An instance of this class is created by app.js when it calls
 * Ext.application(). This is the ideal place to handle application launch and initialization
 * details.
 */

// Load country locale stuff here before we do anything else.
function loadLocale() {
    var lang = localStorage ? (localStorage.getItem('user-lang') || 'en') : 'en',
        extJsFile = Ext.util.Format.format("resources/locale/{0}.js", lang);
    //extJsFile = Ext.util.Format.format("ext/packages/ext-locale/build/ext-locale-{0}.js", lang);

    //Ext.Loader.loadScript({url: file, onError: function(){
    //    alert('Error loading locale file. Please contact system administrator.');
    //}});

    Ext.Loader.loadScript({
        url: extJsFile, onError: function () {
            alert('Error loading locale file. Please contact system administrator.');
        }
    });
}

loadLocale();

Ext.define('Packt.Application', {

    extend: 'Ext.app.Application',

    name: 'Packt',

    requires: [
        'Packt.overrides.tree.ColumnOverride'
    ],

    controllers: [
        //'Root',
        'Menu'
    ],

    stores: [
        // TODO: add global / shared stores here
    ],

    views: [
        'login.Login'
    ],

    enableQuickTips: true,

    glyphFontFamily: 'FontAwesome',

    launch: function () {
        // TODO - Launch the application

        //Ext.tip.QuickTipManager.init();

        console.log('In launch function of Application.js');

        var me = this;

        var task = new Ext.util.DelayedTask(function () {

            // Fade out the body mask
            me.splashscreen.fadeOut({
                duration: 1000,
                remove: true
            });

            // Fade out the icon and message
            me.splashscreen.next().fadeOut({
                duration: 1000,
                remove: true,
                listeners: {
                    afteranimate: function (el, startTime, eOpts) {
                        //console.log('launch');
                        //Ext.widget('login-dialog');
                        Ext.create('Packt.view.login.Login')
                    }
                }
            });

            Ext.getBody().unmask();
        });

        task.delay(2000);
    },

    init: function () {
        var me = this;
        // Start the mask on the body and get a reference to the mask
        me.splashscreen = Ext.getBody().mask('Loading application', 'splashscreen');

        // Add a new class to this mask as we want it to look different from the default.
        me.splashscreen.addCls('splashscreen');

        // Insert a new div before the loading icon where we can place our logo.
        Ext.DomHelper.insertFirst(Ext.query('.x-mask-msg')[0], {
            cls: 'x-splash-icon'
        });
    }
});
