@@ -90,7 +90,22 @@ export class BootLoader {
9090 */
9191 async setTimeoutAsync ( delay ) {
9292 return this . promisify ( setTimeout , delay ) ;
93- }
93+ }
94+
95+ /**
96+ * @abstract Checks if running device is mobile device.
97+ */
98+ get isMobile ( ) {
99+ // Solution from Internet ... does not work
100+ // Check for Samsung device ... good enough to detect Samsung Internet Browser
101+ // var mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
102+ // var mobile = /Samsung/i.test(navigator.userAgent);
103+ // var isMobile = ('ontouchstart' in document.documentElement && /mobi/i.test(navigator.userAgent)) || mobile ;
104+ var mobile =
105+ navigator . userAgentData ?. mobile ||
106+ / m o b i | i o s | a r m / i. test ( navigator . platform ) ;
107+ return mobile ? true : false ;
108+ }
94109
95110 /**
96111 * @abstract Initializes the app.
@@ -99,9 +114,9 @@ export class BootLoader {
99114 *
100115 * @async implements the Promise contract
101116 */
102- async initApp ( useEasyLoader ) {
117+ async initApp ( mobile ) {
103118 try {
104- this . vme = new KatexInputHelper ( useEasyLoader ) ;
119+ this . vme = new KatexInputHelper ( mobile ) ;
105120 window . vme = this . vme ; // prevents garbage collection?
106121 await this . vme . initialise ( ) ;
107122 $ ( '#myContainer' ) . layout ( { fit : true } ) ;
@@ -119,7 +134,15 @@ export class BootLoader {
119134
120135 this . katex = await import ( 'katex/dist/katex' ) ;
121136 await import ( 'katex/dist/contrib/mhchem' ) ;
137+ var mobile = this . isMobile ;
122138
139+ if ( mobile ) {
140+ var opts = { with : {
141+ type : 'css' ,
142+ } } ;
143+ await import ( './jquery-easyui/jquery.easyui.mobile' ) ;
144+ await import ( './jquery-easyui/themes/mobile.css' , opts ) ;
145+ }
123146 var counter = 20 ;
124147 while ( ! this . presenceCheck ( counter ) && -- counter >= 0 ) {
125148 await this . setTimeoutAsync ( 100 ) ;
@@ -129,7 +152,7 @@ export class BootLoader {
129152 await this . readyAsync ( ) ;
130153 console . debug ( 'Promise check : document ready.' ) ;
131154
132- await this . initApp ( false ) ;
155+ await this . initApp ( mobile ) ;
133156 console . debug ( 'Promise check : app started.' ) ;
134157 this . check ( ) ;
135158 }
0 commit comments