<commit_before>/* app/views/chrome.js
 * outer most appviews */
'use strict';

define([
    'require',
    'exports',
    'jquery',
    'backbone',
    'underscore',
    'app/views/sections/search',
    'utils/spinner'
], function( require, exports, $, Backbone, _, Search, Spinner ) {

    var App = Backbone.View.extend({
        initialize : function() {
            _.bindAll( this, 'showSearch', 'navigate', 'setView', 'detail', 'section' )

            this.model = new Backbone.Model()
            this.searchForm = new Search.Form({
                el : '#searchForm'
            })

            Backbone.dispatcher.on('goBack', this.section)
            //Backbone.dispatcher.on('projects:goBack', this.projects)
            //Backbone.dispatcher.on('film:goBack', this.film)
            //Backbone.dispatcher.on('photography:goBack', this.photography)
        },

        events : {
            'click' : 'closeMenu',
            'click #search' : 'showSearch',
            'click #nav a' : 'navigate'
        },

        showSearch : function(e){
            e.preventDefault()
            this.searchForm.render()
        },

        closeMenu : function(e) {
            $('#filter-bar .open').removeClass('open')
        },

        navigate : function(e) {
            e.preventDefault()
            if ( e.target.id === 'search') { return }
            this.currentView.close()

            var spinner = new Spinner()
            this.section(spinner,e.target.id)
            Backbone.dispatcher.trigger('navigate:section', e)
        },

        setView : function( view ) {
            this.currentView = view
        },

        section : function( spinner, section, segment, urlTitle ) {
            this.$('#nav a').removeClass( 'active' )
            $('#' + section).addClass( 'active' )
            var self = this

            require(['app/views/sections/' + section], function( view ) {
                self.setView(view)
                view.setElement('.page')
                if (section === 'home') {
                    var bootstrap = !!$('#n-container').length
                    view.render(spinner)
                } else if (section === 'stream') {
                    view.render(spinner)
                } else if ( section === 'profile' ) {
                    try {
                        view.render( segment, urlTitle, spinner )
                    } catch(e) {
                        view.model.on('change:loaded', function() {
                            view.render( segment, urlTitle, spinner )
                        })
                    }
                    //self.listenTo( view.collection, 'change:active', self.detail )
                } else {
                    try {
                        view.init(spinner)
                        if (section === 'projets') { view.filter.$el.show() }
                    } catch(e) {
                        Backbone.dispatcher.on( section + ':ready', function() {
                            view.init(spinner)
                        })
                    }
                }
            })
        },

        detail : function( spinner, section, urlTitle, showcaseUrl, previous ) {
            var self = this
            require(['app/views/details/' + section], function( view ) {
                self.setView( view )
                view.on('rendered', function() {
                    spinner.detach()
                })

                $('.page')
                    .html( view.render( urlTitle, showcaseUrl, previous ) )
                    .removeClass('projects')
            })
        },

        search : function() {
            this.pageSearch = new Search.Form({
                el : '#pageSearchForm'
            })
            this.setView( this.pageSearch )
            this.pageSearch.render()
        }

/*
        singleProject : function( spinner, projectUrl, showcaseUrl, previous ) {
            var self = this
            require(['app/views/details/project'], function( projectView ) {
                self.setView( projectView )
                projectView.on('rendered', function() {
                    spinner.detach()
                })

                $('.page')
                    .html( projectView.render( projectUrl, showcaseUrl, previous ) )
                    .removeClass('projects')
            })
        },

        singleFilm : function( spinner, filmUrl ) {
            var self = this
            require(['app/views/details/film'], function( filmView ) {
                self.setView( filmView )
                filmView.on('rendered', function(){
                    spinner.detach()
                })

                $('.page').html( filmView.render( filmUrl ) )
            })
        },

        contact : function( spinner ) {
            var self = this
            require(['app/views/sections/contact'],
            function( c ) {
                self.setView( c )
                $('.page').html( c.render() )
                spinner.detach()
            })
        },

        stream : function( spinner ) {
            var self = this
            require(['app/views/sections/stream'],
            function( stream ) {
                self.setView( stream )
                stream.setElement( '.page' )
                stream.render(spinner)
            })
        },
*/
    })

    return new App({ el : document })
})
<commit_msg>nav bar fades out when navigating to home page via ajax<commit_after>/* app/views/chrome.js
 * outer most appviews */
'use strict';

