Update: 更新web device初始化逻辑
This commit is contained in:
@@ -77,7 +77,7 @@ LazyLoad.js([
|
|||||||
|
|
||||||
goog.platform = () => {
|
goog.platform = () => {
|
||||||
const userAgent = navigator.userAgent;
|
const userAgent = navigator.userAgent;
|
||||||
if (userAgent.indexOf('Mobile') !== -1) return 'mobile';
|
if (!navigator.serial) return 'mobile';
|
||||||
if (userAgent.indexOf('Windows NT') !== -1) return 'win32';
|
if (userAgent.indexOf('Windows NT') !== -1) return 'win32';
|
||||||
if (userAgent.indexOf('Mac') !== -1) return 'darwin';
|
if (userAgent.indexOf('Mac') !== -1) return 'darwin';
|
||||||
if (userAgent.indexOf('X11') !== -1) return 'linux';
|
if (userAgent.indexOf('X11') !== -1) return 'linux';
|
||||||
@@ -96,7 +96,7 @@ LazyLoad.js([
|
|||||||
else if (userAgent.indexOf('Windows NT 6.1') != -1) os = 'win7';
|
else if (userAgent.indexOf('Windows NT 6.1') != -1) os = 'win7';
|
||||||
else if (userAgent.indexOf('Windows NT 6.0') != -1) os = 'winvista';
|
else if (userAgent.indexOf('Windows NT 6.0') != -1) os = 'winvista';
|
||||||
else if (userAgent.indexOf('Windows NT 5.1') != -1) os = 'winxp';
|
else if (userAgent.indexOf('Windows NT 5.1') != -1) os = 'winxp';
|
||||||
} else if (navigator.serial==undefined) {
|
} else if (!navigator.serial) {
|
||||||
os = 'android';
|
os = 'android';
|
||||||
} else if (platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {
|
} else if (platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {
|
||||||
os = 'ios';
|
os = 'ios';
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ if (platform === 'win32' && fullPlatform !== 'win10') {
|
|||||||
Device = USBMini;
|
Device = USBMini;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (['android', 'ios'].includes(fullPlatform)) {
|
} else if (platform === 'mobile') {
|
||||||
if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) {
|
if (['BBC micro:bit', 'Mithon CC'].includes(BOARD.boardType)) {
|
||||||
Device = USB;
|
Device = USB;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user