<NME> base64.js
<BEF> ADDFILE
<MSG> Forgot base64

<DFF> @@ -0,0 +1,142 @@
+/**
+*
+*  Base64 encode / decode
+*  http://www.webtoolkit.info/
+*
+**/
+ 
+var Base64 = {
+ 
+	// private property
+	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
+ 
+	// public method for encoding
+	encode : function (input) {
+		var output = "";
+		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+		var i = 0;
+ 
+		input = Base64._utf8_encode(input);
+ 
+		while (i < input.length) {
+ 
+			chr1 = input.charCodeAt(i++);
+			chr2 = input.charCodeAt(i++);
+			chr3 = input.charCodeAt(i++);
+ 
+			enc1 = chr1 >> 2;
+			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+			enc4 = chr3 & 63;
+ 
+			if (isNaN(chr2)) {
+				enc3 = enc4 = 64;
+			} else if (isNaN(chr3)) {
+				enc4 = 64;
+			}
+ 
+			output = output +
+			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
+			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
+ 
+		}
+ 
+		return output;
+	},
+ 
+	// public method for decoding
+	decode : function (input) {
+		var output = "";
+		var chr1, chr2, chr3;
+		var enc1, enc2, enc3, enc4;
+		var i = 0;
+ 
+		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+ 
+		while (i < input.length) {
+ 
+			enc1 = this._keyStr.indexOf(input.charAt(i++));
+			enc2 = this._keyStr.indexOf(input.charAt(i++));
+			enc3 = this._keyStr.indexOf(input.charAt(i++));
+			enc4 = this._keyStr.indexOf(input.charAt(i++));
+ 
+			chr1 = (enc1 << 2) | (enc2 >> 4);
+			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+			chr3 = ((enc3 & 3) << 6) | enc4;
+ 
+			output = output + String.fromCharCode(chr1);
+ 
+			if (enc3 != 64) {
+				output = output + String.fromCharCode(chr2);
+			}
+			if (enc4 != 64) {
+				output = output + String.fromCharCode(chr3);
+			}
+ 
+		}
+ 
+		output = Base64._utf8_decode(output);
+ 
+		return output;
+ 
+	},
+ 
+	// private method for UTF-8 encoding
+	_utf8_encode : function (string) {
+		string = string.replace(/\r\n/g,"\n");
+		var utftext = "";
+ 
+		for (var n = 0; n < string.length; n++) {
+ 
+			var c = string.charCodeAt(n);
+ 
+			if (c < 128) {
+				utftext += String.fromCharCode(c);
+			}
+			else if((c > 127) && (c < 2048)) {
+				utftext += String.fromCharCode((c >> 6) | 192);
+				utftext += String.fromCharCode((c & 63) | 128);
+			}
+			else {
+				utftext += String.fromCharCode((c >> 12) | 224);
+				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+				utftext += String.fromCharCode((c & 63) | 128);
+			}
+ 
+		}
+ 
+		return utftext;
+	},
+ 
+	// private method for UTF-8 decoding
+	_utf8_decode : function (utftext) {
+		var string = "";
+		var i = 0;
+		var c = c1 = c2 = 0;
+ 
+		while ( i < utftext.length ) {
+ 
+			c = utftext.charCodeAt(i);
+ 
+			if (c < 128) {
+				string += String.fromCharCode(c);
+				i++;
+			}
+			else if((c > 191) && (c < 224)) {
+				c2 = utftext.charCodeAt(i+1);
+				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+				i += 2;
+			}
+			else {
+				c2 = utftext.charCodeAt(i+1);
+				c3 = utftext.charCodeAt(i+2);
+				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+				i += 3;
+			}
+ 
+		}
+ 
+		return string;
+	}
+ 
+}
\ No newline at end of file

