app.js 5.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 *  app.js
 *
 *  Created by Alexander Yuzhin on 12/27/13
 *  Copyright (c) 2013 Ascensio System SIA. All rights reserved.
 *
 */

'use strict';

require.config({
    // The shim config allows us to configure dependencies for
    // scripts that do not call define() to register a module
    baseUrl: '../../',
    paths: {
Alexander.Trofimov's avatar
Alexander.Trofimov committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
        jquery          : '../vendor/jquery/jquery',
        underscore      : '../vendor/underscore/underscore',
        backbone        : '../vendor/backbone/backbone',
        bootstrap       : '../vendor/bootstrap/dist/js/bootstrap',
        text            : '../vendor/requirejs-text/text',
        perfectscrollbar: 'common/main/lib/mods/perfect-scrollbar',
        jmousewheel     : '../vendor/perfect-scrollbar/src/jquery.mousewheel',
        xregexp         : '../vendor/xregexp/xregexp-all-min',
        sockjs          : '../vendor/sockjs/sockjs.min',
        jszip           : '../vendor/jszip/jszip.min',
        jsziputils      : '../vendor/jszip-utils/jszip-utils.min',
        jsrsasign       : '../vendor/jsrsasign/jsrsasign-latest-all-min',
        allfonts        : '../sdk/Common/AllFonts',
        //sdk             : '../sdk/Word/sdk-all',
        api             : 'api/documents/api',
        core            : 'common/main/lib/core/application',
        notification    : 'common/main/lib/core/NotificationCenter',
        keymaster       : 'common/main/lib/core/keymaster',
        tip             : 'common/main/lib/util/Tip',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
35
        localstorage    : 'common/main/lib/util/LocalStorage',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
36 37 38 39 40
        analytics       : 'common/Analytics',
        gateway         : 'common/Gateway',
        locale          : 'common/locale',
        irregularstack  : 'common/IrregularStack'
    },
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
//    urlArgs: "_dc=" +  (new Date()).getTime(), // debug only, be sure to remove it before deploying your code.
    shim: {
        underscore: {
            exports: '_'
        },
        backbone: {
            deps: [
                'underscore',
                'jquery'
            ],
            exports: 'Backbone'
        },
        bootstrap: {
            deps: [
                'jquery'
            ]
        },
        perfectscrollbar: {
            deps: [
                'jmousewheel'
            ]
        },
        notification: {
            deps: [
                'backbone'
            ]
        },
        core: {
            deps: [
                'backbone',
                'notification',
                'irregularstack'
            ]
        },
75 76 77 78 79 80 81 82
        sdk: {
            deps: [
                'jquery',
                'underscore',
                'allfonts',
                'xregexp',
                'sockjs',
                'jszip',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
83 84
                'jsziputils',
                'jsrsasign'
85 86
            ]
        },
87 88 89 90 91 92 93 94 95 96 97 98 99 100
        gateway: {
            deps: [
                'jquery'
            ]
        },
        analytics: {
            deps: [
                'jquery'
            ]
        }
    }
});

require([
Alexander.Trofimov's avatar
Alexander.Trofimov committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114
    'backbone',
    'bootstrap',
    'core',
    //'sdk',
    'api',
    'analytics',
    'gateway',
    'locale',
    'jszip',
    'jsziputils',
    'jsrsasign',
    'allfonts',
	'sockjs',
	'underscore'
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
], function (Backbone, Bootstrap, Core) {
    Backbone.history.start();

    /**
     * Application instance with DE namespace defined
     */
    var app = new Backbone.Application({
        nameSpace: 'DE',
        autoCreate: false,
        controllers : [
            'Viewport',
            'DocumentHolder',
            'Toolbar',
            'Statusbar',
            'RightMenu',
            'LeftMenu',
            'Main',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
132 133
            'Common.Controllers.Fonts',
            'Common.Controllers.History'
Alexander.Trofimov's avatar
Alexander.Trofimov committed
134 135 136 137
            /** coauthoring begin **/
            ,'Common.Controllers.Chat'
            ,'Common.Controllers.Comments'
            /** coauthoring end **/
138
            /** proprietary begin **/
Alexander.Trofimov's avatar
Alexander.Trofimov committed
139
            ,'Common.Controllers.ExternalDiagramEditor'
140
            /** proprietary end **/
Alexander.Trofimov's avatar
Alexander.Trofimov committed
141
            ,'Common.Controllers.ExternalMergeEditor'
Alexander.Trofimov's avatar
Alexander.Trofimov committed
142
            ,'Common.Controllers.ReviewChanges'
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
        ]
    });

    Common.Locale.apply();

    require([
        'documenteditor/main/app/controller/Viewport',
        'documenteditor/main/app/controller/DocumentHolder',
        'documenteditor/main/app/controller/Toolbar',
        'documenteditor/main/app/controller/Statusbar',
        'documenteditor/main/app/controller/RightMenu',
        'documenteditor/main/app/controller/LeftMenu',
        'documenteditor/main/app/controller/Main',
        'documenteditor/main/app/view/ParagraphSettings',
        'documenteditor/main/app/view/HeaderFooterSettings',
        'documenteditor/main/app/view/ImageSettings',
        'documenteditor/main/app/view/TableSettings',
        'documenteditor/main/app/view/ShapeSettings',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
161
        'documenteditor/main/app/view/TextArtSettings',
162
        'common/main/lib/util/utils',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
163
        'common/main/lib/util/LocalStorage',
Alexander.Trofimov's avatar
Alexander.Trofimov committed
164 165
        'common/main/lib/controller/Fonts',
        'common/main/lib/controller/History'
Alexander.Trofimov's avatar
Alexander.Trofimov committed
166 167 168 169
        /** coauthoring begin **/
        ,'common/main/lib/controller/Comments'
        ,'common/main/lib/controller/Chat'
        /** coauthoring end **/
170
        /** proprietary begin **/
Alexander.Trofimov's avatar
Alexander.Trofimov committed
171 172
        ,'documenteditor/main/app/view/ChartSettings'
        ,'common/main/lib/controller/ExternalDiagramEditor'
173
        /** proprietary end **/
Alexander.Trofimov's avatar
Alexander.Trofimov committed
174
        ,'common/main/lib/controller/ExternalMergeEditor'
Alexander.Trofimov's avatar
Alexander.Trofimov committed
175
        ,'common/main/lib/controller/ReviewChanges'
176 177 178 179 180
    ], function() {
        app.start();
    });

});