<commit_before><!doctype html>
<html>
<head>
	<title>Backbone Test</title>
	<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
	<link href="http://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="l5r.css">
	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
	<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
	<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.9/backbone-min.js"></script>
	<script src="saveAs.js"></script>
	<script>
		$(document).ready(function () {

			_.templateSettings = {
				interpolate: /\{\{(.+?)\}\}/g
			};

			var Information = Backbone.Model.extend({
				defaults: {
					name: '',
					rank: '',
					clan: '',
					exp: '',
					school: '',
					insight: ''
				}
			});

			information = new Information();

			var Info = Backbone.View.extend({
				el: $('#info'),

				model: information,

				events: {
					"change input" 	   	 : "setInfo",
				},

			    setInfo: function(e) {
			    	this.model.set(e.target.id, e.target.value);
			    },

			    initialize: function() {
			    	this.render();
			    },

			    render: function () {
					var template = _.template(this.el.innerHTML);
					this.el.innerHTML = template(this.model.attributes);
			    }
			});

			sheet = new Info();

			//var characterSheet = new Backbone.Collection([information, {bob:'test'}]);

			/*var characterSheet = Backbone.Collection.extend({

			});*/

			var IO = Backbone.View.extend({

				el: "body",

				model: information,

				events: {
					"click button.save": "saveData"
				},

			    saveData: function() {
			    	console.log(this.model.toJSON());
					var blob = new Blob([JSON.stringify(this.model.toJSON())], {type: 'text/plain;charset=utf-8'});
					saveAs(blob, (this.model.get('name') || "character") + ".l5r");
			    }

			});
<commit_msg>Data saved in more useful way, though changed attributes now lost.<commit_after><!doctype html>
<html>
<head>
	<title>Backbone Test</title>
	<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
	<link href="http://fonts.googleapis.com/css?family=Fjalla+One" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="l5r.css">
	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
	<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
	<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.9/backbone-min.js"></script>
	<script src="saveAs.js"></script>
	<script>
		$(document).ready(function () {

			_.templateSettings = {
				interpolate: /\{\{(.+?)\}\}/g
			};

			var Information = Backbone.Model.extend({
				defaults: {
					name: '',
					rank: '',
					clan: '',
					exp: '',
					school: '',
					insight: ''
				}
			});

			information = new Information();

			var Info = Backbone.View.extend({
				el: $('#info'),

				model: information,

				events: {
					"change input" 	   	 : "setInfo",
				},

			    setInfo: function(e) {
			    	this.model.set(e.target.id, e.target.value);
			    },

			    initialize: function() {
			    	this.render();
			    },

			    render: function () {
					var template = _.template(this.el.innerHTML);
					this.el.innerHTML = template(this.model.attributes);
			    }
			});

			sheet = new Info();

			var characterSheet = new Backbone.Collection([information, {bob:'test'}]);

			var characterSheet = Backbone.Collection.extend({

				model: {
					info: information,
					test: {'bob': 'test'}
				}

			});

			var IO = Backbone.View.extend({

				el: "body",

				data: {
					info: information.toJSON(),
					test: {'bob': 'test'}
				},

				events: {
					"click button.save": "saveData"
				},

			    saveData: function() {			    	
					var blob = new Blob([JSON.stringify(this.data)], {type: 'text/plain;charset=utf-8'});
					saveAs(blob, ("character") + ".l5r");
			    }

			});

{'fraction_non_alphanumeric': 0.19485561756855133, 'fraction_numerical': 0.007279786459597185, 'mean_word_length': 2.7920883164673413, 'pattern_counts': {'":': 2, '<': 37, '<?xml version=': 0, '>': 37, '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': '2284354', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1384, 'n_words': 222}