<commit_before>function render(tmpl_name, tmpl_data) {
	if ( !render.tmpl_cache ) { 
		render.tmpl_cache = {};
	}

	if ( ! render.tmpl_cache[tmpl_name] ) {
		var tmpl_dir = 'js/templates';
		var tmpl_url = tmpl_dir + '/' + tmpl_name + '.html';

		var tmpl_string;
		$.ajax({
			url: tmpl_url,
			method: 'GET',
			async: false,
			success: function(data) {
				tmpl_string = data;
			}
		});

		render.tmpl_cache[tmpl_name] = _.template(tmpl_string);
	}

	var rendered = render.tmpl_cache[tmpl_name](tmpl_data);
	$('#maincontainer').html(rendered);
}
	
	
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
	this.navigate('home');
	
	this.registerURL = /^#register/;
	this.overviewURL = /^#overview/;	
    },

    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
	
    onDeviceReady: function() {
        $(window).on('hashchange', $.proxy(this.route, this));
    },
	
	
    route: function() {
	    var hash = window.location.hash;
	    if (!hash) {
	        render('home', {});
	        return;
	    }
	    var match = hash.match(app.registerURL);
	    if (match) {
	        render('register', {});
	    }
	    var match = hash.match(app.overviewURL);
	    if (match) {
	        render('overview', {});
	    }
    }
};<commit_msg>Update index.js<commit_after>function render(tmpl_name, tmpl_data) {
	if ( !render.tmpl_cache ) { 
		render.tmpl_cache = {};
	}

	if ( ! render.tmpl_cache[tmpl_name] ) {
		var tmpl_dir = 'js/templates';
		var tmpl_url = tmpl_dir + '/' + tmpl_name + '.html';

		var tmpl_string;
		$.ajax({
			url: tmpl_url,
			method: 'GET',
			async: false,
			success: function(data) {
				tmpl_string = data;
			}
		});

		render.tmpl_cache[tmpl_name] = _.template(tmpl_string);
	}

	var rendered = render.tmpl_cache[tmpl_name](tmpl_data);
	$('#maincontainer').html(rendered);
}
	
	
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
	
	this.registerURL = /^#register/;
	this.overviewURL = /^#overview/;
	
	self.route();
    },

    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
	
    onDeviceReady: function() {
        $(window).on('hashchange', $.proxy(this.route, this));
    },
	
	
    route: function() {
	    var hash = window.location.hash;
	    if (!hash) {
	        render('home', {});
	        return;
	    }
	    var match = hash.match(app.registerURL);
	    if (match) {
	        render('register', {});
	    }
	    var match = hash.match(app.overviewURL);
	    if (match) {
	        render('overview', {});
	    }
    }
};
{'fraction_non_alphanumeric': 0.16654191616766467, 'fraction_numerical': 0.0, 'mean_word_length': 2.6717032967032965, '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': '285388', 'n_tokens_mistral': 1028, 'n_tokens_neox': 917, 'n_words': 157}