Restrict the download option to Firefox for now, and disable the external XML link for saved machines

This commit is contained in:
Jeff Parsons 2016-02-17 23:03:29 -08:00
commit 22a4da112d
8 changed files with 397 additions and 383 deletions

View file

@ -156,8 +156,8 @@ Z.prototype.start=function(){for(var a in this.Y)if("cpu"!=a)for(var b=0;b<this.
function rb(a){var b=null,c;for(c in a.Y)for(var d=0;d<a.Y[c].length;d++){var e=a.Y[c][d];if(e){if(!K(e)){K(e,function(a){return function(){rb(a)}}(a));return}"cpu"==c?b=e:e.ha&&e.ha(!0,a)}}a.X();a.l("C1Pjs v1.20.9\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>");b&&b.ha(!0,a)}
x(function(){for(var a=G(document,"c1pjs","computer"),b=0;b<a.length;b++){for(var c=a[b],d=E(c),e,g={},h,k=0,l=0,m=0;m<d.modules.length;m++){var q=d.modules[m];if(!m){if("cpu"!=q.type)break;k=q.start;l=q.end;h=Array(l+1-k);for(e=k;e<h.length;e++)h[e]=0}if(e=pa(q.refID,d.id)){var C=q.type;void 0===g[C]&&(g[C]=[]);g[C].push(e);e.ba&&void 0!==q.start&&e.ba(h,q.start,q.end,g.cpu[0])}else{u('no component for <module refid="'+q.refID+'">');return}}if(void 0===h){u('<module type="cpu"> definition must appear first in the <computer> specification');
break}if(e=pa("debugger",d.id))g["debugger"]=[e],e.ba&&e.ba(h,k,l,g.cpu[0]);k=new Z(d,g);if(l=pa("panel",d.id))if(g.panel=[l],l.gb){e=d.id;d=void 0;g=[];e&&(e=0<(d=e.indexOf("."))?e.substr(0,d+1):"");for(d=0;d<A.length;d++)m=A[d],e&&m.id.indexOf(e)||g.push(m);d=g;for(g=0;g<d.length;g++)e=d[g],e!=l&&(e.$a=l.$a,e.l=l.l,e.gb=l.gb)}F(k,c);rb(k)}});var sb=0;function tb(a,b,c,d,e,g){e("Loading "+a+"...");t(a,null,function(h,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),g(k,null)):ub(k,a,b,c,d,e,g)})}
function ub(a,b,c,d,e,g,h){function k(a,g){if(g)h(g,null);else{if(c){D[c]&&b&&(D[c][b]=a);var k=b;k&&0>k.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(k=window.location.pathname+k);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+k+'"}';a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(k?' url="'+k+'"':""))}k=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||
"ActiveXObject"in window?(k=new window.ActiveXObject("Microsoft.XMLDOM"),k.async=!1,k.loadXML(a)):k=(new window.DOMParser).parseFromString(a,"text/xml")}catch(C){k=null,a=C.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,k)}}a?e?vb(a,g,k):k(a,null):h("no data"+(b?" for file: "+b:""),null)}
function ub(a,b,c,d,e,g,h){function k(a,g){if(g)h(g,null);else{if(c){D[c]&&b&&(D[c][b]=a);var k=b;k&&0>k.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(k=window.location.pathname+k);d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{";d+='url:"'+k+'"}';"object"==typeof resources&&(k=null);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(k?' url="'+k+'"':""))}k=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,
"")),window.ActiveXObject||"ActiveXObject"in window?(k=new window.ActiveXObject("Microsoft.XMLDOM"),k.async=!1,k.loadXML(a)):k=(new window.DOMParser).parseFromString(a,"text/xml")}catch(C){k=null,a=C.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);h(a,k)}}a?e?vb(a,g,k):k(a,null):h("no data"+(b?" for file: "+b:""),null)}
function vb(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");t(e,null,function(g,h,k){if(k||!h)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(g=d[3])if(k=h.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],m,q=/( [a-z]+=)(['"])(.*?)\2/g;m=q.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);k[0]!=l&&(h=h.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}h=h.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],h);vb(a,b,c)}})}else c(a,null)}
function wb(a,b,c){function d(a){if(void 0===h){var b=g&&G(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=ba(a))}function e(a){d("Error: "+a);k&&(--sb||y(!0));k=!1}var g,h,k=!0;sb++;D[a]={};try{if(g=document.getElementById(a)){var l;if("object"==typeof resources&&(l=resources.css)){var m=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.styleSheet.cssText=l:q.appendChild(document.createTextNode(l));m.appendChild(q)}c||(c=