Fixed recent problems introduced with my switch to addEventListener

This commit is contained in:
Jeff Parsons 2017-06-27 17:39:20 -07:00 • committed by Jeff Parsons
commit 743511d5db
14 changed files with 70 additions and 88 deletions

View file

@ -132,8 +132,8 @@ function Ha(a){var b=0;if(a.C.N)for(;b<a.g;){var c=a.a[a.K+b];if(a.L[b]!=c){var
y(function(){for(var a=G(document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=E(c),e=document.createElement("canvas");if(!e||!e.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}e.setAttribute("class","c1pjs-canvas");e.setAttribute("width",d.screenWidth);e.setAttribute("height",d.screenHeight);e.setAttribute("contenteditable","true");e.setAttribute("autocapitalize","off");e.setAttribute("autocorrect","off");e.style.backgroundColor=d.screenColor;
e.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(e.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,e,d.screenWidth,d.screenHeight));c.appendChild(e);var g=new Image,h=e.getContext("2d"),e=new fb(d,e,h,g);g.onload=function(a){return function(){a.X()}}(e,d.charSet);g.src=d.charSet;F(e,c)}});
function ib(a){C.call(this,"C1PSerialPort",a);this.C.N=!1;this.D=a.demo;this.reset(!0)}p(ib,C);f=ib.prototype;f.reset=function(a){if(a||this.o!=jb){this.v=-1;this.A=0;this.g="";if(this.D){a=1;if(this.nb){var b=this.nb.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.g='10 PRINT "HELLO OSI #'+a+'"\n'}this.B=!0;this.o=kb}};f.start=function(){this.b&&this.D&&(cb(this.b," C\n\n",3E3),setTimeout(function(a){return function(){a.o=lb;cb(a.b,"LOAD\n")}}(this),12E3));this.D=!1};
f.T=function(a,b,c){var d=this;switch(b){case "listSerial":return this.H[b]=c,!0;case "loadSerial":return this.H[b]=c,c.onclick=function(){d.H.listSerial&&w(d.H.listSerial.value,function(a,b,c){mb(d,a,b,c)})},!0;case "mountSerial":return!x("Mobi")&&window&&"FileReader"in window?(this.H[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.addEventListener("submit",function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=
function(){mb(d,b.name,c.result.toString(),0)};c.readAsText(b);return!1})):c.parentNode.removeChild(c),!0}return!1};f.ca=function(a,b,c,d){this.a=a;this.M=b;this.K=c-b+1;this.I=this.M+this.K;if(this.s=d)Ia(d,b,c,this,this.S),O(d,b,c,this,this.Jb);this.X()};f.ia=function(a,b){a&&!this.C.N&&(this.C.N=!0,this.U=b,this.b=M(b,"keyboard"),this.u=M(b,"debugger"))};
f.T=function(a,b,c){var d=this;switch(b){case "listSerial":return this.H[b]=c,!0;case "loadSerial":return this.H[b]=c,c.onclick=function(){d.H.listSerial&&w(d.H.listSerial.value,function(a,b,c){mb(d,a,b,c)})},!0;case "mountSerial":return!x("Mobi")&&window&&"FileReader"in window?(this.H[b]=c,c.onchange=function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length},c.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){mb(d,b.name,c.result.toString(),
0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};f.ca=function(a,b,c,d){this.a=a;this.M=b;this.K=c-b+1;this.I=this.M+this.K;if(this.s=d)Ia(d,b,c,this,this.S),O(d,b,c,this,this.Jb);this.X()};f.ia=function(a,b){a&&!this.C.N&&(this.C.N=!0,this.U=b,this.b=M(b,"keyboard"),this.u=M(b,"debugger"))};
function mb(a,b,c,d){if(c){a.A=0;a.g=c;a.B=!0;a.o=kb;if(-1!==b.indexOf(".json",b.length-5))try{d="";var e=eval("("+c+")").bytes;for(c=0;c<e.length;c++)d+=String.fromCharCode(e[c]);a.g=d;a.B=!1}catch(g){a.l('Error processing file "'+b+'": '+g.message);return}a.U&&a.b&&a.s.C.oa?(a.l("auto-loading "+b),a.s.da(),"."!=a.g.charAt(0)?(a.o=lb,cb(a.b,"NEW\nLOAD\n")):(a.o=jb,a.U.reset(!0),cb(a.b,"ML"))):a.l(b+" ready to load")}else a.l('Error loading file "'+b+'" ('+d+")")}
f.S=function(a,b){void 0!==b&&(a&1?nb(this):this.g&&!this.A&&nb(this))};f.Jb=function(a,b){void 0!==b&&this.u&&T(this.u,this,a,b,this.u.Ke,!0)};function nb(a){if(void 0!==a.g){a.v=-1;if(a.A<a.g.length){var b=a.g.charCodeAt(a.A++)&255;a.B&&10==b&&(b=13);a.v=b}else a.g="",a.A=0,a.o==lb&&a.b&&cb(a.b," \nRUN\n"),a.o=kb;for(b=a.M+0;b<a.I;b+=2)a.a[b]=0<=a.v?ob:pb;for(b=a.M+1;b<a.I;b+=2)a.a[b]=0<=a.v?a.v:0}}var pb=0,ob=1,kb=0,lb=1,jb=2;
y(function(){for(var a=G(document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=E(c),d=new ib(d);F(d,c)}});function qb(a){C.call(this,"C1PDiskController",a);this.C.N=!1;this.reset(!0)}p(qb,C);f=qb.prototype;f.reset=function(a){rb(this);this.b=-1;a&&(this.g=[],this.g[0]={Te:0,mb:40,Nb:!0,Ba:20,na:0,Aa:-1,Ra:[]})};