Skip to content

Commit

Permalink
Version_0.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
censujiang committed Apr 7, 2023
1 parent 63e3fec commit 202320b
Show file tree
Hide file tree
Showing 51 changed files with 447 additions and 260 deletions.
1 change: 1 addition & 0 deletions device.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare function checkDeviceType(): "android" | "ios" | "pad" | "watch" | "desktop";
30 changes: 29 additions & 1 deletion dist/index.aio.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* galanga 0.0.21 (https://github.com/censujiang/galanga)
* galanga 0.0.22 (https://github.com/censujiang/galanga)
* API https://github.com/censujiang/galanga/blob/master/doc/api.md
* Copyright 2014-2023 censujiang. All Rights Reserved
* Licensed under Apache License 2.0 (https://github.com/censujiang/galanga/blob/master/LICENSE)
Expand Down Expand Up @@ -182,9 +182,37 @@
return reg.test(email);
}

//根据UA检查设备是手机、平板、手表还是桌面
//启动此函数后,将会检查当前浏览器的UA。
//安卓手机返回android,苹果手机返回ios,平板返回pad,手表返回watch,桌面返回desktop
function checkDeviceType() {
var ua = navigator.userAgent;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua)) {
if (/Android/i.test(ua)) {
return 'android';
}
else if (/iPhone|iPad|iPod/i.test(ua)) {
return 'ios';
}
else if (/iPad/i.test(ua)) {
return 'pad';
}
else if (/Watch/i.test(ua)) {
return 'watch';
}
else {
return 'desktop';
}
}
else {
return 'desktop';
}
}

//导出自己的名字
var name = 'galanga';

exports.checkDeviceType = checkDeviceType;
exports.checkEmail = checkEmail;
exports.checkNull = checkNull;
exports.checkPassword = checkPassword;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.aio.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 29 additions & 2 deletions dist/index.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* galanga 0.0.21 (https://github.com/censujiang/galanga)
* galanga 0.0.22 (https://github.com/censujiang/galanga)
* API https://github.com/censujiang/galanga/blob/master/doc/api.md
* Copyright 2014-2023 censujiang. All Rights Reserved
* Licensed under Apache License 2.0 (https://github.com/censujiang/galanga/blob/master/LICENSE)
Expand Down Expand Up @@ -176,7 +176,34 @@ function checkEmail(email) {
return reg.test(email);
}

//根据UA检查设备是手机、平板、手表还是桌面
//启动此函数后,将会检查当前浏览器的UA。
//安卓手机返回android,苹果手机返回ios,平板返回pad,手表返回watch,桌面返回desktop
function checkDeviceType() {
var ua = navigator.userAgent;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua)) {
if (/Android/i.test(ua)) {
return 'android';
}
else if (/iPhone|iPad|iPod/i.test(ua)) {
return 'ios';
}
else if (/iPad/i.test(ua)) {
return 'pad';
}
else if (/Watch/i.test(ua)) {
return 'watch';
}
else {
return 'desktop';
}
}
else {
return 'desktop';
}
}

//导出自己的名字
var name = 'galanga';

export { checkEmail, checkNull, checkPassword, formatBytes, localCookie, name, strLength, url };
export { checkDeviceType, checkEmail, checkNull, checkPassword, formatBytes, localCookie, name, strLength, url };
2 changes: 1 addition & 1 deletion dist/index.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 29 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* galanga 0.0.21 (https://github.com/censujiang/galanga)
* galanga 0.0.22 (https://github.com/censujiang/galanga)
* API https://github.com/censujiang/galanga/blob/master/doc/api.md
* Copyright 2014-2023 censujiang. All Rights Reserved
* Licensed under Apache License 2.0 (https://github.com/censujiang/galanga/blob/master/LICENSE)
Expand Down Expand Up @@ -178,9 +178,37 @@ function checkEmail(email) {
return reg.test(email);
}

//根据UA检查设备是手机、平板、手表还是桌面
//启动此函数后,将会检查当前浏览器的UA。
//安卓手机返回android,苹果手机返回ios,平板返回pad,手表返回watch,桌面返回desktop
function checkDeviceType() {
var ua = navigator.userAgent;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua)) {
if (/Android/i.test(ua)) {
return 'android';
}
else if (/iPhone|iPad|iPod/i.test(ua)) {
return 'ios';
}
else if (/iPad/i.test(ua)) {
return 'pad';
}
else if (/Watch/i.test(ua)) {
return 'watch';
}
else {
return 'desktop';
}
}
else {
return 'desktop';
}
}

//导出自己的名字
var name = 'galanga';

exports.checkDeviceType = checkDeviceType;
exports.checkEmail = checkEmail;
exports.checkNull = checkNull;
exports.checkPassword = checkPassword;
Expand Down
Loading

0 comments on commit 202320b

Please sign in to comment.