<commit_before>girder.Router = Backbone.Router.extend({
    initialize: function () {
        this._enabled = true;
    },

    execute: function (callback, args) {
        args.push(girder.parseQueryString(args.pop()));
        var queryString = args[args.length - 1];
        if (callback) {
            callback.apply(this, args);
        }

        // handle "top level" dialogs
        if (queryString.dialog === 'login') {
            girder.events.trigger('g:loginUi');
        } else if (queryString.dialog === 'register') {
            girder.events.trigger('g:registerUi');
        } else if (queryString.dialog === 'resetpassword') {
            girder.events.trigger('g:resetPasswordUi');
        }
    },

    /**
     * Set or get the enabled state of the router. Call with a boolean argument
     * to set the enabled state, or with no arguments to get the state.
     */
    enabled: function () {
        if (arguments.length) {
            this._enabled = !!arguments[0];
        }
        return this._enabled;
    },

    navigate: function () {
        if (this._enabled) {
            Backbone.Router.prototype.navigate.apply(this, arguments);
        }
    }
});


girder.router = new girder.Router();

// When the back button is pressed, we want to close open modals.
girder.router.on('route', function (route, params) {
    if (!params.slice(-1)[0].dialog) {
        $('.modal').girderModal('close');
    }
    // get rid of tooltips
    $('.tooltip').remove();
});<commit_msg>Fix jshint<commit_after>girder.Router = Backbone.Router.extend({
    initialize: function () {
        this._enabled = true;
    },

    execute: function (callback, args) {
        args.push(girder.parseQueryString(args.pop()));
        var queryString = args[args.length - 1];
        if (callback) {
            callback.apply(this, args);
        }

        // handle "top level" dialogs
        if (queryString.dialog === 'login') {
            girder.events.trigger('g:loginUi');
        } else if (queryString.dialog === 'register') {
            girder.events.trigger('g:registerUi');
        } else if (queryString.dialog === 'resetpassword') {
            girder.events.trigger('g:resetPasswordUi');
        }
    },

    /**
     * Set or get the enabled state of the router. Call with a boolean argument
     * to set the enabled state, or with no arguments to get the state.
     */
    enabled: function () {
        if (arguments.length) {
            this._enabled = !!arguments[0];
        }
        return this._enabled;
    },

    navigate: function () {
        if (this._enabled) {
            Backbone.Router.prototype.navigate.apply(this, arguments);
        }
    }
});

girder.router = new girder.Router();

// When the back button is pressed, we want to close open modals.
girder.router.on('route', function (route, params) {
    if (!params.slice(-1)[0].dialog) {
        $('.modal').girderModal('close');
    }
    // get rid of tooltips
    $('.tooltip').remove();
});
{'fraction_non_alphanumeric': 0.14533333333333334, 'fraction_numerical': 0.0026666666666666666, 'mean_word_length': 2.1823966065747613, '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': '4479349', 'n_tokens_mistral': 873, 'n_tokens_neox': 869, 'n_words': 211}