Added support for (attempting to) suppress alerts that are meaningless if the user has aborted a machine by exiting the page before it was done loading
This commit is contained in:
parent
986105b733
commit
1ce03810d3
32 changed files with 1827 additions and 1591 deletions
|
|
@ -27,15 +27,15 @@ function ga(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf(
|
|||
function v(a,b){var c=!0,c=void 0===c?!1:c,d=0,f=null;if("object"==typeof resources&&(f=resources[a]))b&&b(a,f,d);else if(c&&"function"==typeof resources)resources(a,function(c,d){b&&b(a,c,d)});else{var g=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(g.onreadystatechange=function(){4===g.readyState&&(f=g.responseText,200==g.status||!g.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(d=g.status||-1),b&&b(a,f,d))});g.open("GET",
|
||||
a,c);g.send();c||(f=g.responseText,200!=g.status&&(d=g.status||-1),b&&b(a,f,d))}}function w(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&!!b.match(/(iPod|iPhone|iPad)/)&&!!b.match(/AppleWebKit/)||"MSIE"==a&&!!b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)}return!1}function la(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function x(a){y.init.push(a)}
|
||||
function z(a){if(A)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){B(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function C(a){!A&&a?(A=!0,ma&&na("init"),oa&&na("show")):A=a}function na(a){y[a]&&z(y[a])}var pa=null,y={init:[],show:[],exit:[]},ma=!1,oa=!1,A=!0;la("onload",function(){ma=!0;z(y.init)});la("onpageshow",function(){oa=!0;z(y.show)});la(w("Opera")||w("iOS")?"onunload":"onbeforeunload",function(){z(y.exit)});
|
||||
function D(a,b){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.exports={};this.B=this.bindings={};a=this.id.indexOf(".");0>a?this.va=this.id:(this.Ba=this.id.substr(0,a),this.va=this.id.substr(a+1));this.u={ready:!1,ra:!1,wa:!1,I:!1,error:!1};this.ua=null;this.u.error=!1;this.G=this.J=this.sa=null;E.push(this)}function B(a){window&&window.alert(a)}
|
||||
function D(a,b){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.exports={};this.B=this.bindings={};a=this.id.indexOf(".");0>a?this.va=this.id:(this.Ba=this.id.substr(0,a),this.va=this.id.substr(a+1));this.u={ready:!1,ra:!1,wa:!1,I:!1,ce:!1,error:!1};this.ua=null;this.u.error=!1;this.G=this.J=this.sa=null;E.push(this)}function B(a){window&&window.alert(a)}
|
||||
function F(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<E.length;c++)if(E[c].id===a)return E[c]}return null}function qa(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<E.length;d++)if(c)c==E[d]&&(c=null);else if(!(a!=E[d].type||b&&E[d].id.indexOf(b)))return E[d]}return null}function G(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){B(c.message+" ("+a+")")}return b}
|
||||
function H(a,b){b=I(b.parentNode,"c1pjs-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,f=0;f<d.length;f++){var g=d[f];if(1===g.nodeType){var h=g.getAttribute("class");if(h)for(var l=h.split(" "),k=0;k<l.length;k++)switch(h=l[k],h){case "c1pjs-binding":(h=G(g))&&h.binding&&a.L(h.type,h.binding,g,h.value),k=l.length}}}}
|
||||
function I(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
|
||||
function ra(a){for(var b=!0,c=J[a];c&&c.length;){var d=c.splice(0,1)[0],f=d[0],g=null;0<=sa.indexOf(f)&&(g=function(){return function(){ra(a)}}());var h=ta[f];if(h)if(!g)b=h(d[1],d[2],d[3]);else{if(!h(g,d[1],d[2],d[3]))break}else{var b=!1,l=qa(d[1],a);if(l)if(h=ua[f])b=h(l,d[2],d[3]);else{var k=l.exports;if(k&&(h=k[f]))if(b=!0,!g)b=h.call(l,d[2],d[3]);else if(!h.call(l,g,d[2],d[3]))break}}if(!b){B("Script error: "+f+(h?" failed":" unrecognized"));break}}c&&!c.length&&delete J[a];return b}e=D.prototype;
|
||||
e.toString=function(){return this.name?this.name:this.id||this.type};
|
||||
e.L=function(a,b,c){switch(b){case "clear":return this.B[b]||(this.B[b]=c,c.onclick=function(a){return function(){a.B.print&&(a.B.print.value="")}}(this)),!0;case "print":return this.B[b]||(this.sa=this.B[b]=c,c.value="",this.F=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),this.ta=function(a){this.F(a,this.va)}),!0;default:return!1}};e.log=function(){};e.F=function(){};
|
||||
e.status=function(a){this.F(this.va+": "+a)};e.ta=function(a,b,c){c=c||this.type;b||B((c?c+": ":"")+a)};function va(a,b){a.u.error=!0;a.ta(b)}function K(a,b){b&&(a.u.ready?b():a.ua=b);return a.u.ready}e.R=function(a){this.u.error||(this.u.ready=!1!==a,this.u.ready&&(a=this.ua,this.ua=null,a&&a()))};function wa(a,b){if(a.u.wa)return a.u.ra=!1,a.u.wa=!1;if(a.u.error)return a.F(a.toString()+" error"),!1;a.u.ra=b;return a.u.ra}
|
||||
window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||
e.status=function(a){this.F(this.va+": "+a)};e.ta=function(a,b,c){if(!b){var d=qa("Computer",this.id);if(d&&d.u.ce){console.log("ignoring notice during unload: "+a);return}}c=c||this.type;b||B((c?c+": ":"")+a)};function va(a,b){a.u.error=!0;a.ta(b)}function K(a,b){b&&(a.u.ready?b():a.ua=b);return a.u.ready}e.R=function(a){this.u.error||(this.u.ready=!1!==a,this.u.ready&&(a=this.ua,this.ua=null,a&&a()))};
|
||||
function wa(a,b){if(a.u.wa)return a.u.ra=!1,a.u.wa=!1;if(a.u.error)return a.F(a.toString()+" error"),!1;a.u.ra=b;return a.u.ra}window&&(window.PCjs||(window.PCjs={}),window.PCjs.Machines||(window.PCjs.Machines={}),window.PCjs.Components||(window.PCjs.Components=[]),window.PCjs.Commands||(window.PCjs.Commands={}));
|
||||
var L=window?window.PCjs.Machines:{},E=window?window.PCjs.Components:[],J=window?window.PCjs.Commands:{},sa=["hold","sleep","wait"],ta={alert:function(a){B(a);return!0},sleep:function(a,b){setTimeout(a,+b);return!1}},ua={select:function(a,b,c){var d=!1;if(a=a.bindings[b])for(b=0;b<a.options.length;b++)if(a.options[b].textContent==c){a.selectedIndex!=b&&(a.selectedIndex=b);d=!0;break}return d}};
|
||||
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
|
||||
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});function M(a){D.call(this,"C1PPanel",a);this.u.I=!1}q(M,D);
|
||||
|
|
@ -132,7 +132,7 @@ e.L=function(a,b,c){var d=this;switch(b){case "listSerial":return this.B[b]=c,!0
|
|||
b.name,c.result.toString(),0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};e.Y=function(a,b,c,d){this.a=a;this.m=b;this.s=c-b+1;this.o=this.m+this.s;if(this.G=d)Ca(d,b,c,this,this.X),Q(d,b,c,this,this.ab);this.R()};e.$=function(a,b){a&&!this.u.I&&(this.u.I=!0,this.J=b,this.b=N(b,"keyboard"))};
|
||||
function ab(a,b,c,d){if(c){a.h=0;a.c=c;a.i=!0;a.f=Za;if(-1!==b.indexOf(".json",b.length-5))try{d="";var f=eval("("+c+")").bytes;for(c=0;c<f.length;c++)d+=String.fromCharCode(f[c]);a.c=d;a.i=!1}catch(g){a.F('Error processing file "'+b+'": '+g.message);return}a.J&&a.b&&a.G.u.Z?(a.F("auto-loading "+b),a.G.ca(),"."!=a.c.charAt(0)?(a.f=$a,W(a.b,"NEW\nLOAD\n")):(a.f=Ya,a.J.reset(!0),W(a.b,"ML"))):a.F(b+" ready to load")}else a.F('Error loading file "'+b+'" ('+d+")")}
|
||||
e.X=function(a,b){void 0!==b&&(a&1?bb(this):this.c&&!this.h&&bb(this))};e.ab=function(){};function bb(a){if(void 0!==a.c){a.g=-1;if(a.h<a.c.length){var b=a.c.charCodeAt(a.h++)&255;a.i&&10==b&&(b=13);a.g=b}else a.c="",a.h=0,a.f==$a&&a.b&&W(a.b," \nRUN\n"),a.f=Za;for(b=a.m+0;b<a.o;b+=2)a.a[b]=0<=a.g?cb:db;for(b=a.m+1;b<a.o;b+=2)a.a[b]=0<=a.g?a.g:0}}var db=0,cb=1,Za=0,$a=1,Ya=2;x(function(){for(var a=I(document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Xa(d);H(d,c)}});
|
||||
function eb(a){D.call(this,"C1PDiskController",a);this.u.I=!1;this.reset(!0)}q(eb,D);e=eb.prototype;e.reset=function(a){fb(this);this.b=-1;a&&(this.c=[],this.c[0]={ce:0,Ga:40,cb:!0,ia:20,aa:0,ha:-1,qa:[]})};
|
||||
function eb(a){D.call(this,"C1PDiskController",a);this.u.I=!1;this.reset(!0)}q(eb,D);e=eb.prototype;e.reset=function(a){fb(this);this.b=-1;a&&(this.c=[],this.c[0]={de:0,Ga:40,cb:!0,ia:20,aa:0,ha:-1,qa:[]})};
|
||||
function fb(a){a.s={C:64,read:function(){},update:function(a){return function(b){void 0!==b&&(this.C=b);a.i.C&4||X(a,0,this)}}(a)};a.f={C:255,read:function(){this.update()},update:function(a){return function(b){void 0===b?b=a.f.C:gb(a,b,a.h.C);b=(b|190)&-2;if(0<=a.b&&a.c[a.b].qa.length){var c=a.c[a.b];c.cb&&(b&=-33);c.aa||(b&=-3);10>=--c.ia&&(0<c.ia?(b&=-129,hb(a)):(c.ia=100,0<=a.b&&(a.c[a.b].ha=0,ib(a))))}this.C=b;a.i.C&4&&X(a,0,this)}}(a)};a.i={C:0,read:function(){},update:function(a){return function(b){void 0!==
|
||||
b&&(this.C=b&-193);X(a,1,this);a.f.update();a.s.update()}}(a)};a.v={C:255,read:function(){},update:function(a){return function(b){void 0!==b&&(this.C=b);a.j.C&4||X(a,2,this)}}(a)};a.h={C:255,read:function(){},update:function(a){return function(b){void 0===b?b=a.h.C:gb(a,a.f.C,b);if(0<=a.b&&a.b<a.c.length){var c=a.c[a.b];c.qa.length&&a.h.C&8&&!(b&8)&&(b&4?c.aa--:c.aa++,c.aa>=c.Ga&&(c.aa=c.Ga),0>c.aa&&(c.aa=0),c.ia=20,a.f.update(a.f.C|128),hb(a))}this.C=b;a.j.C&4&&X(a,2,this)}}(a)};a.j={C:0,read:function(){},
|
||||
update:function(a){return function(b){void 0!==b&&(this.C=b&-193);X(a,3,this);a.h.update();a.v.update()}}(a)};a.w={C:0,read:function(){},update:function(a){return function(b){void 0!==b&&(3==(b&3)&&(a.g.C=14),this.C=b);a.g.update()}}(a)};a.g={C:14,read:function(){},update:function(a){return function(b){void 0===b&&(b=a.g.C);b&=-2;0<=a.b&&0<=a.c[a.b].ha&&(b|=1);this.C=b;X(a,16,this)}}(a)};a.o={C:0,read:function(a){return function(){ib(a)}}(a),update:function(a){return function(b){void 0!==b&&(this.C=
|
||||
|
|
|
|||
Loading…
Reference in a new issue