Cleaned up PC8080 cross-browser full-screen support (matches PCx86 now)
This commit is contained in:
parent
c397937a87
commit
13b0c23b0a
19 changed files with 500 additions and 524 deletions
|
|
@ -62,7 +62,7 @@ function Ea(a,b){var c;if(Array.prototype.indexOf)return a.indexOf(b,c);c=c||0;0
|
|||
function Ha(a,b,c,d,e){c=void 0===c?!1:c;var f=0,g=null,h=null;if("object"==typeof resources&&(g=resources[a]))return d&&d(a,g,f),[g,f];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),h;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4!==k.readyState?e&&e(1):(g=k.responseText,200==k.status||!k.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(f=k.status||-1),
|
||||
e&&e(2),d&&d(a,g,f))});e&&e(0);if(b&&"object"==typeof b){var m="",p;for(p in b)b.hasOwnProperty(p)&&(m&&(m+="&"),m+=p+"="+encodeURIComponent(b[p]));m=m.replace(/%20/g,"+");k.open("POST",a,c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(m)}else k.open("GET",a,c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(g=k.responseText,200!=k.status&&(f=k.status||-1),d&&d(a,g,f),h=[g,f]);return h}
|
||||
function Ia(){return"http://"+(window?window.location.host:"www.pcjs.org")}function Ja(){return window?window.navigator.userAgent:""}function Ka(){if(null==La){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}La=a}return La}function Ma(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}
|
||||
function Na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Pa(a){if(window){var b=Ja();return"iOS"==a&&!!b.match(/(iPod|iPhone|iPad)/)&&!!b.match(/AppleWebKit/)||"MSIE"==a&&!!b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)}return!1}function Qa(a,b,c){if(a)for(var d=0;d<Sa.length;d++){var e=Sa[d];if(c){if(e+=c,b+e in a)return e}else if(e=e?e+b[0].toUpperCase():b[0].toLowerCase(),e+=b.substr(1),e in a)return e}return null}
|
||||
function Na(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Pa(a){if(window){var b=Ja();return"iOS"==a&&!!b.match(/(iPod|iPhone|iPad)/)&&!!b.match(/AppleWebKit/)||"MSIE"==a&&!!b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)}return!1}function Qa(a,b,c){if(a)for(var d=0;d<Sa.length;d++){var e=Sa[d];if(c){if(e+=c,b+e in a)return e}else if(e=e?e+b[0].toUpperCase():b[0],e+=b.substr(1),e in a)return e}return null}
|
||||
function Ta(a){if(!Ua){var b,c={};if(window){b||(b=window.location.search.substr(1));for(var d,e=/\+/g,f=/([^&=]+)=?([^&]*)/g;d=f.exec(b);)c[decodeURIComponent(d[1].replace(e," "))]=decodeURIComponent(d[2].replace(e," "))}Ua=c}return Ua[a]||Ua[a.toLowerCase()]}
|
||||
function Va(a,b,c,d){var e=null;b="data:application/"+b+(c?";base64":"")+",";b=Pa("Firefox")?b+(c?a:encodeURIComponent(a)):b+(c?a:encodeURI(a));d&&(e=document.createElement("a"),"string"!=typeof e.download&&(e=null));e?(e.href=b,e.download=d,document.body.appendChild(e),e.click(),document.body.removeChild(e),a="Check your Downloads folder for "+d+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(d?" ("+d+")":"")+".");return a}
|
||||
function Wa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}function Xa(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}function Ya(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}
|
||||
|
|
@ -548,8 +548,8 @@ $r[98]=function(a,b){a+=this.H;b=ws[b&15];b&=this.controller.wb;b=b&this.control
|
|||
$r[226]=function(a,b){a+=this.H;b=ws[b&15];b^=this.controller.wb;b=b&this.controller.Db|this.controller.wb&~this.controller.Db;b=b&this.controller.kb|this.W[a]&~this.controller.kb;this.W[a]!=b&&(this.W[a]=b,this.Na=!0)};$r[3]=function(a,b){a+=this.H;b=b>>this.controller.Qc|b<<8-this.controller.Qc&255;b=(b|b<<8|b<<16|b<<24)&this.controller.Db;b=this.controller.Kf&b|this.controller.wb&~b;b=b&this.controller.kb|this.W[a]&~this.controller.kb;this.W[a]!=b&&(this.W[a]=b,this.Na=!0)};
|
||||
function Q(a,b,c,d,e){nb.call(this,"Video",a,262144);var f=this,g;this.Vc=Pa("Gecko/");this.da=a.model;var h=xs[this.da]||xs.mda;this.La=h[0];this.wd=a.memory||0;this.od=a.switches;this.ea=a.mode;if(null==this.ea||null==ys[this.ea])this.ea=h[1];this.Rb=a.charCols;this.wc=a.charRows;if(void 0===this.Rb||void 0===this.wc)this.Rb=ys[this.ea][0],this.wc=ys[this.ea][1];this.Z=a.screenWidth;this.ka=a.screenHeight;this.bd=a.scale;this.Rd=12<=Math.round(this.Z/this.Rb);this.N=b;this.L=c;this.F=(this.ug=d)||
|
||||
b||null;this.gc=a.screenColor||"black";this.nd=(1-(Ta("flicker")||a.flicker||0)).toString();this.Gb=!1;b&&(b.style.backgroundColor=this.gc);e&&(e.style.backgroundColor=this.gc);b=a.smoothing;(c=Ta("smoothing"))&&(b="true"==c);null!=b&&(g=Qa(this.L,"imageSmoothingEnabled"))&&(this.L[g]=b);this.pd=a.touchScreen;this.Ac=zs;this.G=null;this.Hd=a.autoLock;this.fb=this.Sb=0;this.ra=[];this.ha=Array(this.La==pq?256:16);this.Ia=!1;if(this.P=e)if(g=Qa(e,"requestFullscreen")||Qa(e,"requestFullScreen")){this.P.A=
|
||||
e[g];if(e=Qa(document,"on","fullscreenchange")){var k=Qa(document,"fullscreenElement")||Qa(document,"fullScreenElement");document.addEventListener(e,function(){As(f,!!k)},!1)}(e=Qa(document,"on","fullscreenerror"))&&document.addEventListener(e,function(){As(f,null)},!1)}if(this.F&&(this.F.onfocus=function(){return f.Gg(!0)},this.F.onblur=function(){return f.Gg(!1)},this.F.se=(g=Qa(this.F,"requestPointerLock"))&&this.F[g],this.F.B=(g=Qa(this.F,"exitPointerLock"))&&this.F[g],this.F.se)){var m=Qa(document,
|
||||
"pointerLockElement");(e=Qa(document,"on","pointerlockchange"))&&document.addEventListener(e,function(){f.Mf(!(!m||document[m]!==f.F))},!1)}(this.Aa=a.fontROM)&&"json"!=ra(this.Aa)&&(this.Aa=Ia()+"/api/v1/dump?file="+this.Aa+"&format=bytes")}ba(Q,nb);l=Q.prototype;
|
||||
e[g];if(e=Qa(document,"on","fullscreenchange")){var k=Qa(document,"fullscreenElement")||Qa(document,"fullScreenElement");document.addEventListener(e,function(){As(f,!!k)},!1)}(e=Qa(document,"on","fullscreenerror"))&&document.addEventListener(e,function(){As(f,null)},!1)}if(this.F&&(this.F.onfocus=function(){return f.Gg(!0)},this.F.onblur=function(){return f.Gg(!1)},this.F.se=(g=Qa(this.F,"requestPointerLock"))&&this.F[g],this.F.B=(g=Qa(this.F,"exitPointerLock"))&&this.F[g],this.F.se&&(e=Qa(document,
|
||||
"on","pointerlockchange")))){var m=Qa(document,"pointerLockElement");document.addEventListener(e,function(){f.Mf(!(!m||document[m]!==f.F))},!1)}(this.Aa=a.fontROM)&&"json"!=ra(this.Aa)&&(this.Aa=Ia()+"/api/v1/dump?file="+this.Aa+"&format=bytes")}ba(Q,nb);l=Q.prototype;
|
||||
l.uc=function(a,b,c,d){var e=this;this.na=b;this.H=c;this.ca=d;c=(c=xs[this.da])&&c[0];c!==Bs&&(Rc(b,this,Cs),Vc(b,this,Ds));c!==Es&&(Rc(b,this,Fs),Vc(b,this,Gs));this.La>=nq&&(Rc(b,this,Hs),Vc(b,this,Is));this.La==pq&&(Rc(b,this,Js),Vc(b,this,Ks));d&&Kl(d,262144,function(a){if(e.B)if(a[0]){var b=e.B;if(b.gd){var c,d,f,g=!1,h=8,J=8,H=-1,I=b.video.D>>3;for(c=0;c<a.length;c++){var P=a[c];if(c){var L=P.charAt(0);d=ia(P.substr(1),16);switch(L){case "l":h=d;break;case "n":1<=d&&8>=d&&(J=d,g=!0);break;
|
||||
case "p":0<=d&&3>=d&&(H=d);break;case "w":d<I&&(I=d);break;default:b.ca.O("unrecognized argument: "+P)}}else f=ia(P,16)}void 0===f?f=b.B||0:f>=b.fb&&(f-=b.fb);a="";for(c=0;c<h;c++){P=q(b.fb+f)+":";for(d=0;d<J&&f<b.gd.length;d++)L=b.gd[f++],P+=" "+(0>H?q(L):la(L>>(H<<3),8));g&&(f+=I-J);a&&(a+="\n");a+=P}a&&b.ca.O(a);b.B=f}else b.ca.O("no buffer")}else e.ca.O("BIOSMODE: "+na(e.la)),b=e.B,Xr(b,"CRTC",b.hc,b.$a,b.jg),b.La>=nq&&(Xr(b," GRC",b.Ed,b.Dd,b.$g),Xr(b," SEQ",b.Fd,b.de,b.ah),Xr(b," ATC",b.Cd,
|
||||
b.Dc,b.Zg),Xr(b," ATCINDX",b.Cd),b.ca.O(" ATCDATA: "+b.Pe),Xr(b," FEAT",b.Sf),Xr(b," MISC",b.ef),Xr(b," STATUS0",b.Ng)),Xr(b," STATUS1",b.ga),b.La!=Es&&b.La!=Bs||Xr(b," MODEREG",b.Wc),b.La==Bs&&Xr(b," COLOR",b.cf),b.La>=nq&&(b.ca.O(" LATCHES: "+q(b.wb)),b.ca.O(" ACCESS: "+q(b.yg,4)),b.ca.O("Use 'dump video [addr]' to dump video memory"));else e.ca.O("no active video card")});if((this.C=$b(a,"Keyboard"))&&this.N){for(var f in this.ma)0<f.indexOf("lock")&&this.C.Eb("led",f,this.ma[f]);this.C.Eb(this.ug?
|
||||
|
|
|
|||
Loading…
Reference in a new issue