Added mobile browser detection to disable FileReader controls on mobile devices
While support for local disk images and other local resources can work on some mobile devices, I don't think the use cases warrant the extra (largely wasted) screen space
This commit is contained in:
parent
c2c387a06d
commit
6eb3911a67
4 changed files with 23 additions and 13 deletions
|
|
@ -129,9 +129,9 @@ C1PSerialPort.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||||
|
|
||||||
case "mountSerial":
|
case "mountSerial":
|
||||||
/*
|
/*
|
||||||
* Check for availability of FileReader
|
* Check for non-mobile (desktop) browser and the availability of FileReader
|
||||||
*/
|
*/
|
||||||
if (window && 'FileReader' in window) {
|
if (!web.isMobile() && window && 'FileReader' in window) {
|
||||||
this.bindings[sBinding] = control;
|
this.bindings[sBinding] = control;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -173,10 +173,11 @@ function FDC(parmsFDC) {
|
||||||
this.aDiskHistory = [];
|
this.aDiskHistory = [];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If setBinding() sees a binding for loading local disks, it will set this flag, and then initBus()
|
* Support for local disk images is currently limited to desktop browsers with FileReader support;
|
||||||
* can intelligently update the "listDisks" control accordingly.
|
* when this flag is set, setBinding() allows local disk bindings and informs initBus() to update the
|
||||||
|
* "listDisks" binding accordingly.
|
||||||
*/
|
*/
|
||||||
this.fLocalDisks = false;
|
this.fLocalDisks = (!web.isMobile() && window && 'FileReader' in window);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The remainder of FDC initialization now takes place in our initBus() handler, largely because we
|
* The remainder of FDC initialization now takes place in our initBus() handler, largely because we
|
||||||
|
|
@ -473,13 +474,8 @@ FDC.prototype.setBinding = function(sHTMLType, sBinding, control)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "mountDrive":
|
case "mountDrive":
|
||||||
/*
|
if (this.fLocalDisks) {
|
||||||
* Check for availability of FileReader
|
|
||||||
*/
|
|
||||||
if (window && 'FileReader' in window) {
|
|
||||||
this.fLocalDisks = true;
|
|
||||||
this.bindings[sBinding] = control;
|
this.bindings[sBinding] = control;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable "Mount" button only if a file is actually selected
|
* Enable "Mount" button only if a file is actually selected
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -949,10 +949,10 @@ Keyboard.prototype.setModel = function(nModel)
|
||||||
Keyboard.prototype.setReady = function()
|
Keyboard.prototype.setReady = function()
|
||||||
{
|
{
|
||||||
this.iOS = web.isUserAgent("iOS");
|
this.iOS = web.isUserAgent("iOS");
|
||||||
this.fMobile = (this.iOS || web.isUserAgent("Android"));
|
this.fMobile = web.isMobile();
|
||||||
this.messageDebugger("mobile keyboard support: " + (this.fMobile? "true" : "false"));
|
this.messageDebugger("mobile keyboard support: " + (this.fMobile? "true" : "false"));
|
||||||
/*
|
/*
|
||||||
* TODO: Determine how to declare this superclass method in order to avoid a type warning
|
* TODO: Determine how to declare this superclass method in order to avoid a type warning in WebStorm
|
||||||
*/
|
*/
|
||||||
return Component.prototype.setReady.call(this);
|
return Component.prototype.setReady.call(this);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,20 @@ web.isUserAgent = function(s)
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* isMobile()
|
||||||
|
*
|
||||||
|
* Check the browser's user-agent string for the substring "Mobi", as per Mozilla recommendation:
|
||||||
|
*
|
||||||
|
* https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
|
||||||
|
*
|
||||||
|
* @return {boolean} is true if the browser appears to be a mobile (ie, non-desktop) web browser, false if not
|
||||||
|
*/
|
||||||
|
web.isMobile = function()
|
||||||
|
{
|
||||||
|
return web.isUserAgent("Mobi");
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getURLParameters(sParms)
|
* getURLParameters(sParms)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue