| for (var i = 0; i < this.__data.length; i++) { | for (var i = 0; i < this.__data.length; i++) { | ||||
| b += String.fromCharCode(this.__data[i]); | b += String.fromCharCode(this.__data[i]); | ||||
| } | } | ||||
| b += String.fromCharCode(this.__paletteIndex); | |||||
| return window.btoa(b); | return window.btoa(b); | ||||
| } | } | ||||
| set base64(s){ | set base64(s){ | ||||
| var b = window.atob(s); | var b = window.atob(s); | ||||
| var len = b.length; | var len = b.length; | ||||
| if (b.length !== 16){ | |||||
| if (b.length !== 17){ | |||||
| throw new Error("Base64 string contains invalid byte count."); | throw new Error("Base64 string contains invalid byte count."); | ||||
| } | } | ||||
| var bytes = new Uint8Array(b.length); | |||||
| for (var i=0; i < b.length; i++){ | |||||
| var bytes = new Uint8Array(b.length-1); | |||||
| for (var i=0; i < b.length-1; i++){ | |||||
| bytes[i] = b.charCodeAt(i); | bytes[i] = b.charCodeAt(i); | ||||
| } | } | ||||
| this.__data = bytes; | this.__data = bytes; | ||||
| this.__paletteIndex = b.charCodeAt(b.length-1); | |||||
| } | } | ||||