<commit_before>// Mobile Router
// =============

// Includes file dependencies
define([
	"jquery",
	"parse",
    "pretty",
    "jscookie",
    "moment",
	"../models/CategoryModel",
	"../collections/CategoriesCollection",
	"../views/CategoryView",
    "../views/CharactersListView",
    "../models/Vampire",
    "../collections/Vampires",
    "../views/CharacterView",
    "../views/SimpleTraitCategoryView",
    "../views/SimpleTraitNewView",
    "../models/SimpleTrait",
    "../views/SimpleTraitChangeView",
    "../models/VampireCreation",
    "../views/CharacterCreateView",
    "../views/CharacterNewView",
    "../views/CharacterPrintView",
    "../views/CharacterCostsView",
    "../views/SimpleTextNewView",
    "../views/SimpleTraitSpecializationView",
    "../views/CharacterLogView",
    "../views/CharacterHistoryView",
    "../views/SignupView",
    "../views/LoginView",
    "../views/CharacterExperienceView",
    "../views/UserSettingsProfileView",
    "../views/CharacterPortraitView",
    "../views/TroupeCharacterRelationshipsNetworkView",
    "../views/CharacterDeleteView",
    "../views/PlayerOptionsView",
], function ($,
             Parse,
             pretty,
             Cookie,
             moment,
             CategoryModel,
             CategoriesCollection,
             CategoryView,
             CharactersListView,
             Vampire,
             Vampires,
             CharacterView,
             SimpleTraitCategoryView,
             SimpleTraitNewView,
             SimpleTrait,
             SimpleTraitChangeView,
             VampireCreation,
             CharacterCreateView,
             CharacterNewView,
             CharacterPrintView,
             CharacterCostsView,
             SimpleTextNewView,
             SimpleTraitSpecializationView,
             CharacterLogView,
             CharacterHistoryView,
             SignupView,
             LoginView,
             CharacterExperienceView,
             UserSettingsProfileView,
             CharacterPortraitView,
             TroupeCharacterRelationshipsNetworkView,
             CharacterDeleteView,
             PlayerOptionsView
) {

    // Extends Backbone.Router
    var CategoryRouter = Parse.Router.extend( {

        // The Router constructor
        initialize: function() {

            this._character = null;

            _.bindAll(this, "get_character");

            // Instantiates a new Animal Category View
            this.animalsView = new CategoryView( { el: "#animals", collection: new CategoriesCollection( [] , { type: "animals" } ) } );

            // Instantiates a new Colors Category View
            this.colorsView = new CategoryView( { el: "#colors", collection: new CategoriesCollection( [] , { type: "colors" } ) } );

            // Instantiates a new Vehicles Category View
            this.vehiclesView = new CategoryView( { el: "#vehicles", collection: new CategoriesCollection( [] , { type: "vehicles" } ) } );

            this.characters = new CharactersListView( {el: "#characters-all", collection: new Vampires});

            this.character = new CharacterView({ el: "#character"});

            this.simpleTraitCategoryView = new SimpleTraitCategoryView({el: "#simpletraitcategory-all"});
            this.simpleTraitNewView = new SimpleTraitNewView({el: "#simpletrait-new"});
            this.simpleTraitChangeView = new SimpleTraitChangeView({el: "#simpletrait-change"});
            this.simpleTextNewView = new SimpleTextNewView({el: "#simpletext-new"});
            this.simpleTraitSpecializationView = new SimpleTraitSpecializationView({el: "#simpletrait-specialization"});

            this.characterCreateView = new CharacterCreateView({el: "#character-create"});
            this.characterNewView = new CharacterNewView({el: "#character-new"});

            this.characterPrintView = new CharacterPrintView({el: "#printable-sheet"});
            this.characterCostsView = new CharacterCostsView({el: "#character-costs"});
            this.characterLogView = new CharacterLogView({el: "#character-log"});
            this.characterHistoryView = new CharacterHistoryView({el: "#character-history"});
            this.characterExperienceView = new CharacterExperienceView({el: "#experience-notations-all"});
            this.characterPortraitView = new CharacterPortraitView({el: "#character-portrait"});
            this.characterDeleteView = new CharacterDeleteView({el: "#character-delete"});

            this.loginView = new LoginView();
            this.signupView = new SignupView();

            this.userSettingsProfileView = new UserSettingsProfileView({el: "#user-settings-profile"});

            this.troupeCharacterRelationshipsNetworkView = new TroupeCharacterRelationshipsNetworkView({el: "#troupe-character-relationships-network"});

            /*
            if (!Parse.User.current()) {
                Parse.User.logIn("devuser", "thedumbness");
            }
            */

            // Tells Backbone to start watching for hashchange events
            Parse.history.start();
        },

        // Backbone.js Routes
        routes: {

            // When there is no hash bang on the url, the home method is called
            "": "home",
            "start": "home",

            "logout": "logout",
            "signup": "signup",

            "profile": "profile",

            // When #category? is on the url, the category method is called
            "category?:type": "category",

            "victims?:type": "victims",

            "characters?:type": "characters",

            "character?:id": "character",

            "simpletraits/:category/:cid/:type": "simpletraits",

            "simpletrait/:category/:cid/:bid": "simpletrait",
            "simpletrait/specialize/:category/:cid/:bid": "simpletraitspecialize",

            "charactercreate/:cid": "charactercreate",

            "charactercreate/simpletraits/:category/:cid/pick/:i": "charactercreatepicksimpletrait",
            "charactercreate/simpletraits/:category/:cid/unpick/:stid/:i": "charactercreateunpicksimpletrait",
            "charactercreate/simpletraits/:category/:cid/specialize/:stid/:i": "charactercreatespecializesimpletrait",
            "charactercreate/simpletext/:category/:target/:cid/pick": "charactercreatepicksimpletext",

            "characternew": "characternew",

            "character/:cid/print": "characterprint",
            "character/:cid/costs": "charactercosts",
            "character/:cid/log/:start/:changeBy": "characterlog",
            "character/:cid/history/:id": "characterhistory",
            "character/:cid/portrait": "characterportrait",
            "character/:cid/delete": "characterdelete",

            "character/:cid/experience/:start/:changeBy": "characterexperience",

            "troupe/characters/relationships/network": "relationshipnetwork",

        },

        // Home method
        home: function() {
            var self = this;
            this.enforce_logged_in().then(function () {
                self.playerOptionsView = self.playerOptionsView || new PlayerOptionsView({el: "#player-options"});
                self.playerOptionsView.render();
                $.mobile.changePage("#player-options", {reverse: false, changeHash: false});
            });
        },

        logout: function() {
            Parse.User.logOut();
            window.location.hash = "";
            this.home();
        },

        signup: function() {
            if (!Parse.User.current()) {
                // Programatically changes to the categories page
                $.mobile.changePage("#signup", {reverse: false, changeHash: false});
            } else {
                window.location.hash = "";
            }
        },

        profile: function() {
            var self = this;
            self.enforce_logged_in().then(function() {
                self.set_back_button("#");
                self.userSettingsProfileView.render();
                $.mobile.changePage("#user-settings-profile", {reverse: false, changeHash: false});
            })
        },<commit_msg>Just render the new player options page once<commit_after>// Mobile Router
// =============

// Includes file dependencies
define([
	"jquery",
	"parse",
    "pretty",
    "jscookie",
    "moment",
	"../models/CategoryModel",
	"../collections/CategoriesCollection",
	"../views/CategoryView",
    "../views/CharactersListView",
    "../models/Vampire",
    "../collections/Vampires",
    "../views/CharacterView",
    "../views/SimpleTraitCategoryView",
    "../views/SimpleTraitNewView",
    "../models/SimpleTrait",
    "../views/SimpleTraitChangeView",
    "../models/VampireCreation",
    "../views/CharacterCreateView",
    "../views/CharacterNewView",
    "../views/CharacterPrintView",
    "../views/CharacterCostsView",
    "../views/SimpleTextNewView",
    "../views/SimpleTraitSpecializationView",
    "../views/CharacterLogView",
    "../views/CharacterHistoryView",
    "../views/SignupView",
    "../views/LoginView",
    "../views/CharacterExperienceView",
    "../views/UserSettingsProfileView",
    "../views/CharacterPortraitView",
    "../views/TroupeCharacterRelationshipsNetworkView",
    "../views/CharacterDeleteView",
    "../views/PlayerOptionsView",
], function ($,
             Parse,
             pretty,
             Cookie,
             moment,
             CategoryModel,
             CategoriesCollection,
             CategoryView,
             CharactersListView,
             Vampire,
             Vampires,
             CharacterView,
             SimpleTraitCategoryView,
             SimpleTraitNewView,
             SimpleTrait,
             SimpleTraitChangeView,
             VampireCreation,
             CharacterCreateView,
             CharacterNewView,
             CharacterPrintView,
             CharacterCostsView,
             SimpleTextNewView,
             SimpleTraitSpecializationView,
             CharacterLogView,
             CharacterHistoryView,
             SignupView,
             LoginView,
             CharacterExperienceView,
             UserSettingsProfileView,
             CharacterPortraitView,
             TroupeCharacterRelationshipsNetworkView,
             CharacterDeleteView,
             PlayerOptionsView
) {

    // Extends Backbone.Router
    var CategoryRouter = Parse.Router.extend( {

        // The Router constructor
        initialize: function() {

            this._character = null;

            _.bindAll(this, "get_character");

            // Instantiates a new Animal Category View
            this.animalsView = new CategoryView( { el: "#animals", collection: new CategoriesCollection( [] , { type: "animals" } ) } );

            // Instantiates a new Colors Category View
            this.colorsView = new CategoryView( { el: "#colors", collection: new CategoriesCollection( [] , { type: "colors" } ) } );

            // Instantiates a new Vehicles Category View
            this.vehiclesView = new CategoryView( { el: "#vehicles", collection: new CategoriesCollection( [] , { type: "vehicles" } ) } );

            this.characters = new CharactersListView( {el: "#characters-all", collection: new Vampires});

            this.character = new CharacterView({ el: "#character"});

            this.simpleTraitCategoryView = new SimpleTraitCategoryView({el: "#simpletraitcategory-all"});
            this.simpleTraitNewView = new SimpleTraitNewView({el: "#simpletrait-new"});
            this.simpleTraitChangeView = new SimpleTraitChangeView({el: "#simpletrait-change"});
            this.simpleTextNewView = new SimpleTextNewView({el: "#simpletext-new"});
            this.simpleTraitSpecializationView = new SimpleTraitSpecializationView({el: "#simpletrait-specialization"});

            this.characterCreateView = new CharacterCreateView({el: "#character-create"});
            this.characterNewView = new CharacterNewView({el: "#character-new"});

            this.characterPrintView = new CharacterPrintView({el: "#printable-sheet"});
            this.characterCostsView = new CharacterCostsView({el: "#character-costs"});
            this.characterLogView = new CharacterLogView({el: "#character-log"});
            this.characterHistoryView = new CharacterHistoryView({el: "#character-history"});
            this.characterExperienceView = new CharacterExperienceView({el: "#experience-notations-all"});
            this.characterPortraitView = new CharacterPortraitView({el: "#character-portrait"});
            this.characterDeleteView = new CharacterDeleteView({el: "#character-delete"});

            this.loginView = new LoginView();
            this.signupView = new SignupView();

            this.userSettingsProfileView = new UserSettingsProfileView({el: "#user-settings-profile"});

            this.troupeCharacterRelationshipsNetworkView = new TroupeCharacterRelationshipsNetworkView({el: "#troupe-character-relationships-network"});

            /*
            if (!Parse.User.current()) {
                Parse.User.logIn("devuser", "thedumbness");
            }
            */

            // Tells Backbone to start watching for hashchange events
            Parse.history.start();
        },

        // Backbone.js Routes
        routes: {

            // When there is no hash bang on the url, the home method is called
            "": "home",
            "start": "home",

            "logout": "logout",
            "signup": "signup",

            "profile": "profile",

            // When #category? is on the url, the category method is called
            "category?:type": "category",

            "victims?:type": "victims",

            "characters?:type": "characters",

            "character?:id": "character",

            "simpletraits/:category/:cid/:type": "simpletraits",

            "simpletrait/:category/:cid/:bid": "simpletrait",
            "simpletrait/specialize/:category/:cid/:bid": "simpletraitspecialize",

            "charactercreate/:cid": "charactercreate",

            "charactercreate/simpletraits/:category/:cid/pick/:i": "charactercreatepicksimpletrait",
            "charactercreate/simpletraits/:category/:cid/unpick/:stid/:i": "charactercreateunpicksimpletrait",
            "charactercreate/simpletraits/:category/:cid/specialize/:stid/:i": "charactercreatespecializesimpletrait",
            "charactercreate/simpletext/:category/:target/:cid/pick": "charactercreatepicksimpletext",

            "characternew": "characternew",

            "character/:cid/print": "characterprint",
            "character/:cid/costs": "charactercosts",
            "character/:cid/log/:start/:changeBy": "characterlog",
            "character/:cid/history/:id": "characterhistory",
            "character/:cid/portrait": "characterportrait",
            "character/:cid/delete": "characterdelete",

            "character/:cid/experience/:start/:changeBy": "characterexperience",

            "troupe/characters/relationships/network": "relationshipnetwork",

        },

        // Home method
        home: function() {
            var self = this;
            this.enforce_logged_in().then(function () {
                self.playerOptionsView = self.playerOptionsView || new PlayerOptionsView({el: "#player-options"}).render();
                $.mobile.changePage("#player-options", {reverse: false, changeHash: false});
            });
        },

        logout: function() {
            Parse.User.logOut();
            window.location.hash = "";
            this.home();
        },

        signup: function() {
            if (!Parse.User.current()) {
                // Programatically changes to the categories page
                $.mobile.changePage("#signup", {reverse: false, changeHash: false});
            } else {
                window.location.hash = "";
            }
        },

        profile: function() {
            var self = this;
            self.enforce_logged_in().then(function() {
                self.set_back_button("#");
                self.userSettingsProfileView.render();
                $.mobile.changePage("#user-settings-profile", {reverse: false, changeHash: false});
            })
        },
{'fraction_non_alphanumeric': 0.1320649823954537, 'fraction_numerical': 0.0, 'mean_word_length': 2.2496989160979526, 'pattern_counts': {'":': 52, '<': 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': '5989818', 'n_tokens_mistral': 4147, 'n_tokens_neox': 4125, 'n_words': 734}