function loadApplicationTypeBasedOnUrlHash(e) {
        var toOpen = F.vertexUrl.parametersInUrl(location.href),

            ids = toOpen && toOpen.vertexIds,

            workspaceId = toOpen && toOpen.workspaceId,

            // Is this the popoout details app? ids passed to hash?
            popoutDetails = !!(toOpen && toOpen.type === 'FULLSCREEN' && ids.length),

            // If this is a hash change
            event = e && e.originalEvent,

            // Is this the default visallo application?
            mainApp = !popoutDetails;

        if (event && isAddUrl(event.oldURL) && isMainApp(event.newURL)) {
            return;
        }

        if (event && isPopoutUrl(event.oldURL) && isPopoutUrl(event.newURL)) {
            return $('#app').trigger('vertexUrlChanged', {
                graphVertexIds: ids,
                workspaceId: workspaceId
            });
        }

        withDataRequest.dataRequest('user', 'me')
            .then(function() {
                attachApplication(false);
            })
            .catch(function() {
                attachApplication(true, '', {});
            })

        function attachApplication(loginRequired, message, options) {
            updateVisalloLoadingProgress('Extensions');

            if (!event) {
                $('html')
                    .toggleClass('fullscreenApp', mainApp)
                    .toggleClass('fullscreenDetails', popoutDetails);

                window.isFullscreenDetails = popoutDetails;
            }

            visalloData.isFullscreen = false;

            if (loginRequired) {
                require(['../plugins-before-auth'], function() {
                    updateVisalloLoadingProgress('User Interface');

                    $(document).one('loginSuccess', function() {
                        document.addEventListener('pluginsLoaded', function loaded() {
                            document.removeEventListener('pluginsLoaded', loaded);
                            loginSuccess(true);
                        }, false);
                        document.dispatchEvent(new Event('readyForPlugins'));
                    });

                    require(['login'], function(Login) {
                        removeVisalloLoading().then(function() {
                            Login.teardownAll();
                            Login.attachTo('#login', {
                                errorMessage: message,
                                errorMessageOptions: options,
                                toOpen: toOpen
                            });
                        })
                    });
                })
            } else {
                document.addEventListener('pluginsLoaded', function loaded() {
                    updateVisalloLoadingProgress('User Interface');

                    document.removeEventListener('pluginsLoaded', loaded);
                    loginSuccess(false);
                }, false);
                document.dispatchEvent(new Event('readyForPlugins'));
            }
        }

        function loginSuccess(animate) {
            if (animate && (/^#?[a-z]+=/i).test(location.hash)) {
                window.location.reload();
            } else {
                withDataRequest.dataRequest('user', 'me').then(function() {

                    require([
                        'moment',
                        'bootstrap',
                        'jqueryui',
                        'easing',
                        'jquery-scrollstop',
                        'bootstrap-datepicker',
                        'bootstrap-timepicker',
                        'util/formatters',
                        'util/visibility/util',
                        'util/handlebars/after_auth_helpers'
                    ], function(moment) {
                        var language = 'en';
                        try {
                            var languagePref = localStorage.getItem('language');
                            if (languagePref) {
                                language = languagePref;
                            }
                        } catch(langerror) { /*eslint no-empty:0 */ }
                        moment.locale(language);

                        // Default datepicker options
                        $.fn.datepicker.defaults.format = 'yyyy-mm-dd';
                        $.fn.datepicker.defaults.autoclose = true;

                        if (popoutDetails) {
                            visalloData.isFullscreen = true;
                            $('#login').remove();
                            require(['appFullscreenDetails'], function(comp) {
                                removeVisalloLoading().then(function() {
                                    if (event) {
                                        location.reload();
                                    } else {
                                        if (App) {
                                            App.teardownAll();
                                        }
                                        FullScreenApp = comp;
                                        FullScreenApp.teardownAll();
                                        FullScreenApp.attachTo('#app', {
                                            graphVertexIds: ids,
                                            workspaceId: workspaceId
                                        });
                                    }
                                });
                            });
                        } else {
                            if (!animate) {
                                $('#login').remove();
                            }
                            require(['app'], function(comp) {
                                removeVisalloLoading().then(function() {
                                    App = comp;
                                    if (event) {
                                        location.reload();
                                    } else {
                                        if (FullScreenApp) {
                                            FullScreenApp.teardownAll();
                                        }
                                        App.teardownAll();
                                        var appOptions = {};
                                        if (toOpen && toOpen.type === 'ADD' && ids.length) {
                                            appOptions.addVertexIds = toOpen;
                                        }
                                        if (toOpen && toOpen.type === 'ADMIN' && toOpen.section && toOpen.name) {
                                            appOptions.openAdminTool = _.pick(toOpen, 'section', 'name');
                                        }
                                        if (animate) {
                                            $('#login .authentication button.loading').removeClass('loading');
                                            appOptions.animateFromLogin = true;
                                        }

                                        App.attachTo('#app', appOptions);
                                        _.defer(function() {
                                            // Cache login in case server goes down
                                            require(['login']);
                                        });

                                        if (animate) {
                                            $('#login .logo').one(TRANSITION_END, function() {
                                                $('#login')
                                                    .find('.authentication').teardownAllComponents()
                                                    .end().teardownAllComponents();
                                            });
                                        }
                                    }
                                });
                            });
                        }
                    });
                });
            }
        }
    }
/**
     * Switch between visallo and visallo-fullscreen-details based on url hash
     */
Switch between visallo and visallo-fullscreen-details based on url hash
Switch between visallo and visallo - fullscreen - details based on url hash
function loadApplicationTypeBasedOnUrlHash(e) {
        var toOpen = F.vertexUrl.parametersInUrl(location.href),
            ids = toOpen && toOpen.vertexIds,
            workspaceId = toOpen && toOpen.workspaceId,
            popoutDetails = !!(toOpen && toOpen.type === 'FULLSCREEN' && ids.length),
            event = e && e.originalEvent,
            mainApp = !popoutDetails;
        if (event && isAddUrl(event.oldURL) && isMainApp(event.newURL)) {
            return;
        }
        if (event && isPopoutUrl(event.oldURL) && isPopoutUrl(event.newURL)) {
            return $('#app').trigger('vertexUrlChanged', {
                graphVertexIds: ids,
                workspaceId: workspaceId
            });
        }
        withDataRequest.dataRequest('user', 'me')
            .then(function() {
                attachApplication(false);
            })
            .catch(function() {
                attachApplication(true, '', {});
            })
        function attachApplication(loginRequired, message, options) {
            updateVisalloLoadingProgress('Extensions');
            if (!event) {
                $('html')
                    .toggleClass('fullscreenApp', mainApp)
                    .toggleClass('fullscreenDetails', popoutDetails);
                window.isFullscreenDetails = popoutDetails;
            }
            visalloData.isFullscreen = false;
            if (loginRequired) {
                require(['../plugins-before-auth'], function() {
                    updateVisalloLoadingProgress('User Interface');
                    $(document).one('loginSuccess', function() {
                        document.addEventListener('pluginsLoaded', function loaded() {
                            document.removeEventListener('pluginsLoaded', loaded);
                            loginSuccess(true);
                        }, false);
                        document.dispatchEvent(new Event('readyForPlugins'));
                    });
                    require(['login'], function(Login) {
                        removeVisalloLoading().then(function() {
                            Login.teardownAll();
                            Login.attachTo('#login', {
                                errorMessage: message,
                                errorMessageOptions: options,
                                toOpen: toOpen
                            });
                        })
                    });
                })
            } else {
                document.addEventListener('pluginsLoaded', function loaded() {
                    updateVisalloLoadingProgress('User Interface');
                    document.removeEventListener('pluginsLoaded', loaded);
                    loginSuccess(false);
                }, false);
                document.dispatchEvent(new Event('readyForPlugins'));
            }
        }
        function loginSuccess(animate) {
            if (animate && (/^#?[a-z]+=/i).test(location.hash)) {
                window.location.reload();
            } else {
                withDataRequest.dataRequest('user', 'me').then(function() {
                    require([
                        'moment',
                        'bootstrap',
                        'jqueryui',
                        'easing',
                        'jquery-scrollstop',
                        'bootstrap-datepicker',
                        'bootstrap-timepicker',
                        'util/formatters',
                        'util/visibility/util',
                        'util/handlebars/after_auth_helpers'
                    ], function(moment) {
                        var language = 'en';
                        try {
                            var languagePref = localStorage.getItem('language');
                            if (languagePref) {
                                language = languagePref;
                            }
                        } catch(langerror) {  }
                        moment.locale(language);
                        $.fn.datepicker.defaults.format = 'yyyy-mm-dd';
                        $.fn.datepicker.defaults.autoclose = true;
                        if (popoutDetails) {
                            visalloData.isFullscreen = true;
                            $('#login').remove();
                            require(['appFullscreenDetails'], function(comp) {
                                removeVisalloLoading().then(function() {
                                    if (event) {
                                        location.reload();
                                    } else {
                                        if (App) {
                                            App.teardownAll();
                                        }
                                        FullScreenApp = comp;
                                        FullScreenApp.teardownAll();
                                        FullScreenApp.attachTo('#app', {
                                            graphVertexIds: ids,
                                            workspaceId: workspaceId
                                        });
                                    }
                                });
                            });
                        } else {
                            if (!animate) {
                                $('#login').remove();
                            }
                            require(['app'], function(comp) {
                                removeVisalloLoading().then(function() {
                                    App = comp;
                                    if (event) {
                                        location.reload();
                                    } else {
                                        if (FullScreenApp) {
                                            FullScreenApp.teardownAll();
                                        }
                                        App.teardownAll();
                                        var appOptions = {};
                                        if (toOpen && toOpen.type === 'ADD' && ids.length) {
                                            appOptions.addVertexIds = toOpen;
                                        }
                                        if (toOpen && toOpen.type === 'ADMIN' && toOpen.section && toOpen.name) {
                                            appOptions.openAdminTool = _.pick(toOpen, 'section', 'name');
                                        }
                                        if (animate) {
                                            $('#login .authentication button.loading').removeClass('loading');
                                            appOptions.animateFromLogin = true;
                                        }
                                        App.attachTo('#app', appOptions);
                                        _.defer(function() {
                                            require(['login']);
                                        });
                                        if (animate) {
                                            $('#login .logo').one(TRANSITION_END, function() {
                                                $('#login')
                                                    .find('.authentication').teardownAllComponents()
                                                    .end().teardownAllComponents();
                                            });
                                        }
                                    }
                                });
                            });
                        }
                    });
                });
            }
        }
    }
function loadApplicationTypeBasedOnUrlHash ( e ) { var toOpen = F . vertexUrl . parametersInUrl ( location . href ) , ids = toOpen && toOpen . vertexIds , workspaceId = toOpen && toOpen . workspaceId , popoutDetails = ! ! ( toOpen && toOpen . type === 'FULLSCREEN' && ids . length ) , event = e && e . originalEvent , mainApp = ! popoutDetails ; if ( event && isAddUrl ( event . oldURL ) && isMainApp ( event . newURL ) ) { return ; } if ( event && isPopoutUrl ( event . oldURL ) && isPopoutUrl ( event . newURL ) ) { return $ ( '#app' ) . trigger ( 'vertexUrlChanged' , { graphVertexIds : ids , workspaceId : workspaceId } ) ; } withDataRequest . dataRequest ( 'user' , 'me' ) . then ( function ( ) { attachApplication ( false ) ; } ) . catch ( function ( ) { attachApplication ( true , '' , { } ) ; } ) function attachApplication ( loginRequired , message , options ) { updateVisalloLoadingProgress ( 'Extensions' ) ; if ( ! event ) { $ ( 'html' ) . toggleClass ( 'fullscreenApp' , mainApp ) . toggleClass ( 'fullscreenDetails' , popoutDetails ) ; window . isFullscreenDetails = popoutDetails ; } visalloData . isFullscreen = false ; if ( loginRequired ) { require ( [ '../plugins-before-auth' ] , function ( ) { updateVisalloLoadingProgress ( 'User Interface' ) ; $ ( document ) . one ( 'loginSuccess' , function ( ) { document . addEventListener ( 'pluginsLoaded' , function loaded ( ) { document . removeEventListener ( 'pluginsLoaded' , loaded ) ; loginSuccess ( true ) ; } , false ) ; document . dispatchEvent ( new Event ( 'readyForPlugins' ) ) ; } ) ; require ( [ 'login' ] , function ( Login ) { removeVisalloLoading ( ) . then ( function ( ) { Login . teardownAll ( ) ; Login . attachTo ( '#login' , { errorMessage : message , errorMessageOptions : options , toOpen : toOpen } ) ; } ) } ) ; } ) } else { document . addEventListener ( 'pluginsLoaded' , function loaded ( ) { updateVisalloLoadingProgress ( 'User Interface' ) ; document . removeEventListener ( 'pluginsLoaded' , loaded ) ; loginSuccess ( false ) ; } , false ) ; document . dispatchEvent ( new Event ( 'readyForPlugins' ) ) ; } } function loginSuccess ( animate ) { if ( animate && ( / ^#?[a-z]+= / i ) . test ( location . hash ) ) { window . location . reload ( ) ; } else { withDataRequest . dataRequest ( 'user' , 'me' ) . then ( function ( ) { require ( [ 'moment' , 'bootstrap' , 'jqueryui' , 'easing' , 'jquery-scrollstop' , 'bootstrap-datepicker' , 'bootstrap-timepicker' , 'util/formatters' , 'util/visibility/util' , 'util/handlebars/after_auth_helpers' ] , function ( moment ) { var language = 'en' ; try { var languagePref = localStorage . getItem ( 'language' ) ; if ( languagePref ) { language = languagePref ; } } catch ( langerror ) { } moment . locale ( language ) ; $ . fn . datepicker . defaults . format = 'yyyy-mm-dd' ; $ . fn . datepicker . defaults . autoclose = true ; if ( popoutDetails ) { visalloData . isFullscreen = true ; $ ( '#login' ) . remove ( ) ; require ( [ 'appFullscreenDetails' ] , function ( comp ) { removeVisalloLoading ( ) . then ( function ( ) { if ( event ) { location . reload ( ) ; } else { if ( App ) { App . teardownAll ( ) ; } FullScreenApp = comp ; FullScreenApp . teardownAll ( ) ; FullScreenApp . attachTo ( '#app' , { graphVertexIds : ids , workspaceId : workspaceId } ) ; } } ) ; } ) ; } else { if ( ! animate ) { $ ( '#login' ) . remove ( ) ; } require ( [ 'app' ] , function ( comp ) { removeVisalloLoading ( ) . then ( function ( ) { App = comp ; if ( event ) { location . reload ( ) ; } else { if ( FullScreenApp ) { FullScreenApp . teardownAll ( ) ; } App . teardownAll ( ) ; var appOptions = { } ; if ( toOpen && toOpen . type === 'ADD' && ids . length ) { appOptions . addVertexIds = toOpen ; } if ( toOpen && toOpen . type === 'ADMIN' && toOpen . section && toOpen . name ) { appOptions . openAdminTool = _ . pick ( toOpen , 'section' , 'name' ) ; } if ( animate ) { $ ( '#login .authentication button.loading' ) . removeClass ( 'loading' ) ; appOptions . animateFromLogin = true ; } App . attachTo ( '#app' , appOptions ) ; _ . defer ( function ( ) { require ( [ 'login' ] ) ; } ) ; if ( animate ) { $ ( '#login .logo' ) . one ( TRANSITION_END , function ( ) { $ ( '#login' ) . find ( '.authentication' ) . teardownAllComponents ( ) . end ( ) . teardownAllComponents ( ) ; } ) ; } } } ) ; } ) ; } } ) ; } ) ; } } }
Switch between visallo and visallo-fullscreen-details based on url hash
Switch between visallo and visallo - fullscreen - details based on url hash
// Is this the popoout details app? ids passed to hash? // If this is a hash change // Is this the default visallo application? /*eslint no-empty:0 */ // Default datepicker options // Cache login in case server goes down