<commit_before>{BrunchApplication} = require './helpers'

MainRouter = require 'routers/main_router'
MainView = require 'views/main'


class exports.Application extends BrunchApplication
    # This callback would be executed on document ready event.
    # If you have a big application, perhaps it's a good idea to
    # group things by their type e.g. `@views = {}; @views.home = new HomeView`.
    initialize: ->
        @initializeJQueryExtensions()

        $.ajax('/api/instances/')
        .done (instances) =>
            @instance = instances?.rows?[0]
            @locale = @instance?.locale or 'en'
            @initialize2()
        .fail =>
            @locale = 'en'
            @initialize2()

    initialize2: ->
        try
            locales = require 'locales/' + @locale
        catch err
            locales = require 'locales/en'

        window.app = @

        @polyglot = new Polyglot()
        @polyglot.extend locales
        window.t = @polyglot.t.bind @polyglot

        @routers = {}
        @mainView =  new MainView()
        @routers.main = new MainRouter()

        # render layout
        #$("body").html @mainView.el

        Backbone.history.start()
        if Backbone.history.getFragment() is ''
            @routers.main.navigate 'home', true

        url = window.location.origin
        pathToSocketIO = "#{window.location.pathname.substring(1)}socket.io"
        console.log url
        socket = io.connect url, resource: pathToSocketIO
        socket.on 'installerror', (err) ->
            console.log "An error occured while attempting to install app"
            console.log err

new exports.Application
<commit_msg>Removed: useless log<commit_after>{BrunchApplication} = require './helpers'

MainRouter = require 'routers/main_router'
MainView = require 'views/main'


class exports.Application extends BrunchApplication
    # This callback would be executed on document ready event.
    # If you have a big application, perhaps it's a good idea to
    # group things by their type e.g. `@views = {}; @views.home = new HomeView`.
    initialize: ->
        @initializeJQueryExtensions()

        $.ajax('/api/instances/')
        .done (instances) =>
            @instance = instances?.rows?[0]
            @locale = @instance?.locale or 'en'
            @initialize2()
        .fail =>
            @locale = 'en'
            @initialize2()

    initialize2: ->
        try
            locales = require 'locales/' + @locale
        catch err
            locales = require 'locales/en'

        window.app = @

        @polyglot = new Polyglot()
        @polyglot.extend locales
        window.t = @polyglot.t.bind @polyglot

        @routers = {}
        @mainView =  new MainView()
        @routers.main = new MainRouter()

        # render layout
        #$("body").html @mainView.el

        Backbone.history.start()
        if Backbone.history.getFragment() is ''
            @routers.main.navigate 'home', true

        url = window.location.origin
        pathToSocketIO = "#{window.location.pathname.substring(1)}socket.io"
        socket = io.connect url, resource: pathToSocketIO
        socket.on 'installerror', (err) ->
            console.log "An error occured while attempting to install app"
            console.log err

new exports.Application

{'fraction_non_alphanumeric': 0.11181625868842551, 'fraction_numerical': 0.0030220610456331218, 'mean_word_length': 2.1109022556390977, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6584789', 'n_tokens_mistral': 929, 'n_tokens_neox': 910, 'n_words': 250}