Changed the default page "exit" event handler from "onunload" to "pagehide" for iOS; hopefully, auto-resume machines will work better on mobile devices with that change

This commit is contained in:
Jeff Parsons 2017-06-25 08:32:27 -07:00 committed by Jeff Parsons
commit 7457e4e44f
43 changed files with 132 additions and 117 deletions

View file

@ -66,7 +66,7 @@ function Ja(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return
function La(a){if(!Ma){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," "))}Ma=c}return Ma[a]||Ma[a.toLowerCase()]}
function Na(a,b,c,d){var e=null;b="data:application/"+b+(c?";base64":"")+",";b=Ka("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 Oa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Pa(a){Qa.init.push(a)}function Ra(a){if(Sa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){r(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ta(a){!Sa&&a?(Sa=!0,Ua&&Va("init"),Wa&&Va("show")):Sa=a}function Va(a){Qa[a]&&Ra(Qa[a])}var Ma=null,Qa={init:[],show:[],exit:[]},Ua=!1,Wa=!1,Sa=!0,Ha=null;
Oa("onload",function(){Ua=!0;Ra(Qa.init)});Oa("onpageshow",function(){Wa=!0;Ra(Qa.show)});Oa(Ka("Opera")||Ka("iOS")?"onunload":"onbeforeunload",function(){Ra(Qa.exit)});
Oa("onload",function(){Ua=!0;Ra(Qa.init)});Oa("onpageshow",function(){Wa=!0;Ra(Qa.show)});Oa(Ka("iOS")?"onpagehide":Ka("Opera")?"onunload":"onbeforeunload",function(){Ra(Qa.exit)});
function t(a,b){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.vi=b.comment;this.Jj=b;this.exports={};this.ia=this.bindings={};a=this.id.indexOf(".");0>a?this.Ud=this.id:(this.Wd=this.id.substr(0,a),this.Ud=this.id.substr(a+1));this.aa={ready:!1,yf:!1,ng:!1,Pb:!1,hf:!1,error:!1};this.Hf=null;this.aa.error=!1;this.Ea=this.U=this.ma=this.oa=this.Ef=null;Xa.push(this)}function Ya(a,b,c){Za[a]&&b&&(Za[a][b]=c)}function r(a){window&&window.alert(a)}
function ab(a){var b=!1;window&&(b=window.confirm(a));return b}function bb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<Xa.length;b++){var d=Xa[b];a&&d.id.indexOf(a)||c.push(d)}return c}function cb(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<Xa.length;c++)if(Xa[c].id===a)return Xa[c]}return null}
function db(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<Xa.length;d++)if(c)c==Xa[d]&&(c=null);else if(!(a!=Xa[d].type||b&&Xa[d].id.indexOf(b)))return Xa[d]}return null}function eb(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){r(c.message+" ("+a+")")}return b}function fb(a,b,c){var d;b&&(void 0===d&&(d="Panel"),(d=db(d,a.id))&&(b=d.ia[b])&&a.wb(null,c,b))}