uadetect
Advanced tools
Comparing version 2.0.2 to 3.0.0
{ | ||
"ExpandedNodes": [ | ||
"", | ||
"\\src" | ||
"\\src", | ||
"\\tests" | ||
], | ||
"SelectedNode": "\\src\\ram.ts", | ||
"SelectedNode": "\\src\\doNotTrack.ts", | ||
"PreviewInSolutionExplorer": false | ||
} |
@@ -0,0 +0,0 @@ { |
@@ -16,5 +16,8 @@ { | ||
"tests", | ||
"readme" | ||
"readme", | ||
"community" | ||
"errors", | ||
"docs" | ||
], | ||
"typescript.tsdk": "node_modules\\typescript\\lib" | ||
} |
@@ -25,3 +25,3 @@ let ua = navigator.userAgent; | ||
else { | ||
return 'unknown'; | ||
throw new Error("ERR: Browser can not be determined \(UAD_101\)"); | ||
} | ||
@@ -28,0 +28,0 @@ }; |
let cookies = navigator.cookieEnabled; | ||
const getCookies = (cookies) => { | ||
if (cookies == true) { | ||
if (cookies === true) { | ||
return "COOKIES_enabled"; | ||
} | ||
; | ||
if (cookies == false) { | ||
if (cookies === false) { | ||
return "COOKIES_notEnabled"; | ||
} | ||
else { | ||
return "ERROR"; | ||
throw new Error("ERR: Cookie status can not be determined \(UAD_201\)"); | ||
} | ||
@@ -13,0 +13,0 @@ }; |
@@ -0,0 +0,0 @@ //DEVICE TYPE |
@@ -17,3 +17,3 @@ let browserDoNotTrack = navigator.doNotTrack; | ||
else { | ||
return "ERROR"; | ||
throw new Error("Unknown doNotTrack value\(UAD_801\)"); | ||
} | ||
@@ -20,0 +20,0 @@ }; |
@@ -25,4 +25,3 @@ // Finite Device Type | ||
else { | ||
console.log("ERR: Unknown Device"); | ||
return "unknown"; | ||
throw new Error("Unknown device type\(UAD_601\)"); | ||
} | ||
@@ -29,0 +28,0 @@ } |
@@ -0,0 +0,0 @@ let getCurrentUA = () => { |
@@ -1,1 +0,53 @@ | ||
declare module 'uadetect'; | ||
/* | ||
Copyright © 2022, PorkyProductions, and it's contributors. | ||
Licensed under the Apache-2.0 License. | ||
*/ | ||
// The Declaration of the Library Itsself | ||
declare module 'uadetect'; | ||
// ORIENTATION | ||
declare const ORIENTATION_isLandscape: boolean; | ||
// DEVICE TYPES | ||
declare const DEVICE_type: string; | ||
declare const DEVICE_finiteType: string; | ||
// COOKIES | ||
declare const cookieStatus: boolean; | ||
// Do Not Track | ||
declare const doNotTrackStatus: boolean; | ||
// Browser | ||
declare const browser: string; | ||
// Browser Ram | ||
declare const browserRam: number; | ||
// Build Number | ||
declare const buildNumber: number; | ||
// Processor Cores | ||
declare const processorCores: number; | ||
// Max Touch Points | ||
declare const maxTouchPoints: number; | ||
// Online Status | ||
declare const browserOnlineStatus: boolean; | ||
// PDF Support | ||
declare const PDFviewerStatus: boolean; | ||
// Robot Status | ||
declare const robotStatus: boolean; | ||
// OS | ||
declare const OS: string; |
@@ -9,2 +9,6 @@ /* | ||
import { browser, getBrowser } from "./browser"; | ||
// Build Number | ||
import { buildNumber, browserSpecificSupportBuildID } from "./buildNumber"; | ||
// Code Name | ||
import { codeName } from "./appCodeName"; | ||
// Cookies | ||
@@ -18,2 +22,4 @@ import { getCookies, cookieStatus } from "./cookies"; | ||
import { DEVICE_finiteType, finiteMobileDeviceType, } from "./finiteMobileDeviceType"; | ||
// Geolocation | ||
import { geo } from "./geolocation"; | ||
// Logical Processors | ||
@@ -23,2 +29,4 @@ import { browserSpecificSupportCores, processorCores, } from "./logicalProcessors"; | ||
import { maxTouchPoints, getMaxTouchPoints } from "./maxTouchPoints"; | ||
// Navigator Object | ||
import { navigatorObject } from './navigator'; | ||
// Online Status | ||
@@ -34,4 +42,8 @@ import { browserOnlineStatus } from "./online"; | ||
import { PDFviewerStatus } from "./pdf"; | ||
// Product | ||
import { engine } from './product'; | ||
// RAM | ||
import { getRam, browserSpecificSupportRAM, browserRam } from "./ram"; | ||
// Version | ||
import { version } from './appVersion'; | ||
// Webdriver | ||
@@ -41,4 +53,4 @@ import { robotStatus } from "./webdriver"; | ||
// Make the functions accessible | ||
export { DetectScreenOrientation, DetectDeviceType, finiteMobileDeviceType, getCurrentUA, getCookies, getDoNotTrack, getBrowser, getRam, browserSpecificSupportRAM, browserSpecificSupportCores, getMaxTouchPoints, getOS }; | ||
export { DetectScreenOrientation, DetectDeviceType, finiteMobileDeviceType, getCurrentUA, getCookies, getDoNotTrack, getBrowser, getRam, browserSpecificSupportRAM, browserSpecificSupportCores, getMaxTouchPoints, getOS, browserSpecificSupportBuildID }; | ||
// As well as the returns on those functions | ||
export { ORIENTATION_isLandscape, DEVICE_type, DEVICE_finiteType, currentUA, cookieStatus, doNotTrackStatus, browser, browserRam, processorCores, maxTouchPoints, browserOnlineStatus, PDFviewerStatus, robotStatus, OS }; | ||
export { ORIENTATION_isLandscape, DEVICE_type, DEVICE_finiteType, currentUA, cookieStatus, doNotTrackStatus, browser, browserRam, buildNumber, processorCores, maxTouchPoints, navigatorObject, browserOnlineStatus, PDFviewerStatus, robotStatus, OS, geo, codeName, engine, version }; |
@@ -17,3 +17,3 @@ import { browser } from "./browser"; | ||
if (browser === "IE") { | ||
return "Not Supported"; | ||
throw new Error("Not supported on this browser\(UAD_1301\)"); | ||
} | ||
@@ -27,3 +27,3 @@ if (browser === "Opera") { | ||
else { | ||
return "Not Supported"; | ||
throw new Error("Not supported on this browser\(UAD_1301\)"); | ||
} | ||
@@ -30,0 +30,0 @@ }; |
@@ -0,0 +0,0 @@ const getMaxTouchPoints = () => { |
@@ -0,0 +0,0 @@ let browserIsOnline = navigator.onLine; |
@@ -24,3 +24,3 @@ const getOS = ({ ua }) => { | ||
else { | ||
return 'unknown'; | ||
throw new Error("Unknown Operating System\(UAD_1101\)"); | ||
} | ||
@@ -27,0 +27,0 @@ }; |
@@ -9,9 +9,2 @@ /* | ||
let ORIENTATION_isLandscape = true; | ||
$(document).ready(() => { | ||
DetectScreenOrientation(); | ||
}); | ||
$(window).on("orientationchange", (_event) => { | ||
//When screen orientation changes | ||
DetectScreenOrientation(); | ||
}); | ||
const DetectScreenOrientation = () => { | ||
@@ -22,3 +15,4 @@ //detects orientation of device | ||
}; | ||
window.addEventListener("resize", DetectScreenOrientation); | ||
// Exports | ||
export { DetectScreenOrientation, ORIENTATION_isLandscape }; |
@@ -0,0 +0,0 @@ let pdf = navigator.pdfViewerEnabled; |
@@ -11,9 +11,9 @@ import { browser } from "./browser"; | ||
if (browser == "Firefox") { | ||
return "RAM API not availible in Firefox"; | ||
throw new Error("RAM API not supported on Firefox\(UAD_301\)"); | ||
} | ||
if (browser == "Safari") { | ||
return "RAM API not availible in Safari"; | ||
throw new Error("RAM API not supported on Safari\(UAD_302\)"); | ||
} | ||
if (browser == "IE") { | ||
return "RAM API not availible in IE"; | ||
throw new Error("RAM API not supported on IE\(UAD_303\)"); | ||
} | ||
@@ -20,0 +20,0 @@ if (browser == "Opera") { |
@@ -0,0 +0,0 @@ let webdriverControlled = navigator.webdriver; |
@@ -0,0 +0,0 @@ # UADetect `browser` Componet |
@@ -0,0 +0,0 @@ # UADetect `browserOnlineStatus` Componet |
@@ -14,5 +14,5 @@ # UADetect Componets | ||
- [`codeName`](codeName.md) | ||
- [`browser`](browser.md) | ||
- [`browserOnlineStatus`](browserOnlineStatus.md) | ||
- [`browserRam`](browserRam.md) | ||
- [`cookieStatus`](cookieStatus.md) | ||
@@ -23,2 +23,3 @@ - [`currentUA`](currentUA.md) | ||
- [`doNotTrackStatus`](doNotTrackStatus.md) | ||
- [`engine`](engine.md) | ||
- [`maxTouchPoints`](maxTouchPoints.md) | ||
@@ -30,4 +31,5 @@ - [`ORIENTATION_isLandscape`](orientation.md) | ||
- [`robotStatus`](robotStatus.md) | ||
- [`version`](version.md) | ||
### NOTE: | ||
Click any of them to go to their individual documentation. |
@@ -0,0 +0,0 @@ # UADetect `cookieStatus` Componet |
@@ -0,0 +0,0 @@ # UADetect `currentUA` Componet |
@@ -0,0 +0,0 @@ # UADetect `DEVICE_finiteType` Componet |
@@ -0,0 +0,0 @@ # UADetect `DEVICE_type` Componet |
@@ -0,0 +0,0 @@ # UADetect `doNotTrackStatus` Componet |
@@ -10,2 +10,3 @@ # UADetect Documentation | ||
- [LET's GO!](#lets-go) | ||
- [OR Skip to Error Codes](#or-skip-to-error-codes) | ||
@@ -41,1 +42,5 @@ ## WELCOME! | ||
<button>[GO!](setup.md)</button> | ||
### OR Skip to Error Codes | ||
[ERROR CODES](error-codes.md) |
@@ -0,0 +0,0 @@ # UADetect `maxTouchPoints` Componet |
@@ -0,0 +0,0 @@ # UADetect `ORIENTATION_isLandscape` Componet |
@@ -0,0 +0,0 @@ # UADetect `OS` Componet |
@@ -0,0 +0,0 @@ # UADetect `PDFviewerStatus` Componet |
@@ -0,0 +0,0 @@ # UADetect `processorCores` Componet |
@@ -0,0 +0,0 @@ # UADetect `robotStatus` Componet |
@@ -0,0 +0,0 @@ # SETUP |
{ | ||
"files": [ | ||
"./index.js" | ||
"./dist/**/*.js", | ||
] | ||
} |
{ | ||
"name": "uadetect", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "The dead-simple way of interacting with the navigator API", | ||
"main": "./dist/index.js", | ||
"scripts": { | ||
"test": "npx serve", | ||
"test": "jest", | ||
"build": "npx tsc -p tsconfig.json" | ||
@@ -48,10 +48,13 @@ }, | ||
"dependencies": { | ||
"jquery": "^3.6.0", | ||
"jest-environment-jsdom": "^28.1.0", | ||
"serve": "^13.0.2", | ||
"typescript": "^4.6.3", | ||
"uadetect": "^2.0.0" | ||
"typescript": "^4.7.2" | ||
}, | ||
"devDependencies": { | ||
"@types/jquery": "^3.5.14" | ||
"@types/jest": "^27.5.1", | ||
"@types/jquery": "^3.5.14", | ||
"@types/node": "^17.0.35", | ||
"jquery": "^3.6.0", | ||
"jest": "^28.1.0" | ||
} | ||
} |
@@ -0,0 +0,0 @@ # UADetect |
@@ -28,3 +28,3 @@ let ua = navigator.userAgent; | ||
else { | ||
return 'unknown'; | ||
throw new Error("ERR: Browser can not be determined \(UAD_101\)"); | ||
} | ||
@@ -31,0 +31,0 @@ }; |
let cookies: boolean = navigator.cookieEnabled | ||
const getCookies = (cookies: boolean): "COOKIES_enabled" | "COOKIES_notEnabled" | "ERROR" => { | ||
if (cookies == true) { | ||
if (cookies === true) { | ||
return "COOKIES_enabled" | ||
}; | ||
if (cookies == false) { | ||
if (cookies === false) { | ||
return "COOKIES_notEnabled" | ||
} | ||
else { | ||
return "ERROR" | ||
throw new Error("ERR: Cookie status can not be determined \(UAD_201\)"); | ||
} | ||
@@ -13,0 +14,0 @@ } |
@@ -0,0 +0,0 @@ //DEVICE TYPE |
@@ -17,3 +17,4 @@ let browserDoNotTrack = navigator.doNotTrack | ||
else { | ||
return "ERROR" | ||
throw new Error("Unknown doNotTrack value\(UAD_801\)"); | ||
} | ||
@@ -20,0 +21,0 @@ } |
// Finite Device Type | ||
export default function finiteMobileDeviceType(): "iOS" | "Android" | "BlackBerry" | "Windows Phone" | "webOS" | "unknown" { | ||
export default function finiteMobileDeviceType(): "iOS" | "Android" | "BlackBerry" | "Windows Phone" | "webOS" | Error { | ||
const ua = navigator.userAgent; | ||
@@ -25,4 +25,3 @@ if (/(iPhone|iPod|iPad)/i.test(ua)) { | ||
else { | ||
console.log("ERR: Unknown Device"); | ||
return "unknown"; | ||
throw new Error("Unknown device type\(UAD_601\)"); | ||
} | ||
@@ -29,0 +28,0 @@ } |
@@ -0,0 +0,0 @@ let getCurrentUA = (): string => { |
@@ -12,2 +12,6 @@ /* | ||
// Code Name | ||
import { codeName } from "./appCodeName"; | ||
// Cookies | ||
@@ -32,2 +36,8 @@ | ||
// Geolocation | ||
import { | ||
geo | ||
} from "./geolocation"; | ||
// Logical Processors | ||
@@ -44,2 +54,6 @@ | ||
// Navigator Object | ||
import { navigatorObject } from './navigator'; | ||
// Online Status | ||
@@ -66,8 +80,12 @@ | ||
import { PDFviewerStatus } from "./pdf"; | ||
import { PDFviewerStatus } from "./pdf"; | ||
// RAM | ||
// Product | ||
import { getRam, browserSpecificSupportRAM, browserRam } from "./ram"; | ||
import {engine} from './product'; | ||
// Version | ||
import {version} from './appVersion' | ||
// Webdriver | ||
@@ -89,7 +107,5 @@ | ||
getBrowser, | ||
getRam, | ||
browserSpecificSupportRAM, | ||
browserSpecificSupportCores, | ||
getMaxTouchPoints, | ||
getOS | ||
getOS, | ||
}; | ||
@@ -107,9 +123,13 @@ | ||
browser, | ||
browserRam, | ||
processorCores, | ||
maxTouchPoints, | ||
navigatorObject, | ||
browserOnlineStatus, | ||
PDFviewerStatus, | ||
robotStatus, | ||
OS | ||
OS, | ||
geo, | ||
codeName, | ||
engine, | ||
version | ||
}; |
@@ -18,3 +18,3 @@ import { browser } from "./browser"; | ||
if (browser === "IE") { | ||
return "Not Supported"; | ||
throw new Error("Not supported on this browser\(UAD_1301\)"); | ||
} | ||
@@ -28,3 +28,4 @@ if (browser === "Opera") { | ||
else { | ||
return "Not Supported"; | ||
throw new Error("Not supported on this browser\(UAD_1301\)"); | ||
} | ||
@@ -31,0 +32,0 @@ |
@@ -0,0 +0,0 @@ const getMaxTouchPoints = () => { |
@@ -0,0 +0,0 @@ let browserIsOnline: boolean = navigator.onLine; |
@@ -24,3 +24,4 @@ const getOS = ({ ua }: { ua; }): "Windows" | "Mac" | "Linux" | "Android" | "iOS" | "unknown" => { | ||
else { | ||
return 'unknown'; | ||
throw new Error("Unknown Operating System\(UAD_1101\)"); | ||
} | ||
@@ -27,0 +28,0 @@ } |
@@ -10,10 +10,4 @@ /* | ||
let ORIENTATION_isLandscape: boolean = true; | ||
$(document).ready((): void => { | ||
DetectScreenOrientation(); | ||
}); | ||
$(window).on("orientationchange", (_event): void => { | ||
//When screen orientation changes | ||
DetectScreenOrientation(); | ||
}); | ||
const DetectScreenOrientation = () => { | ||
const DetectScreenOrientation = (): boolean => { | ||
//detects orientation of device | ||
@@ -24,4 +18,7 @@ ORIENTATION_isLandscape = window.innerHeight <= window.innerWidth; | ||
window.addEventListener("resize", DetectScreenOrientation); | ||
// Exports | ||
export { DetectScreenOrientation, ORIENTATION_isLandscape }; |
@@ -0,0 +0,0 @@ let pdf: boolean = navigator.pdfViewerEnabled; |
@@ -14,2 +14,2 @@ let webdriverControlled: boolean = navigator.webdriver | ||
export { robotStatus }; | ||
export { robotStatus, webdriverControlled }; |
@@ -1,1 +0,3 @@ | ||
console.log("NO test specified"); | ||
test("Make sure all imports are called", () => { | ||
expect(true).toBe(true); | ||
}); |
{ | ||
"compilerOptions": { | ||
"target": "es2019", | ||
"outDir": "./dist/" | ||
"outDir": "./dist/", | ||
"moduleResolution": "node", | ||
"pretty": true, | ||
}, | ||
@@ -6,0 +9,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1678518
3
98
1180
5
+ Added@babel/code-frame@7.24.6(transitive)
+ Added@babel/helper-validator-identifier@7.24.6(transitive)
+ Added@babel/highlight@7.24.6(transitive)
+ Added@jest/environment@28.1.3(transitive)
+ Added@jest/fake-timers@28.1.3(transitive)
+ Added@jest/schemas@28.1.3(transitive)
+ Added@jest/types@28.1.3(transitive)
+ Added@sinclair/typebox@0.24.51(transitive)
+ Added@sinonjs/commons@1.8.6(transitive)
+ Added@sinonjs/fake-timers@9.1.2(transitive)
+ Added@tootallnate/once@2.0.0(transitive)
+ Added@types/istanbul-lib-coverage@2.0.6(transitive)
+ Added@types/istanbul-lib-report@3.0.3(transitive)
+ Added@types/istanbul-reports@3.0.4(transitive)
+ Added@types/jsdom@16.2.15(transitive)
+ Added@types/node@20.12.13(transitive)
+ Added@types/parse5@6.0.3(transitive)
+ Added@types/stack-utils@2.0.3(transitive)
+ Added@types/tough-cookie@4.0.5(transitive)
+ Added@types/yargs@17.0.32(transitive)
+ Added@types/yargs-parser@21.0.3(transitive)
+ Addedabab@2.0.6(transitive)
+ Addedacorn@7.4.18.11.3(transitive)
+ Addedacorn-globals@6.0.0(transitive)
+ Addedacorn-walk@7.2.0(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedansi-styles@5.2.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedbrowser-process-hrtime@1.0.0(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedci-info@3.9.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcssom@0.3.80.5.0(transitive)
+ Addedcssstyle@2.3.0(transitive)
+ Addeddata-urls@3.0.2(transitive)
+ Addeddebug@4.3.4(transitive)
+ Addeddecimal.js@10.4.3(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddomexception@4.0.0(transitive)
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedescodegen@2.1.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedform-data@4.0.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhtml-encoding-sniffer@3.0.0(transitive)
+ Addedhttp-proxy-agent@5.0.0(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-potential-custom-element-name@1.0.1(transitive)
+ Addedjest-environment-jsdom@28.1.3(transitive)
+ Addedjest-message-util@28.1.3(transitive)
+ Addedjest-mock@28.1.3(transitive)
+ Addedjest-util@28.1.3(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjsdom@19.0.0(transitive)
+ Addedmicromatch@4.0.7(transitive)
+ Addedms@2.1.2(transitive)
+ Addednwsapi@2.2.10(transitive)
+ Addedparse5@6.0.1(transitive)
+ Addedpicocolors@1.0.1(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpretty-format@28.1.3(transitive)
+ Addedpsl@1.9.0(transitive)
+ Addedquerystringify@2.2.0(transitive)
+ Addedreact-is@18.3.1(transitive)
+ Addedrequires-port@1.0.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsaxes@5.0.1(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstack-utils@2.0.6(transitive)
+ Addedsymbol-tree@3.2.4(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtough-cookie@4.1.4(transitive)
+ Addedtr46@3.0.0(transitive)
+ Addedtype-detect@4.0.8(transitive)
+ Addedundici-types@5.26.5(transitive)
+ Addeduniversalify@0.2.0(transitive)
+ Addedurl-parse@1.5.10(transitive)
+ Addedw3c-hr-time@1.0.2(transitive)
+ Addedw3c-xmlserializer@3.0.0(transitive)
+ Addedwebidl-conversions@7.0.0(transitive)
+ Addedwhatwg-encoding@2.0.0(transitive)
+ Addedwhatwg-mimetype@3.0.0(transitive)
+ Addedwhatwg-url@10.0.011.0.0(transitive)
+ Addedws@8.17.0(transitive)
+ Addedxml-name-validator@4.0.0(transitive)
+ Addedxmlchars@2.2.0(transitive)
- Removedjquery@^3.6.0
- Removeduadetect@^2.0.0
- Removedjquery@3.7.1(transitive)
Updatedtypescript@^4.7.2