Roll out v1.17.4

This commit is contained in:
Jeff Parsons 2015-03-25 15:28:04 -07:00 committed by jeffpar
commit d6b9ed8efb
124 changed files with 142 additions and 143 deletions

View file

@ -646,21 +646,21 @@ Rd.prototype={constructor:Rd,set:function(a,b){try{this[this.id][a]=b}catch(c){}
a:JSON.stringify(a)},clear:function(a){uj(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(f){}b.splice(c,1);c=0}},$b:function(){}};function uj(a,b){a[a.id]={};b&&a.set("parms",b);a.Pi=!1}
function vj(a){var b=!0;if(ra()){var c=JSON.stringify(a[a.id]);ta(a.key,c)||(m("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}
function wj(a,b,c){n.call(this,"Computer",a,wj);this.ba.Wb=!1;this.xf=a.buswidth;this.Kc=xj;this.Jg=null;this.xh=!1;this.url=b?b.url:null;this.Jp=(Math.random()+.1).toString(36).substr(2,12);this.Lc=yj(this);if(this.S=Oa("CPU",this.id)){this.Ua=Oa("Debugger",this.id);this.ga=new xb({id:this.el+".bus",buswidth:this.xf},this.S,this.Ua);var d,e=Ma(this.id);if((this.Cd=Oa("Panel",this.id))&&this.Cd.Bi)for(b=0;b<e.length;b++)d=e[b],d.sa=this.Cd.sa,d.jc=this.Cd.jc,d.Bi=this.Cd.Bi;for(b=0;b<e.length;b++)d=
e[b],d.yc&&d.yc(this,this.ga,this.S,this.Ua);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.bi=d:this.Kc=parseInt(d,10));var f;if(a=Fa&&Fa.state||(f=!0,a.state))b=this.Dm=a,f||(this.xh=!0,this.Kc=xj),this.Kc&&(this.ei=new Rd(this,"1.17.3"),this.ei.load()?b=null:delete this.ei);!b&&this.Kc&&(f=null,this.Lc&&(f=oa()+"/api/v1/user?req=load&user="+this.Lc+"&state="+tj(this,"1.17.3")),b=f)&&(this.xh=!0);b?na(b,!0,null,this,this.Go):p(this);c||zj(this,this.Vh)}else m("Unable to find CPU component")}
e[b],d.yc&&d.yc(this,this.ga,this.S,this.Ua);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.bi=d:this.Kc=parseInt(d,10));var f;if(a=Fa&&Fa.state||(f=!0,a.state))b=this.Dm=a,f||(this.xh=!0,this.Kc=xj),this.Kc&&(this.ei=new Rd(this,"1.17.4"),this.ei.load()?b=null:delete this.ei);!b&&this.Kc&&(f=null,this.Lc&&(f=oa()+"/api/v1/user?req=load&user="+this.Lc+"&state="+tj(this,"1.17.4")),b=f)&&(this.xh=!0);b?na(b,!0,null,this,this.Go):p(this);c||zj(this,this.Vh)}else m("Unable to find CPU component")}
La(n,wj);var xj=0;k=wj.prototype;k.rf=function(){return this.Jp};k.Yd=function(){return this.Lc?this.Lc:""};k.Go=function(a,b,c){c?(this.bi=null,this.xh=!1,this.sa("Unable to load machine state from server (error "+c+(b?": "+(String.prototype.trim?b.trim():b.replace(/^\s+|\s+$/g,"")):"")+")")):this.Jg=b;p(this)};function zj(a,b,c){for(var d=Ma(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Ta(f)){Ta(f,function(){zj(a,b,c)});return}}b.call(a,c)}
function Aj(a,b){var c=new Rd(a,"1.17.3","validate");if(c.load()&&c.parse()){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.sa("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
k.Vh=function(a){void 0===a&&(a=this.Kc||(this.Jg?1:xj));var b=!1,c=!1;this.Tk=!1;var d=this.ei||new Rd(this,"1.17.3");if(-1==a)b=!0;else if(a>xj){if(d.load(this.Jg)){this.Se=new Rd(this,"1.17.3","failsafe");this.Se.load()&&(Bj(this,d),a=2,uj(this.Se));this.Se.set("timestamp",la());vj(this.Se);var e=this.Kc&&!this.xh;if(1==a||pa("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=d.parse()){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==
function Aj(a,b){var c=new Rd(a,"1.17.4","validate");if(c.load()&&c.parse()){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.sa("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}
k.Vh=function(a){void 0===a&&(a=this.Kc||(this.Jg?1:xj));var b=!1,c=!1;this.Tk=!1;var d=this.ei||new Rd(this,"1.17.4");if(-1==a)b=!0;else if(a>xj){if(d.load(this.Jg)){this.Se=new Rd(this,"1.17.4","failsafe");this.Se.load()&&(Bj(this,d),a=2,uj(this.Se));this.Se.set("timestamp",la());vj(this.Se);var e=this.Kc&&!this.xh;if(1==a||pa("Click OK to restore the previous PCjs machine state, or CANCEL to reset the machine.")){if(c=d.parse()){var f=d.get("code"),g=d.get("data");f&&("ok"==f?d.load(g):("error"==
f&&"no machine state"!=g?(this.sa("Error: "+g),"unable to verify user"==g&&(ta("user",""),this.Lc=null)):this.jc(f+": "+g),uj(d),d.load()?(c=d.parse(),e=!0):c=!1))}e&&Aj(this,c?d:null)}else 2==a&&d.clear()}else Aj(this);delete this.Jg;delete this.ei}e=Ma(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.S&&(c=Cj(this,g,d,b,c));b=[d,a,c];-1!=a?zj(this,this.Mk,b):this.Mk(b)};
function Cj(a,b,c,d,e){if(!b.ba.Wb){b.ba.Wb=!0;if(b.Zb){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Zb(f,d)&&f&&(m("Unable to restore state for "+b.type),a.Dm&&!a.Jg?(c.clear(),a.Kc=xj,window&&window.location.reload()):a.Tk=!0,b.Zb(null),e=!1)}if(!d&&b.ag)for(a=b.ag.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.Mk=function(a){var b=a[0],c=0>a[1];a=a[2];this.ba.Wb=!0;this.Qk||(this.jc("PCjs v1.17.3\nCopyright \u00a9 2012-2015 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.Qk=!0);this.S&&(Cj(this,this.S,b,c,a),rc(this.S));this.Tk&&(Bj(this,b),b.clear());!c&&this.Se&&(this.Se.clear(),delete this.Se)};
function Bj(a,b){if(pa("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.Yd(),d=b.toString(),e={app:"PCjs",ver:"1.17.3"};e.url=a.url;e.user=c;e.type="bug";e.data=d;na("http://www.pcjs.org/api/v1/report",!0,e)}}
function Dj(a,b,c){var d,e="none",f=new Rd(a,"1.17.3"),g=new Rd(a,"1.17.3","validate"),h=la();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.17.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.S&&a.S.Yb&&(c&&uc(a.S),d=a.S.Yb(b,c),"object"===typeof d&&f.set(a.S.id,d),c&&(a.S.ba.Wb=!1,!1===d&&(e=null)));for(var h=Ma(a.id),r=0;r<h.length;r++){var t=h[r];t.ba.Wb&&(t.Yb&&(d=t.Yb(b,c),"object"===typeof d&&f.set(t.id,d)),c&&(t.ba.Wb=
k.Mk=function(a){var b=a[0],c=0>a[1];a=a[2];this.ba.Wb=!0;this.Qk||(this.jc("PCjs v1.17.4\nCopyright \u00a9 2012-2015 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>"),this.Qk=!0);this.S&&(Cj(this,this.S,b,c,a),rc(this.S));this.Tk&&(Bj(this,b),b.clear());!c&&this.Se&&(this.Se.clear(),delete this.Se)};
function Bj(a,b){if(pa("There may be a problem with your PCjs machine.\n\nTo help us diagnose it, click OK to send this PCjs machine state to http://www.pcjs.org.")){var c=a.Yd(),d=b.toString(),e={app:"PCjs",ver:"1.17.4"};e.url=a.url;e.user=c;e.type="bug";e.data=d;na("http://www.pcjs.org/api/v1/report",!0,e)}}
function Dj(a,b,c){var d,e="none",f=new Rd(a,"1.17.4"),g=new Rd(a,"1.17.4","validate"),h=la();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.17.4");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.S&&a.S.Yb&&(c&&uc(a.S),d=a.S.Yb(b,c),"object"===typeof d&&f.set(a.S.id,d),c&&(a.S.ba.Wb=!1,!1===d&&(e=null)));for(var h=Ma(a.id),r=0;r<h.length;r++){var t=h[r];t.ba.Wb&&(t.Yb&&(d=t.Yb(b,c),"object"===typeof d&&f.set(t.id,d)),c&&(t.ba.Wb=
!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.Lc&&Ej(a,a.Lc,f.toString()),vj(g)&&vj(f)||(e=null,d=h=!0)):a.Kc&&(d=!0,h=3==a.Kc),d&&f.clear(h)):e=f.toString());c&&(a.ba.Wb=!1);return e}k.reset=function(){this.ga&&this.ga.reset&&(this.$b("Resetting "+this.ga.type),this.ga.reset());for(var a=Ma(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.ga&&c.reset&&(this.$b("Resetting "+c.type),c.reset())}};
k.start=function(a,b){for(var c=Ma(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}};k.stop=function(a,b){for(var c=Ma(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}};
k.Cb=function(a,b,c){var d=this;switch(b){case "save":return this.la[b]=c,c.onclick=function(){var a=yj(d,!0);if(a){var b=!(!d.Kc||d.bi),c=Dj(d,b);b?Ej(d,a,c):d.sa("Resume disabled, machine state not saved")}},!0;case "reset":return this.la[b]=c,c.onclick=function(){vc(d)},!0}return!1};
function yj(a,b){var c=a.Lc;c||(c=sa("user"),void 0!==c?!c&&b&&(c=null,window&&(c=window.prompt("To save machine states on the pcjs.org server, you need a user ID (email support@pcjs.org).\n\nOnce you have an ID, enter it below.","")),c&&((c=Fj(a,c))||a.sa("Your user ID has not been approved."))):b&&a.sa("Browser local storage is not available"));return c}
function Fj(a,b){a.Lc=null;var c=na(oa()+"/api/v1/user?req=verify&user="+b),d=c[1];if(!c[0]&&d)try{c=eval("("+d+")"),c.code&&"ok"==c.code&&(ta("user",c.data),a.Lc=c.data)}catch(e){m(e.message+" ("+d+")")}return a.Lc}
function Ej(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=tj(a,"1.17.3");d.data=c;b=na(oa()+"/api/v1/user",!1,d);d=b[1];if(b[0]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[0]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.sa("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.sa(c),ta("user",""),a.Lc=null)}}
function Ej(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=tj(a,"1.17.4");d.data=c;b=na(oa()+"/api/v1/user",!1,d);d=b[1];if(b[0]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[0]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.sa("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.sa(c),ta("user",""),a.Lc=null)}}
function vc(a){if(a.Kc&&!a.bi){var b=pa("Click OK to save changes to this PCjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Dj(a,b,!0);!b&&a.Dm?window&&window.location.reload():(b||(a.Qi=!0),a.Vh(xj),a.Qi=!1)}else a.reset(),a.S&&rc(a.S)}function bb(a,b,c){a=Ma(a.id);for(var d=0;d<a.length;d++){var e=a[d];if(c)c==e&&(c=null);else if(e.type==b)return e}return null}
za(function(){for(var a=Ra(window.document,"pcjs-machine"),b=0;b<a.length;b++)for(var c=a[b],d=Pa(c),c=Ra(c,"pcjs","computer"),e=0;e<c.length;e++){var f=c[e],g=Pa(f),g=new wj(g,d,!0);Qa(g,f);zj(g,g.Vh)}});va.show.push(function(){for(var a=Ra(window.document,"pcjs","computer"),b=0;b<a.length;b++){var c=Pa(a[b]);(c=Oa("Computer",c.id))&&c.Qk&&!c.ba.Wb&&c.Vh(-1)}});
va.exit.push(function(){for(var a=Ra(window.document,"pcjs","computer"),b=0;b<a.length;b++){var c=Pa(a[b]);(c=Oa("Computer",c.id))&&c.ba.Wb&&Dj(c,!(!c.Kc||c.bi),!0)}});var Gj=0;function Hj(a,b,c,d,e,f){e("Loading "+a+"...");na(a,!0,null,null,function(g,h,r){r?(h||(h="unable to load "+a+" ("+r+")"),f(h,null)):Ij(h,a,b,c,d,e,f)})}
@ -668,6 +668,6 @@ function Ij(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{if(c){var h=b;h&&
null,a=J.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,h)}}a?e?Jj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function Jj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");na(e,!0,null,null,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var r=h[0],t,C=/( [a-z]+=)(['"])(.*?)\2/g;t=C.exec(f);)r=0>r.indexOf(t[1])?r.replace(">",t[0]+">"):r.replace(new RegExp(t[1]+"(['\"])(.*?)\\1"),t[0]);h[0]!=r&&(g=g.replace(h[0],r))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);Jj(a,b,c)}})}else c(a,null)}
function Kj(a,b,c,d){function e(a){if(void 0===h){var b=g&&Ra(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ja(a))}function f(a){e("Error: "+a);r&&(--Gj||Ba(!0));r=!1}var g,h,r=!0;Gj++;try{if(g=window.document.getElementById(a)){c||(c="/versions/pcjs/1.17.3/components.xsl");var t=function(d,h){if(h){var r=function(d,r){if(r)if(r)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var t=h.transformNode(r);t?(g.outerHTML=t,--Gj||Ba(!0)):f("transformNodeToObject failed")}else window.document.implementation&&
function Kj(a,b,c,d){function e(a){if(void 0===h){var b=g&&Ra(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ja(a))}function f(a){e("Error: "+a);r&&(--Gj||Ba(!0));r=!1}var g,h,r=!0;Gj++;try{if(g=window.document.getElementById(a)){c||(c="/versions/pcjs/1.17.4/components.xsl");var t=function(d,h){if(h){var r=function(d,r){if(r)if(r)if(e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var t=h.transformNode(r);t?(g.outerHTML=t,--Gj||Ba(!0)):f("transformNodeToObject failed")}else window.document.implementation&&
window.document.implementation.createDocument?(t=new XSLTProcessor,t.importStylesheet(r),(t=t.transformToFragment(h,window.document))?g.parentNode?(g.parentNode.replaceChild(t,g),--Gj||Ba(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f("failed to load XSL file: "+c);else f(d)};h?Hj(c,null,null,!1,e,r):f("failed to load XML file: "+b)}else f(d)};"<"!=b.charAt(0)?Hj(b,a,d,!0,e,t):Ij(b,null,a,d,!1,e,t)}else f("missing machine element: "+
a)}catch(C){f(C.message)}return r}window.embedPC=function(a,b,c,d){Ba(!1);return Kj(a,b,c,d)};window.enableEvents=Ba;window.sendEvent=Ca;})();