aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/views/home.js
blob: 998af1c041acccdd6032a46ddc55ec16bc7deaa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        HomeView: FMS.FMSView.extend({
            template: 'home',
            id: 'front-page',

            afterRender: function() {
                /*
                if ( !can_geolocate && ( !navigator.network || !navigator.network.connection ) ) {
                    geocheck_count++;
                    window.setTimeout( decide_front_page, 1000 );
                    return;
                }

                // sometime onDeviceReady does not fire so set this here to be sure
                can_geolocate = true;

                geocheck_count = 0;
               */

                $('#locating').show();

            },

            afterDisplay: function() {
                $('#load-screen').hide();
                if ( FMS.isOffline ) {
                    this.navigate( 'offline' );
                } else if ( FMS.currentDraft && (
                    FMS.currentDraft.get('title') || FMS.currentDraft.get('lat') ||
                    FMS.currentDraft.get('details') || FMS.currentDraft.get('file') )
                ) {
                    this.navigate( 'existing' );
                } else {
                    this.navigate( 'around' );
                }
            }
        })
    });
})(FMS, Backbone, _, $);