{'commit': 'diff --git a/tilemill/static/js/base64.js b/tilemill/static/js/base64.js\nnew file mode 100644\nindex 00000000..6e87eb7b\n--- /dev/null\n+++ b/tilemill/static/js/base64.js\n@@ -0,0 +1,142 @@\n+/**\n+*\n+*  Base64 encode / decode\n+*  http://www.webtoolkit.info/\n+*\n+**/\n+ \n+var Base64 = {\n+ \n+\t// private property\n+\t_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",\n+ \n+\t// public method for encoding\n+\tencode : function (input) {\n+\t\tvar output = "";\n+\t\tvar chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n+\t\tvar i = 0;\n+ \n+\t\tinput = Base64._utf8_encode(input);\n+ \n+\t\twhile (i < input.length) {\n+ \n+\t\t\tchr1 = input.charCodeAt(i++);\n+\t\t\tchr2 = input.charCodeAt(i++);\n+\t\t\tchr3 = input.charCodeAt(i++);\n+ \n+\t\t\tenc1 = chr1 >> 2;\n+\t\t\tenc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n+\t\t\tenc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n+\t\t\tenc4 = chr3 & 63;\n+ \n+\t\t\tif (isNaN(chr2)) {\n+\t\t\t\tenc3 = enc4 = 64;\n+\t\t\t} else if (isNaN(chr3)) {\n+\t\t\t\tenc4 = 64;\n+\t\t\t}\n+ \n+\t\t\toutput = output +\n+\t\t\tthis._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n+\t\t\tthis._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n+ \n+\t\t}\n+ \n+\t\treturn output;\n+\t},\n+ \n+\t// public method for decoding\n+\tdecode : function (input) {\n+\t\tvar output = "";\n+\t\tvar chr1, chr2, chr3;\n+\t\tvar enc1, enc2, enc3, enc4;\n+\t\tvar i = 0;\n+ \n+\t\tinput = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, "");\n+ \n+\t\twhile (i < input.length) {\n+ \n+\t\t\tenc1 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc2 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc3 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc4 = this._keyStr.indexOf(input.charAt(i++));\n+ \n+\t\t\tchr1 = (enc1 << 2) | (enc2 >> 4);\n+\t\t\tchr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n+\t\t\tchr3 = ((enc3 & 3) << 6) | enc4;\n+ \n+\t\t\toutput = output + String.fromCharCode(chr1);\n+ \n+\t\t\tif (enc3 != 64) {\n+\t\t\t\toutput = output + String.fromCharCode(chr2);\n+\t\t\t}\n+\t\t\tif (enc4 != 64) {\n+\t\t\t\toutput = output + String.fromCharCode(chr3);\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\toutput = Base64._utf8_decode(output);\n+ \n+\t\treturn output;\n+ \n+\t},\n+ \n+\t// private method for UTF-8 encoding\n+\t_utf8_encode : function (string) {\n+\t\tstring = string.replace(/\\r\\n/g,"\\n");\n+\t\tvar utftext = "";\n+ \n+\t\tfor (var n = 0; n < string.length; n++) {\n+ \n+\t\t\tvar c = string.charCodeAt(n);\n+ \n+\t\t\tif (c < 128) {\n+\t\t\t\tutftext += String.fromCharCode(c);\n+\t\t\t}\n+\t\t\telse if((c > 127) && (c < 2048)) {\n+\t\t\t\tutftext += String.fromCharCode((c >> 6) | 192);\n+\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tutftext += String.fromCharCode((c >> 12) | 224);\n+\t\t\t\tutftext += String.fromCharCode(((c >> 6) & 63) | 128);\n+\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\treturn utftext;\n+\t},\n+ \n+\t// private method for UTF-8 decoding\n+\t_utf8_decode : function (utftext) {\n+\t\tvar string = "";\n+\t\tvar i = 0;\n+\t\tvar c = c1 = c2 = 0;\n+ \n+\t\twhile ( i < utftext.length ) {\n+ \n+\t\t\tc = utftext.charCodeAt(i);\n+ \n+\t\t\tif (c < 128) {\n+\t\t\t\tstring += String.fromCharCode(c);\n+\t\t\t\ti++;\n+\t\t\t}\n+\t\t\telse if((c > 191) && (c < 224)) {\n+\t\t\t\tc2 = utftext.charCodeAt(i+1);\n+\t\t\t\tstring += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n+\t\t\t\ti += 2;\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tc2 = utftext.charCodeAt(i+1);\n+\t\t\t\tc3 = utftext.charCodeAt(i+2);\n+\t\t\t\tstring += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n+\t\t\t\ti += 3;\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\treturn string;\n+\t}\n+ \n+}\n\\ No newline at end of file\n', 'commit_subject': 'Forgot base64', 'repo_name': 'tilemill-project/tilemill', 'committer': {'name': 'Dmitri Gaskin', 'email': 'dbb3e797085b073bf975dd2bbe3b793efef0c407@gmail.com', 'time_sec': '1278427820', 'tz_offset': '-240', 'date': {'seconds': '1278427820'}}, 'commit_tree': 'c70ff44b30f9167251e9b4f1c78ca24dbfc3191f', 'commit_message': 'Forgot base64\n', 'language_name': 'Python', 'license': 'bsd-3-clause', 'hunks': '@@ -0,0 +1,142 @@\n+/**\n+*\n+*  Base64 encode / decode\n+*  http://www.webtoolkit.info/\n+*\n+**/\n+ \n+var Base64 = {\n+ \n+\t// private property\n+\t_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",\n+ \n+\t// public method for encoding\n+\tencode : function (input) {\n+\t\tvar output = "";\n+\t\tvar chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n+\t\tvar i = 0;\n+ \n+\t\tinput = Base64._utf8_encode(input);\n+ \n+\t\twhile (i < input.length) {\n+ \n+\t\t\tchr1 = input.charCodeAt(i++);\n+\t\t\tchr2 = input.charCodeAt(i++);\n+\t\t\tchr3 = input.charCodeAt(i++);\n+ \n+\t\t\tenc1 = chr1 >> 2;\n+\t\t\tenc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n+\t\t\tenc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n+\t\t\tenc4 = chr3 & 63;\n+ \n+\t\t\tif (isNaN(chr2)) {\n+\t\t\t\tenc3 = enc4 = 64;\n+\t\t\t} else if (isNaN(chr3)) {\n+\t\t\t\tenc4 = 64;\n+\t\t\t}\n+ \n+\t\t\toutput = output +\n+\t\t\tthis._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n+\t\t\tthis._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n+ \n+\t\t}\n+ \n+\t\treturn output;\n+\t},\n+ \n+\t// public method for decoding\n+\tdecode : function (input) {\n+\t\tvar output = "";\n+\t\tvar chr1, chr2, chr3;\n+\t\tvar enc1, enc2, enc3, enc4;\n+\t\tvar i = 0;\n+ \n+\t\tinput = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, "");\n+ \n+\t\twhile (i < input.length) {\n+ \n+\t\t\tenc1 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc2 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc3 = this._keyStr.indexOf(input.charAt(i++));\n+\t\t\tenc4 = this._keyStr.indexOf(input.charAt(i++));\n+ \n+\t\t\tchr1 = (enc1 << 2) | (enc2 >> 4);\n+\t\t\tchr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n+\t\t\tchr3 = ((enc3 & 3) << 6) | enc4;\n+ \n+\t\t\toutput = output + String.fromCharCode(chr1);\n+ \n+\t\t\tif (enc3 != 64) {\n+\t\t\t\toutput = output + String.fromCharCode(chr2);\n+\t\t\t}\n+\t\t\tif (enc4 != 64) {\n+\t\t\t\toutput = output + String.fromCharCode(chr3);\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\toutput = Base64._utf8_decode(output);\n+ \n+\t\treturn output;\n+ \n+\t},\n+ \n+\t// private method for UTF-8 encoding\n+\t_utf8_encode : function (string) {\n+\t\tstring = string.replace(/\\r\\n/g,"\\n");\n+\t\tvar utftext = "";\n+ \n+\t\tfor (var n = 0; n < string.length; n++) {\n+ \n+\t\t\tvar c = string.charCodeAt(n);\n+ \n+\t\t\tif (c < 128) {\n+\t\t\t\tutftext += String.fromCharCode(c);\n+\t\t\t}\n+\t\t\telse if((c > 127) && (c < 2048)) {\n+\t\t\t\tutftext += String.fromCharCode((c >> 6) | 192);\n+\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tutftext += String.fromCharCode((c >> 12) | 224);\n+\t\t\t\tutftext += String.fromCharCode(((c >> 6) & 63) | 128);\n+\t\t\t\tutftext += String.fromCharCode((c & 63) | 128);\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\treturn utftext;\n+\t},\n+ \n+\t// private method for UTF-8 decoding\n+\t_utf8_decode : function (utftext) {\n+\t\tvar string = "";\n+\t\tvar i = 0;\n+\t\tvar c = c1 = c2 = 0;\n+ \n+\t\twhile ( i < utftext.length ) {\n+ \n+\t\t\tc = utftext.charCodeAt(i);\n+ \n+\t\t\tif (c < 128) {\n+\t\t\t\tstring += String.fromCharCode(c);\n+\t\t\t\ti++;\n+\t\t\t}\n+\t\t\telse if((c > 191) && (c < 224)) {\n+\t\t\t\tc2 = utftext.charCodeAt(i+1);\n+\t\t\t\tstring += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n+\t\t\t\ti += 2;\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tc2 = utftext.charCodeAt(i+1);\n+\t\t\t\tc3 = utftext.charCodeAt(i+2);\n+\t\t\t\tstring += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n+\t\t\t\ti += 3;\n+\t\t\t}\n+ \n+\t\t}\n+ \n+\t\treturn string;\n+\t}\n+ \n+}\n\\ No newline at end of file\n', 'addition_count': 142, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/tilemill/static/js/base64.js', 'file_extension': '.js', 'before_file': 'ADDFILE', 'message': 'Forgot base64\n', 'author_name': 'Dmitri Gaskin', 'lang': 'js'}