define([
    'require',
    'exports',
    'jquery',
    'backbone',
    'underscore',
    'app/views/sections/search',
    'utils/spinner'
], function( require, exports, $, Backbone, _, Search, Spinner ) {

    var App = Backbone.View.extend({
        initialize : function() {
            _.bindAll( this, 'showSearch', 'navigate', 'setView', 'detail', 'section' )

            this.model = new Backbone.Model()
            this.searchForm = new Search.Form({
                el : '#searchForm'
            })

            Backbone.dispatcher.on('goBack', this.section)
            //Backbone.dispatcher.on('projects:goBack', this.projects)
            //Backbone.dispatcher.on('film:goBack', this.film)
            //Backbone.dispatcher.on('photography:goBack', this.photography)
        },

        events : {
            'click' : 'closeMenu',
            'click #search' : 'showSearch',
            'click #nav a' : 'navigate'
        },

        showSearch : function(e){
            e.preventDefault()
            this.searchForm.render()
        },

        closeMenu : function(e) {
            $('#filter-bar .open').removeClass('open')
        },

        navigate : function(e) {
            if ( e.target.id === 'home' ) {
                $('.site-header').addClass( 'home' )
            } else if ( e.target.id === 'search') {
                return
            }
            e.preventDefault()
            this.currentView.close()

            var spinner = new Spinner()
            this.section(spinner,e.target.id)
            Backbone.dispatcher.trigger('navigate:section', e)
        },

        setView : function( view ) {
            this.currentView = view
        },

        section : function( spinner, section, segment, urlTitle ) {
            this.$('#nav a').removeClass( 'active' )
            $('#' + section).addClass( 'active' )
            var self = this

            require(['app/views/sections/' + section], function( view ) {
                self.setView(view)
                view.setElement('.page')
                if (section === 'home') {
                    var bootstrap = !!$('#n-container').length
                    view.render(spinner)
                } else if (section === 'stream') {
                    view.render(spinner)
                } else if ( section === 'profile' ) {
                    try {
                        view.render( segment, urlTitle, spinner )
                    } catch(e) {
                        view.model.on('change:loaded', function() {
                            view.render( segment, urlTitle, spinner )
                        })
                    }
                    //self.listenTo( view.collection, 'change:active', self.detail )
                } else {
                    try {
                        view.init(spinner)
                        if (section === 'projets') { view.filter.$el.show() }
                    } catch(e) {
                        Backbone.dispatcher.on( section + ':ready', function() {
                            view.init(spinner)
                        })
                    }
                }
            })
        },

        detail : function( spinner, section, urlTitle, showcaseUrl, previous ) {
            var self = this
            require(['app/views/details/' + section], function( view ) {
                self.setView( view )
                view.on('rendered', function() {
                    spinner.detach()
                })

                $('.page')
                    .html( view.render( urlTitle, showcaseUrl, previous ) )
                    .removeClass('projects')
            })
        },

        search : function() {
            this.pageSearch = new Search.Form({
                el : '#pageSearchForm'
            })
            this.setView( this.pageSearch )
            this.pageSearch.render()
        }

/*
        singleProject : function( spinner, projectUrl, showcaseUrl, previous ) {
            var self = this
            require(['app/views/details/project'], function( projectView ) {
                self.setView( projectView )
                projectView.on('rendered', function() {
                    spinner.detach()
                })

                $('.page')
                    .html( projectView.render( projectUrl, showcaseUrl, previous ) )
                    .removeClass('projects')
            })
        },

        singleFilm : function( spinner, filmUrl ) {
            var self = this
            require(['app/views/details/film'], function( filmView ) {
                self.setView( filmView )
                filmView.on('rendered', function(){
                    spinner.detach()
                })

                $('.page').html( filmView.render( filmUrl ) )
            })
        },

        contact : function( spinner ) {
            var self = this
            require(['app/views/sections/contact'],
            function( c ) {
                self.setView( c )
                $('.page').html( c.render() )
                spinner.detach()
            })
        },

        stream : function( spinner ) {
            var self = this
            require(['app/views/sections/stream'],
            function( stream ) {
                self.setView( stream )
                stream.setElement( '.page' )
                stream.render(spinner)
            })
        },
*/
    })

    return new App({ el : document })
})

{'fraction_non_alphanumeric': 0.13051001821493624, 'fraction_numerical': 0.0, 'mean_word_length': 1.2631904369332234, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1839814', 'n_tokens_mistral': 2863, 'n_tokens_neox': 2708, 'n_words': 542}