Revision | 64 (tree) |
---|---|
Time | 2021-11-21 12:08:00 |
Author | hemaxvi_soft |
(empty log message)
@@ -9,7 +9,7 @@ | ||
9 | 9 | public class Utilidades |
10 | 10 | { |
11 | 11 | |
12 | - public string version = "v1.0.8"; | |
12 | + public string version = "v1.0.9"; | |
13 | 13 | |
14 | 14 | |
15 | 15 | public void Notificaion(string titulo, string texto, string icono, Page page) |
@@ -0,0 +1,1038 @@ | ||
1 | +/*! | |
2 | + * device-uuid.js v1.0.4 (https://github.com/biggora/device-uuid/) | |
3 | + * Copyright 2016-2017 Alexey Gordeyev | |
4 | + * Licensed under MIT (https://github.com/biggora/device-uuid/blob/master/LICENSE) | |
5 | + */ | |
6 | +/*global | |
7 | + screen, window, navigator | |
8 | + */ | |
9 | +(function (exports) { | |
10 | + 'use strict'; | |
11 | + | |
12 | + var BOTS = [ | |
13 | + '\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/', | |
14 | + 'googlebot', | |
15 | + 'baiduspider', | |
16 | + 'gurujibot', | |
17 | + 'yandexbot', | |
18 | + 'slurp', | |
19 | + 'msnbot', | |
20 | + 'bingbot', | |
21 | + 'facebookexternalhit', | |
22 | + 'linkedinbot', | |
23 | + 'twitterbot', | |
24 | + 'slackbot', | |
25 | + 'telegrambot', | |
26 | + 'applebot', | |
27 | + 'pingdom', | |
28 | + 'tumblr ', | |
29 | + 'Embedly', | |
30 | + 'spbot' | |
31 | + ]; | |
32 | + var IS_BOT_REGEXP = new RegExp('^.*(' + BOTS.join('|') + ').*$'); | |
33 | + | |
34 | + var DeviceUUID = function (options) { | |
35 | + options = options ? options : {}; | |
36 | + var defOptions = { | |
37 | + version: false, | |
38 | + language: false, | |
39 | + platform: true, | |
40 | + os: true, | |
41 | + pixelDepth: true, | |
42 | + colorDepth: true, | |
43 | + resolution: false, | |
44 | + isAuthoritative: true, | |
45 | + silkAccelerated: true, | |
46 | + isKindleFire: true, | |
47 | + isDesktop: true, | |
48 | + isMobile: true, | |
49 | + isTablet: true, | |
50 | + isWindows: true, | |
51 | + isLinux: true, | |
52 | + isLinux64: true, | |
53 | + isChromeOS: true, | |
54 | + isMac: true, | |
55 | + isiPad: true, | |
56 | + isiPhone: true, | |
57 | + isiPod: true, | |
58 | + isAndroid: true, | |
59 | + isSamsung: true, | |
60 | + isSmartTV: true, | |
61 | + isRaspberry: true, | |
62 | + isBlackberry: true, | |
63 | + isTouchScreen: true, | |
64 | + isOpera: false, | |
65 | + isIE: false, | |
66 | + isEdge: false, | |
67 | + isIECompatibilityMode: false, | |
68 | + isSafari: false, | |
69 | + isFirefox: false, | |
70 | + isWebkit: false, | |
71 | + isChrome: false, | |
72 | + isKonqueror: false, | |
73 | + isOmniWeb: false, | |
74 | + isSeaMonkey: false, | |
75 | + isFlock: false, | |
76 | + isAmaya: false, | |
77 | + isPhantomJS: false, | |
78 | + isEpiphany: false, | |
79 | + source: false, | |
80 | + cpuCores: false | |
81 | + }; | |
82 | + for (var key in options) { | |
83 | + if (options.hasOwnProperty(key) && typeof defOptions[key] !== 'undefined') { | |
84 | + defOptions[key] = options[key]; | |
85 | + } | |
86 | + } | |
87 | + this.options = defOptions; | |
88 | + this.version = '1.0.0'; | |
89 | + this._Versions = { | |
90 | + Edge: /Edge\/([\d\w\.\-]+)/i, | |
91 | + Firefox: /firefox\/([\d\w\.\-]+)/i, | |
92 | + IE: /msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i, | |
93 | + Chrome: /chrome\/([\d\w\.\-]+)/i, | |
94 | + Chromium: /(?:chromium|crios)\/([\d\w\.\-]+)/i, | |
95 | + Safari: /version\/([\d\w\.\-]+)/i, | |
96 | + Opera: /version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i, | |
97 | + Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
98 | + Psp: /([\d\w\.\-]+)\)?\s*$/i, | |
99 | + Amaya: /amaya\/([\d\w\.\-]+)/i, | |
100 | + SeaMonkey: /seamonkey\/([\d\w\.\-]+)/i, | |
101 | + OmniWeb: /omniweb\/v([\d\w\.\-]+)/i, | |
102 | + Flock: /flock\/([\d\w\.\-]+)/i, | |
103 | + Epiphany: /epiphany\/([\d\w\.\-]+)/i, | |
104 | + WinJs: /msapphost\/([\d\w\.\-]+)/i, | |
105 | + PhantomJS: /phantomjs\/([\d\w\.\-]+)/i, | |
106 | + UC: /UCBrowser\/([\d\w\.]+)/i | |
107 | + }; | |
108 | + this._Browsers = { | |
109 | + Edge: /edge/i, | |
110 | + Amaya: /amaya/i, | |
111 | + Konqueror: /konqueror/i, | |
112 | + Epiphany: /epiphany/i, | |
113 | + SeaMonkey: /seamonkey/i, | |
114 | + Flock: /flock/i, | |
115 | + OmniWeb: /omniweb/i, | |
116 | + Chromium: /chromium|crios/i, | |
117 | + Chrome: /chrome/i, | |
118 | + Safari: /safari/i, | |
119 | + IE: /msie|trident/i, | |
120 | + Opera: /opera|OPR/i, | |
121 | + PS3: /playstation 3/i, | |
122 | + PSP: /playstation portable/i, | |
123 | + Firefox: /firefox/i, | |
124 | + WinJs: /msapphost/i, | |
125 | + PhantomJS: /phantomjs/i, | |
126 | + UC: /UCBrowser/i | |
127 | + }; | |
128 | + this._OS = { | |
129 | + Windows10: /windows nt 10\.0/i, | |
130 | + Windows81: /windows nt 6\.3/i, | |
131 | + Windows8: /windows nt 6\.2/i, | |
132 | + Windows7: /windows nt 6\.1/i, | |
133 | + UnknownWindows: /windows nt 6\.\d+/i, | |
134 | + WindowsVista: /windows nt 6\.0/i, | |
135 | + Windows2003: /windows nt 5\.2/i, | |
136 | + WindowsXP: /windows nt 5\.1/i, | |
137 | + Windows2000: /windows nt 5\.0/i, | |
138 | + WindowsPhone8: /windows phone 8\./, | |
139 | + OSXCheetah: /os x 10[._]0/i, | |
140 | + OSXPuma: /os x 10[._]1(\D|$)/i, | |
141 | + OSXJaguar: /os x 10[._]2/i, | |
142 | + OSXPanther: /os x 10[._]3/i, | |
143 | + OSXTiger: /os x 10[._]4/i, | |
144 | + OSXLeopard: /os x 10[._]5/i, | |
145 | + OSXSnowLeopard: /os x 10[._]6/i, | |
146 | + OSXLion: /os x 10[._]7/i, | |
147 | + OSXMountainLion: /os x 10[._]8/i, | |
148 | + OSXMavericks: /os x 10[._]9/i, | |
149 | + OSXYosemite: /os x 10[._]10/i, | |
150 | + OSXElCapitan: /os x 10[._]11/i, | |
151 | + OSXSierra: /os x 10[._]12/i, | |
152 | + Mac: /os x/i, | |
153 | + Linux: /linux/i, | |
154 | + Linux64: /linux x86_64/i, | |
155 | + ChromeOS: /cros/i, | |
156 | + Wii: /wii/i, | |
157 | + PS3: /playstation 3/i, | |
158 | + PSP: /playstation portable/i, | |
159 | + iPad: /\(iPad.*os (\d+)[._](\d+)/i, | |
160 | + iPhone: /\(iPhone.*os (\d+)[._](\d+)/i, | |
161 | + Bada: /Bada\/(\d+)\.(\d+)/i, | |
162 | + Curl: /curl\/(\d+)\.(\d+)\.(\d+)/i | |
163 | + }; | |
164 | + this._Platform = { | |
165 | + Windows: /windows nt/i, | |
166 | + WindowsPhone: /windows phone/i, | |
167 | + Mac: /macintosh/i, | |
168 | + Linux: /linux/i, | |
169 | + Wii: /wii/i, | |
170 | + Playstation: /playstation/i, | |
171 | + iPad: /ipad/i, | |
172 | + iPod: /ipod/i, | |
173 | + iPhone: /iphone/i, | |
174 | + Android: /android/i, | |
175 | + Blackberry: /blackberry/i, | |
176 | + Samsung: /samsung/i, | |
177 | + Curl: /curl/i | |
178 | + }; | |
179 | + | |
180 | + this.DefaultAgent = { | |
181 | + isAuthoritative: true, | |
182 | + isMobile: false, | |
183 | + isTablet: false, | |
184 | + isiPad: false, | |
185 | + isiPod: false, | |
186 | + isiPhone: false, | |
187 | + isAndroid: false, | |
188 | + isBlackberry: false, | |
189 | + isOpera: false, | |
190 | + isIE: false, | |
191 | + isEdge: false, | |
192 | + isIECompatibilityMode: false, | |
193 | + isSafari: false, | |
194 | + isFirefox: false, | |
195 | + isWebkit: false, | |
196 | + isChrome: false, | |
197 | + isKonqueror: false, | |
198 | + isOmniWeb: false, | |
199 | + isSeaMonkey: false, | |
200 | + isFlock: false, | |
201 | + isAmaya: false, | |
202 | + isPhantomJS: false, | |
203 | + isEpiphany: false, | |
204 | + isDesktop: false, | |
205 | + isWindows: false, | |
206 | + isLinux: false, | |
207 | + isLinux64: false, | |
208 | + isMac: false, | |
209 | + isChromeOS: false, | |
210 | + isBada: false, | |
211 | + isSamsung: false, | |
212 | + isRaspberry: false, | |
213 | + isBot: false, | |
214 | + isCurl: false, | |
215 | + isAndroidTablet: false, | |
216 | + isWinJs: false, | |
217 | + isKindleFire: false, | |
218 | + isSilk: false, | |
219 | + isCaptive: false, | |
220 | + isSmartTV: false, | |
221 | + isUC: false, | |
222 | + isTouchScreen: false, | |
223 | + silkAccelerated: false, | |
224 | + colorDepth: -1, | |
225 | + pixelDepth: -1, | |
226 | + resolution: [], | |
227 | + cpuCores: -1, | |
228 | + language: 'unknown', | |
229 | + browser: 'unknown', | |
230 | + version: 'unknown', | |
231 | + os: 'unknown', | |
232 | + platform: 'unknown', | |
233 | + geoIp: {}, | |
234 | + source: '', | |
235 | + hashInt: function (string) { | |
236 | + var hash = 0, i, chr, len; | |
237 | + if (string.length === 0) { return hash; } | |
238 | + for (i = 0, len = string.length; i < len; i++) { | |
239 | + chr = string.charCodeAt(i); | |
240 | + hash = ((hash << 5) - hash) + chr; | |
241 | + hash |= 0; | |
242 | + } | |
243 | + return hash; | |
244 | + }, | |
245 | + hashMD5: function (string) { | |
246 | + function rotateLeft(lValue, iShiftBits) { | |
247 | + return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); | |
248 | + } | |
249 | + | |
250 | + function addUnsigned(lX, lY) { | |
251 | + var lX4, lY4, lX8, lY8, lResult; | |
252 | + lX8 = (lX & 0x80000000); | |
253 | + lY8 = (lY & 0x80000000); | |
254 | + lX4 = (lX & 0x40000000); | |
255 | + lY4 = (lY & 0x40000000); | |
256 | + lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); | |
257 | + | |
258 | + if (lX4 & lY4) { | |
259 | + return (lResult ^ 0x80000000 ^ lX8 ^ lY8); | |
260 | + } | |
261 | + if (lX4 | lY4) { | |
262 | + if (lResult & 0x40000000) { | |
263 | + return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); | |
264 | + } else { | |
265 | + return (lResult ^ 0x40000000 ^ lX8 ^ lY8); | |
266 | + } | |
267 | + } else { | |
268 | + return (lResult ^ lX8 ^ lY8); | |
269 | + } | |
270 | + } | |
271 | + | |
272 | + function gF(x, y, z) { | |
273 | + return (x & y) | ((~x) & z); | |
274 | + } | |
275 | + | |
276 | + function gG(x, y, z) { | |
277 | + return (x & z) | (y & (~z)); | |
278 | + } | |
279 | + | |
280 | + function gH(x, y, z) { | |
281 | + return (x ^ y ^ z); | |
282 | + } | |
283 | + | |
284 | + function gI(x, y, z) { | |
285 | + return (y ^ (x | (~z))); | |
286 | + } | |
287 | + | |
288 | + function gFF(a, b, c, d, x, s, ac) { | |
289 | + a = addUnsigned(a, addUnsigned(addUnsigned(gF(b, c, d), x), ac)); | |
290 | + return addUnsigned(rotateLeft(a, s), b); | |
291 | + } | |
292 | + | |
293 | + function gGG(a, b, c, d, x, s, ac) { | |
294 | + a = addUnsigned(a, addUnsigned(addUnsigned(gG(b, c, d), x), ac)); | |
295 | + return addUnsigned(rotateLeft(a, s), b); | |
296 | + } | |
297 | + | |
298 | + function gHH(a, b, c, d, x, s, ac) { | |
299 | + a = addUnsigned(a, addUnsigned(addUnsigned(gH(b, c, d), x), ac)); | |
300 | + return addUnsigned(rotateLeft(a, s), b); | |
301 | + } | |
302 | + | |
303 | + function gII(a, b, c, d, x, s, ac) { | |
304 | + a = addUnsigned(a, addUnsigned(addUnsigned(gI(b, c, d), x), ac)); | |
305 | + return addUnsigned(rotateLeft(a, s), b); | |
306 | + } | |
307 | + | |
308 | + function convertToWordArray(string) { | |
309 | + var lWordCount; | |
310 | + var lMessageLength = string.length; | |
311 | + var lNumberOfWordsTemp1 = lMessageLength + 8; | |
312 | + var lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64; | |
313 | + var lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16; | |
314 | + var lWordArray = new Array(lNumberOfWords - 1); | |
315 | + var lBytePosition = 0; | |
316 | + var lByteCount = 0; | |
317 | + | |
318 | + while (lByteCount < lMessageLength) { | |
319 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
320 | + lBytePosition = (lByteCount % 4) * 8; | |
321 | + lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); | |
322 | + lByteCount++; | |
323 | + } | |
324 | + | |
325 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
326 | + lBytePosition = (lByteCount % 4) * 8; | |
327 | + lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); | |
328 | + lWordArray[lNumberOfWords - 2] = lMessageLength << 3; | |
329 | + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; | |
330 | + return lWordArray; | |
331 | + } | |
332 | + | |
333 | + function wordToHex(lValue) { | |
334 | + var wordToHexValue = '', wordToHexValueTemp = '', lByte, lCount; | |
335 | + for (lCount = 0; lCount <= 3; lCount++) { | |
336 | + lByte = (lValue >>> (lCount * 8)) & 255; | |
337 | + wordToHexValueTemp = '0' + lByte.toString(16); | |
338 | + wordToHexValue = wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2); | |
339 | + } | |
340 | + return wordToHexValue; | |
341 | + } | |
342 | + | |
343 | + function utf8Encode(string) { | |
344 | + string = string.replace(/\r\n/g, '\n'); | |
345 | + var utftext = ''; | |
346 | + | |
347 | + for (var n = 0; n < string.length; n++) { | |
348 | + var c = string.charCodeAt(n); | |
349 | + if (c < 128) { | |
350 | + utftext += String.fromCharCode(c); | |
351 | + } else if ((c > 127) && (c < 2048)) { | |
352 | + utftext += String.fromCharCode((c >> 6) | 192); | |
353 | + utftext += String.fromCharCode((c & 63) | 128); | |
354 | + } else { | |
355 | + utftext += String.fromCharCode((c >> 12) | 224); | |
356 | + utftext += String.fromCharCode(((c >> 6) & 63) | 128); | |
357 | + utftext += String.fromCharCode((c & 63) | 128); | |
358 | + } | |
359 | + } | |
360 | + return utftext; | |
361 | + } | |
362 | + | |
363 | + var x = []; | |
364 | + var k, AA, BB, CC, DD, a, b, c, d; | |
365 | + var S11 = 7, S12 = 12, S13 = 17, S14 = 22; | |
366 | + var S21 = 5, S22 = 9, S23 = 14, S24 = 20; | |
367 | + var S31 = 4, S32 = 11, S33 = 16, S34 = 23; | |
368 | + var S41 = 6, S42 = 10, S43 = 15, S44 = 21; | |
369 | + string = utf8Encode(string); | |
370 | + x = convertToWordArray(string); | |
371 | + a = 0x67452301; | |
372 | + b = 0xEFCDAB89; | |
373 | + c = 0x98BADCFE; | |
374 | + d = 0x10325476; | |
375 | + | |
376 | + for (k = 0; k < x.length; k += 16) { | |
377 | + AA = a; | |
378 | + BB = b; | |
379 | + CC = c; | |
380 | + DD = d; | |
381 | + a = gFF(a, b, c, d, x[k + 0], S11, 0xD76AA478); | |
382 | + d = gFF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); | |
383 | + c = gFF(c, d, a, b, x[k + 2], S13, 0x242070DB); | |
384 | + b = gFF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); | |
385 | + a = gFF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); | |
386 | + d = gFF(d, a, b, c, x[k + 5], S12, 0x4787C62A); | |
387 | + c = gFF(c, d, a, b, x[k + 6], S13, 0xA8304613); | |
388 | + b = gFF(b, c, d, a, x[k + 7], S14, 0xFD469501); | |
389 | + a = gFF(a, b, c, d, x[k + 8], S11, 0x698098D8); | |
390 | + d = gFF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); | |
391 | + c = gFF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); | |
392 | + b = gFF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); | |
393 | + a = gFF(a, b, c, d, x[k + 12], S11, 0x6B901122); | |
394 | + d = gFF(d, a, b, c, x[k + 13], S12, 0xFD987193); | |
395 | + c = gFF(c, d, a, b, x[k + 14], S13, 0xA679438E); | |
396 | + b = gFF(b, c, d, a, x[k + 15], S14, 0x49B40821); | |
397 | + a = gGG(a, b, c, d, x[k + 1], S21, 0xF61E2562); | |
398 | + d = gGG(d, a, b, c, x[k + 6], S22, 0xC040B340); | |
399 | + c = gGG(c, d, a, b, x[k + 11], S23, 0x265E5A51); | |
400 | + b = gGG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); | |
401 | + a = gGG(a, b, c, d, x[k + 5], S21, 0xD62F105D); | |
402 | + d = gGG(d, a, b, c, x[k + 10], S22, 0x2441453); | |
403 | + c = gGG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); | |
404 | + b = gGG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); | |
405 | + a = gGG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); | |
406 | + d = gGG(d, a, b, c, x[k + 14], S22, 0xC33707D6); | |
407 | + c = gGG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); | |
408 | + b = gGG(b, c, d, a, x[k + 8], S24, 0x455A14ED); | |
409 | + a = gGG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); | |
410 | + d = gGG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); | |
411 | + c = gGG(c, d, a, b, x[k + 7], S23, 0x676F02D9); | |
412 | + b = gGG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); | |
413 | + a = gHH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); | |
414 | + d = gHH(d, a, b, c, x[k + 8], S32, 0x8771F681); | |
415 | + c = gHH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); | |
416 | + b = gHH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); | |
417 | + a = gHH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); | |
418 | + d = gHH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); | |
419 | + c = gHH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); | |
420 | + b = gHH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); | |
421 | + a = gHH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); | |
422 | + d = gHH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); | |
423 | + c = gHH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); | |
424 | + b = gHH(b, c, d, a, x[k + 6], S34, 0x4881D05); | |
425 | + a = gHH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); | |
426 | + d = gHH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); | |
427 | + c = gHH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); | |
428 | + b = gHH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); | |
429 | + a = gII(a, b, c, d, x[k + 0], S41, 0xF4292244); | |
430 | + d = gII(d, a, b, c, x[k + 7], S42, 0x432AFF97); | |
431 | + c = gII(c, d, a, b, x[k + 14], S43, 0xAB9423A7); | |
432 | + b = gII(b, c, d, a, x[k + 5], S44, 0xFC93A039); | |
433 | + a = gII(a, b, c, d, x[k + 12], S41, 0x655B59C3); | |
434 | + d = gII(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); | |
435 | + c = gII(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); | |
436 | + b = gII(b, c, d, a, x[k + 1], S44, 0x85845DD1); | |
437 | + a = gII(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); | |
438 | + d = gII(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); | |
439 | + c = gII(c, d, a, b, x[k + 6], S43, 0xA3014314); | |
440 | + b = gII(b, c, d, a, x[k + 13], S44, 0x4E0811A1); | |
441 | + a = gII(a, b, c, d, x[k + 4], S41, 0xF7537E82); | |
442 | + d = gII(d, a, b, c, x[k + 11], S42, 0xBD3AF235); | |
443 | + c = gII(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); | |
444 | + b = gII(b, c, d, a, x[k + 9], S44, 0xEB86D391); | |
445 | + a = addUnsigned(a, AA); | |
446 | + b = addUnsigned(b, BB); | |
447 | + c = addUnsigned(c, CC); | |
448 | + d = addUnsigned(d, DD); | |
449 | + } | |
450 | + var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); | |
451 | + return temp.toLowerCase(); | |
452 | + } | |
453 | + }; | |
454 | + | |
455 | + this.Agent = {}; | |
456 | + | |
457 | + this.getBrowser = function (string) { | |
458 | + switch (true) { | |
459 | + case this._Browsers.Edge.test(string): | |
460 | + this.Agent.isEdge = true; | |
461 | + return 'Edge'; | |
462 | + case this._Browsers.PhantomJS.test(string): | |
463 | + this.Agent.isPhantomJS = true; | |
464 | + return 'PhantomJS'; | |
465 | + case this._Browsers.Konqueror.test(string): | |
466 | + this.Agent.isKonqueror = true; | |
467 | + return 'Konqueror'; | |
468 | + case this._Browsers.Amaya.test(string): | |
469 | + this.Agent.isAmaya = true; | |
470 | + return 'Amaya'; | |
471 | + case this._Browsers.Epiphany.test(string): | |
472 | + this.Agent.isEpiphany = true; | |
473 | + return 'Epiphany'; | |
474 | + case this._Browsers.SeaMonkey.test(string): | |
475 | + this.Agent.isSeaMonkey = true; | |
476 | + return 'SeaMonkey'; | |
477 | + case this._Browsers.Flock.test(string): | |
478 | + this.Agent.isFlock = true; | |
479 | + return 'Flock'; | |
480 | + case this._Browsers.OmniWeb.test(string): | |
481 | + this.Agent.isOmniWeb = true; | |
482 | + return 'OmniWeb'; | |
483 | + case this._Browsers.Opera.test(string): | |
484 | + this.Agent.isOpera = true; | |
485 | + return 'Opera'; | |
486 | + case this._Browsers.Chromium.test(string): | |
487 | + this.Agent.isChrome = true; | |
488 | + return 'Chromium'; | |
489 | + case this._Browsers.Chrome.test(string): | |
490 | + this.Agent.isChrome = true; | |
491 | + return 'Chrome'; | |
492 | + case this._Browsers.Safari.test(string): | |
493 | + this.Agent.isSafari = true; | |
494 | + return 'Safari'; | |
495 | + case this._Browsers.WinJs.test(string): | |
496 | + this.Agent.isWinJs = true; | |
497 | + return 'WinJs'; | |
498 | + case this._Browsers.IE.test(string): | |
499 | + this.Agent.isIE = true; | |
500 | + return 'IE'; | |
501 | + case this._Browsers.PS3.test(string): | |
502 | + return 'ps3'; | |
503 | + case this._Browsers.PSP.test(string): | |
504 | + return 'psp'; | |
505 | + case this._Browsers.Firefox.test(string): | |
506 | + this.Agent.isFirefox = true; | |
507 | + return 'Firefox'; | |
508 | + case this._Browsers.UC.test(string): | |
509 | + this.Agent.isUC = true; | |
510 | + return 'UCBrowser'; | |
511 | + default: | |
512 | + // If the UA does not start with Mozilla guess the user agent. | |
513 | + if (string.indexOf('Mozilla') !== 0 && /^([\d\w\-\.]+)\/[\d\w\.\-]+/i.test(string)) { | |
514 | + this.Agent.isAuthoritative = false; | |
515 | + return RegExp.$1; | |
516 | + } | |
517 | + return 'unknown'; | |
518 | + } | |
519 | + }; | |
520 | + | |
521 | + this.getBrowserVersion = function (string) { | |
522 | + var regex; | |
523 | + switch (this.Agent.browser) { | |
524 | + case 'Edge': | |
525 | + if (this._Versions.Edge.test(string)) { | |
526 | + return RegExp.$1; | |
527 | + } | |
528 | + break; | |
529 | + case 'PhantomJS': | |
530 | + if (this._Versions.PhantomJS.test(string)) { | |
531 | + return RegExp.$1; | |
532 | + } | |
533 | + break; | |
534 | + case 'Chrome': | |
535 | + if (this._Versions.Chrome.test(string)) { | |
536 | + return RegExp.$1; | |
537 | + } | |
538 | + break; | |
539 | + case 'Chromium': | |
540 | + if (this._Versions.Chromium.test(string)) { | |
541 | + return RegExp.$1; | |
542 | + } | |
543 | + break; | |
544 | + case 'Safari': | |
545 | + if (this._Versions.Safari.test(string)) { | |
546 | + return RegExp.$1; | |
547 | + } | |
548 | + break; | |
549 | + case 'Opera': | |
550 | + if (this._Versions.Opera.test(string)) { | |
551 | + return RegExp.$1 ? RegExp.$1 : RegExp.$2; | |
552 | + } | |
553 | + break; | |
554 | + case 'Firefox': | |
555 | + if (this._Versions.Firefox.test(string)) { | |
556 | + return RegExp.$1; | |
557 | + } | |
558 | + break; | |
559 | + case 'WinJs': | |
560 | + if (this._Versions.WinJs.test(string)) { | |
561 | + return RegExp.$1; | |
562 | + } | |
563 | + break; | |
564 | + case 'IE': | |
565 | + if (this._Versions.IE.test(string)) { | |
566 | + return RegExp.$2 ? RegExp.$2 : RegExp.$1; | |
567 | + } | |
568 | + break; | |
569 | + case 'ps3': | |
570 | + if (this._Versions.Ps3.test(string)) { | |
571 | + return RegExp.$1; | |
572 | + } | |
573 | + break; | |
574 | + case 'psp': | |
575 | + if (this._Versions.Psp.test(string)) { | |
576 | + return RegExp.$1; | |
577 | + } | |
578 | + break; | |
579 | + case 'Amaya': | |
580 | + if (this._Versions.Amaya.test(string)) { | |
581 | + return RegExp.$1; | |
582 | + } | |
583 | + break; | |
584 | + case 'Epiphany': | |
585 | + if (this._Versions.Epiphany.test(string)) { | |
586 | + return RegExp.$1; | |
587 | + } | |
588 | + break; | |
589 | + case 'SeaMonkey': | |
590 | + if (this._Versions.SeaMonkey.test(string)) { | |
591 | + return RegExp.$1; | |
592 | + } | |
593 | + break; | |
594 | + case 'Flock': | |
595 | + if (this._Versions.Flock.test(string)) { | |
596 | + return RegExp.$1; | |
597 | + } | |
598 | + break; | |
599 | + case 'OmniWeb': | |
600 | + if (this._Versions.OmniWeb.test(string)) { | |
601 | + return RegExp.$1; | |
602 | + } | |
603 | + break; | |
604 | + case 'UCBrowser': | |
605 | + if (this._Versions.UC.test(string)) { | |
606 | + return RegExp.$1; | |
607 | + } | |
608 | + break; | |
609 | + default: | |
610 | + if (this.Agent.browser !== 'unknown') { | |
611 | + regex = new RegExp(this.Agent.browser + '[\\/ ]([\\d\\w\\.\\-]+)', 'i'); | |
612 | + if (regex.test(string)) { | |
613 | + return RegExp.$1; | |
614 | + } | |
615 | + } | |
616 | + } | |
617 | + }; | |
618 | + | |
619 | + this.getOS = function (string) { | |
620 | + switch (true) { | |
621 | + case this._OS.WindowsVista.test(string): | |
622 | + this.Agent.isWindows = true; | |
623 | + return 'Windows Vista'; | |
624 | + case this._OS.Windows7.test(string): | |
625 | + this.Agent.isWindows = true; | |
626 | + return 'Windows 7'; | |
627 | + case this._OS.Windows8.test(string): | |
628 | + this.Agent.isWindows = true; | |
629 | + return 'Windows 8'; | |
630 | + case this._OS.Windows81.test(string): | |
631 | + this.Agent.isWindows = true; | |
632 | + return 'Windows 8.1'; | |
633 | + case this._OS.Windows10.test(string): | |
634 | + this.Agent.isWindows = true; | |
635 | + return 'Windows 10.0'; | |
636 | + case this._OS.Windows2003.test(string): | |
637 | + this.Agent.isWindows = true; | |
638 | + return 'Windows 2003'; | |
639 | + case this._OS.WindowsXP.test(string): | |
640 | + this.Agent.isWindows = true; | |
641 | + return 'Windows XP'; | |
642 | + case this._OS.Windows2000.test(string): | |
643 | + this.Agent.isWindows = true; | |
644 | + return 'Windows 2000'; | |
645 | + case this._OS.WindowsPhone8.test(string): | |
646 | + return 'Windows Phone 8'; | |
647 | + case this._OS.Linux64.test(string): | |
648 | + this.Agent.isLinux = true; | |
649 | + this.Agent.isLinux64 = true; | |
650 | + return 'Linux 64'; | |
651 | + case this._OS.Linux.test(string): | |
652 | + this.Agent.isLinux = true; | |
653 | + return 'Linux'; | |
654 | + case this._OS.ChromeOS.test(string): | |
655 | + this.Agent.isChromeOS = true; | |
656 | + return 'Chrome OS'; | |
657 | + case this._OS.Wii.test(string): | |
658 | + return 'Wii'; | |
659 | + case this._OS.PS3.test(string): | |
660 | + return 'Playstation'; | |
661 | + case this._OS.PSP.test(string): | |
662 | + return 'Playstation'; | |
663 | + case this._OS.OSXCheetah.test(string): | |
664 | + this.Agent.isMac = true; | |
665 | + return 'OS X Cheetah'; | |
666 | + case this._OS.OSXPuma.test(string): | |
667 | + this.Agent.isMac = true; | |
668 | + return 'OS X Puma'; | |
669 | + case this._OS.OSXJaguar.test(string): | |
670 | + this.Agent.isMac = true; | |
671 | + return 'OS X Jaguar'; | |
672 | + case this._OS.OSXPanther.test(string): | |
673 | + this.Agent.isMac = true; | |
674 | + return 'OS X Panther'; | |
675 | + case this._OS.OSXTiger.test(string): | |
676 | + this.Agent.isMac = true; | |
677 | + return 'OS X Tiger'; | |
678 | + case this._OS.OSXLeopard.test(string): | |
679 | + this.Agent.isMac = true; | |
680 | + return 'OS X Leopard'; | |
681 | + case this._OS.OSXSnowLeopard.test(string): | |
682 | + this.Agent.isMac = true; | |
683 | + return 'OS X Snow Leopard'; | |
684 | + case this._OS.OSXLion.test(string): | |
685 | + this.Agent.isMac = true; | |
686 | + return 'OS X Lion'; | |
687 | + case this._OS.OSXMountainLion.test(string): | |
688 | + this.Agent.isMac = true; | |
689 | + return 'OS X Mountain Lion'; | |
690 | + case this._OS.OSXMavericks.test(string): | |
691 | + this.Agent.isMac = true; | |
692 | + return 'OS X Mavericks'; | |
693 | + case this._OS.OSXYosemite.test(string): | |
694 | + this.Agent.isMac = true; | |
695 | + return 'OS X Yosemite'; | |
696 | + case this._OS.OSXElCapitan.test(string): | |
697 | + this.Agent.isMac = true; | |
698 | + return 'OS X El Capitan'; | |
699 | + case this._OS.OSXSierra.test(string): | |
700 | + this.Agent.isMac = true; | |
701 | + return 'macOS Sierra'; | |
702 | + case this._OS.Mac.test(string): | |
703 | + this.Agent.isMac = true; | |
704 | + return 'OS X'; | |
705 | + case this._OS.iPad.test(string): | |
706 | + this.Agent.isiPad = true; | |
707 | + return string.match(this._OS.iPad)[0].replace('_', '.'); | |
708 | + case this._OS.iPhone.test(string): | |
709 | + this.Agent.isiPhone = true; | |
710 | + return string.match(this._OS.iPhone)[0].replace('_', '.'); | |
711 | + case this._OS.Bada.test(string): | |
712 | + this.Agent.isBada = true; | |
713 | + return 'Bada'; | |
714 | + case this._OS.Curl.test(string): | |
715 | + this.Agent.isCurl = true; | |
716 | + return 'Curl'; | |
717 | + default: | |
718 | + return 'unknown'; | |
719 | + } | |
720 | + }; | |
721 | + | |
722 | + this.getPlatform = function (string) { | |
723 | + switch (true) { | |
724 | + case this._Platform.Windows.test(string): | |
725 | + return 'Microsoft Windows'; | |
726 | + case this._Platform.WindowsPhone.test(string): | |
727 | + this.Agent.isWindowsPhone = true; | |
728 | + return 'Microsoft Windows Phone'; | |
729 | + case this._Platform.Mac.test(string): | |
730 | + return 'Apple Mac'; | |
731 | + case this._Platform.Curl.test(string): | |
732 | + return 'Curl'; | |
733 | + case this._Platform.Android.test(string): | |
734 | + this.Agent.isAndroid = true; | |
735 | + return 'Android'; | |
736 | + case this._Platform.Blackberry.test(string): | |
737 | + this.Agent.isBlackberry = true; | |
738 | + return 'Blackberry'; | |
739 | + case this._Platform.Linux.test(string): | |
740 | + return 'Linux'; | |
741 | + case this._Platform.Wii.test(string): | |
742 | + return 'Wii'; | |
743 | + case this._Platform.Playstation.test(string): | |
744 | + return 'Playstation'; | |
745 | + case this._Platform.iPad.test(string): | |
746 | + this.Agent.isiPad = true; | |
747 | + return 'iPad'; | |
748 | + case this._Platform.iPod.test(string): | |
749 | + this.Agent.isiPod = true; | |
750 | + return 'iPod'; | |
751 | + case this._Platform.iPhone.test(string): | |
752 | + this.Agent.isiPhone = true; | |
753 | + return 'iPhone'; | |
754 | + case this._Platform.Samsung.test(string): | |
755 | + this.Agent.isiSamsung = true; | |
756 | + return 'Samsung'; | |
757 | + default: | |
758 | + return 'unknown'; | |
759 | + } | |
760 | + }; | |
761 | + | |
762 | + this.testCompatibilityMode = function () { | |
763 | + var ua = this; | |
764 | + if (this.Agent.isIE) { | |
765 | + if (/Trident\/(\d)\.0/i.test(ua.Agent.source)) { | |
766 | + var tridentVersion = parseInt(RegExp.$1, 10); | |
767 | + var version = parseInt(ua.Agent.version, 10); | |
768 | + if (version === 7 && tridentVersion === 7) { | |
769 | + ua.Agent.isIECompatibilityMode = true; | |
770 | + ua.Agent.version = 11.0; | |
771 | + } | |
772 | + | |
773 | + if (version === 7 && tridentVersion === 6) { | |
774 | + ua.Agent.isIECompatibilityMode = true; | |
775 | + ua.Agent.version = 10.0; | |
776 | + } | |
777 | + | |
778 | + if (version === 7 && tridentVersion === 5) { | |
779 | + ua.Agent.isIECompatibilityMode = true; | |
780 | + ua.Agent.version = 9.0; | |
781 | + } | |
782 | + | |
783 | + if (version === 7 && tridentVersion === 4) { | |
784 | + ua.Agent.isIECompatibilityMode = true; | |
785 | + ua.Agent.version = 8.0; | |
786 | + } | |
787 | + } | |
788 | + } | |
789 | + }; | |
790 | + | |
791 | + this.testSilk = function () { | |
792 | + var ua = this; | |
793 | + switch (true) { | |
794 | + case new RegExp('silk', 'gi').test(ua.Agent.source): | |
795 | + this.Agent.isSilk = true; | |
796 | + break; | |
797 | + default: | |
798 | + } | |
799 | + | |
800 | + if (/Silk-Accelerated=true/gi.test(ua.Agent.source)) { | |
801 | + this.Agent.SilkAccelerated = true; | |
802 | + } | |
803 | + return this.Agent.isSilk ? 'Silk' : false; | |
804 | + }; | |
805 | + | |
806 | + this.testKindleFire = function () { | |
807 | + var ua = this; | |
808 | + switch (true) { | |
809 | + case /KFOT/gi.test(ua.Agent.source): | |
810 | + this.Agent.isKindleFire = true; | |
811 | + return 'Kindle Fire'; | |
812 | + case /KFTT/gi.test(ua.Agent.source): | |
813 | + this.Agent.isKindleFire = true; | |
814 | + return 'Kindle Fire HD'; | |
815 | + case /KFJWI/gi.test(ua.Agent.source): | |
816 | + this.Agent.isKindleFire = true; | |
817 | + return 'Kindle Fire HD 8.9'; | |
818 | + case /KFJWA/gi.test(ua.Agent.source): | |
819 | + this.Agent.isKindleFire = true; | |
820 | + return 'Kindle Fire HD 8.9 4G'; | |
821 | + case /KFSOWI/gi.test(ua.Agent.source): | |
822 | + this.Agent.isKindleFire = true; | |
823 | + return 'Kindle Fire HD 7'; | |
824 | + case /KFTHWI/gi.test(ua.Agent.source): | |
825 | + this.Agent.isKindleFire = true; | |
826 | + return 'Kindle Fire HDX 7'; | |
827 | + case /KFTHWA/gi.test(ua.Agent.source): | |
828 | + this.Agent.isKindleFire = true; | |
829 | + return 'Kindle Fire HDX 7 4G'; | |
830 | + case /KFAPWI/gi.test(ua.Agent.source): | |
831 | + this.Agent.isKindleFire = true; | |
832 | + return 'Kindle Fire HDX 8.9'; | |
833 | + case /KFAPWA/gi.test(ua.Agent.source): | |
834 | + this.Agent.isKindleFire = true; | |
835 | + return 'Kindle Fire HDX 8.9 4G'; | |
836 | + default: | |
837 | + return false; | |
838 | + } | |
839 | + }; | |
840 | + | |
841 | + this.testCaptiveNetwork = function () { | |
842 | + var ua = this; | |
843 | + switch (true) { | |
844 | + case /CaptiveNetwork/gi.test(ua.Agent.source): | |
845 | + ua.Agent.isCaptive = true; | |
846 | + ua.Agent.isMac = true; | |
847 | + ua.Agent.platform = 'Apple Mac'; | |
848 | + return 'CaptiveNetwork'; | |
849 | + default: | |
850 | + return false; | |
851 | + } | |
852 | + }; | |
853 | + | |
854 | + this.testMobile = function testMobile() { | |
855 | + var ua = this; | |
856 | + switch (true) { | |
857 | + case ua.Agent.isWindows: | |
858 | + case ua.Agent.isLinux: | |
859 | + case ua.Agent.isMac: | |
860 | + case ua.Agent.isChromeOS: | |
861 | + ua.Agent.isDesktop = true; | |
862 | + break; | |
863 | + case ua.Agent.isAndroid: | |
864 | + case ua.Agent.isSamsung: | |
865 | + ua.Agent.isMobile = true; | |
866 | + ua.Agent.isDesktop = false; | |
867 | + break; | |
868 | + default: | |
869 | + } | |
870 | + switch (true) { | |
871 | + case ua.Agent.isiPad: | |
872 | + case ua.Agent.isiPod: | |
873 | + case ua.Agent.isiPhone: | |
874 | + case ua.Agent.isBada: | |
875 | + case ua.Agent.isBlackberry: | |
876 | + case ua.Agent.isAndroid: | |
877 | + case ua.Agent.isWindowsPhone: | |
878 | + ua.Agent.isMobile = true; | |
879 | + ua.Agent.isDesktop = false; | |
880 | + break; | |
881 | + default: | |
882 | + } | |
883 | + if (/mobile/i.test(ua.Agent.source)) { | |
884 | + ua.Agent.isMobile = true; | |
885 | + ua.Agent.isDesktop = false; | |
886 | + } | |
887 | + }; | |
888 | + | |
889 | + this.testTablet = function testTablet() { | |
890 | + var ua = this; | |
891 | + switch (true) { | |
892 | + case ua.Agent.isiPad: | |
893 | + case ua.Agent.isAndroidTablet: | |
894 | + case ua.Agent.isKindleFire: | |
895 | + ua.Agent.isTablet = true; | |
896 | + break; | |
897 | + } | |
898 | + if (/tablet/i.test(ua.Agent.source)) { | |
899 | + ua.Agent.isTablet = true; | |
900 | + } | |
901 | + }; | |
902 | + | |
903 | + this.testNginxGeoIP = function testNginxGeoIP(headers) { | |
904 | + var ua = this; | |
905 | + Object.keys(headers).forEach(function (key) { | |
906 | + if (/^GEOIP/i.test(key)) { | |
907 | + ua.Agent.geoIp[key] = headers[key]; | |
908 | + } | |
909 | + }); | |
910 | + }; | |
911 | + | |
912 | + this.testBot = function testBot() { | |
913 | + var ua = this; | |
914 | + var isBot = IS_BOT_REGEXP.exec(ua.Agent.source.toLowerCase()); | |
915 | + if (isBot) { | |
916 | + ua.Agent.isBot = isBot[1]; | |
917 | + } else if (!ua.Agent.isAuthoritative) { | |
918 | + // Test unauthoritative parse for `bot` in UA to flag for bot | |
919 | + ua.Agent.isBot = /bot/i.test(ua.Agent.source); | |
920 | + } | |
921 | + }; | |
922 | + | |
923 | + this.testSmartTV = function testBot() { | |
924 | + var ua = this; | |
925 | + var isSmartTV = new RegExp('smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv', 'gi').exec(ua.Agent.source.toLowerCase()); | |
926 | + if (isSmartTV) { | |
927 | + ua.Agent.isSmartTV = isSmartTV[1]; | |
928 | + } | |
929 | + }; | |
930 | + | |
931 | + this.testAndroidTablet = function testAndroidTablet() { | |
932 | + var ua = this; | |
933 | + if (ua.Agent.isAndroid && !/mobile/i.test(ua.Agent.source)) { | |
934 | + ua.Agent.isAndroidTablet = true; | |
935 | + } | |
936 | + }; | |
937 | + | |
938 | + this.testTouchSupport = function () { | |
939 | + var ua = this; | |
940 | + ua.Agent.isTouchScreen = (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); | |
941 | + }; | |
942 | + | |
943 | + this.getLaguage = function () { | |
944 | + var ua = this; | |
945 | + ua.Agent.language = (navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || '').toLowerCase(); | |
946 | + }; | |
947 | + | |
948 | + this.getColorDepth = function () { | |
949 | + var ua = this; | |
950 | + ua.Agent.colorDepth = screen.colorDepth || -1; | |
951 | + }; | |
952 | + | |
953 | + this.getScreenResolution = function () { | |
954 | + var ua = this; | |
955 | + ua.Agent.resolution = [screen.availWidth, screen.availHeight]; | |
956 | + }; | |
957 | + | |
958 | + this.getPixelDepth = function () { | |
959 | + var ua = this; | |
960 | + ua.Agent.pixelDepth = screen.pixelDepth || -1; | |
961 | + }; | |
962 | + | |
963 | + this.getCPU = function () { | |
964 | + var ua = this; | |
965 | + ua.Agent.cpuCores = navigator.hardwareConcurrency || -1; | |
966 | + }; | |
967 | + | |
968 | + this.reset = function reset() { | |
969 | + var ua = this; | |
970 | + for (var key in ua.DefaultAgent) { | |
971 | + if (ua.DefaultAgent.hasOwnProperty(key)) { | |
972 | + ua.Agent[key] = ua.DefaultAgent[key]; | |
973 | + } | |
974 | + } | |
975 | + return ua; | |
976 | + }; | |
977 | + | |
978 | + this.parse = function get(source) { | |
979 | + source = source || navigator.userAgent; | |
980 | + var ua = new DeviceUUID(); | |
981 | + ua.Agent.source = source.replace(/^\s*/, '').replace(/\s*$/, ''); | |
982 | + ua.Agent.os = ua.getOS(ua.Agent.source); | |
983 | + ua.Agent.platform = ua.getPlatform(ua.Agent.source); | |
984 | + ua.Agent.browser = ua.getBrowser(ua.Agent.source); | |
985 | + ua.Agent.version = ua.getBrowserVersion(ua.Agent.source); | |
986 | + ua.testBot(); | |
987 | + ua.testSmartTV(); | |
988 | + ua.testMobile(); | |
989 | + ua.testAndroidTablet(); | |
990 | + ua.testTablet(); | |
991 | + ua.testCompatibilityMode(); | |
992 | + ua.testSilk(); | |
993 | + ua.testKindleFire(); | |
994 | + ua.testCaptiveNetwork(); | |
995 | + ua.testTouchSupport(); | |
996 | + ua.getLaguage(); | |
997 | + ua.getColorDepth(); | |
998 | + ua.getPixelDepth(); | |
999 | + ua.getScreenResolution(); | |
1000 | + ua.getCPU(); | |
1001 | + return ua.Agent; | |
1002 | + }; | |
1003 | + | |
1004 | + this.get = function (customData) { | |
1005 | + var pref = 'a', du = this.parse(); | |
1006 | + var dua = []; | |
1007 | + for (var key in this.options) { | |
1008 | + if (this.options.hasOwnProperty(key) && this.options[key] === true) { | |
1009 | + dua.push(du[key]); | |
1010 | + } | |
1011 | + } | |
1012 | + if (customData) { | |
1013 | + dua.push(customData); | |
1014 | + } | |
1015 | + if (!this.options.resolution && du.isMobile) { | |
1016 | + dua.push(du.resolution); | |
1017 | + } | |
1018 | + // 8, 9, a, b | |
1019 | + pref = 'b'; | |
1020 | + var tmpUuid = du.hashMD5(dua.join(':')); | |
1021 | + var uuid = [ | |
1022 | + tmpUuid.slice(0, 8), | |
1023 | + tmpUuid.slice(8, 12), | |
1024 | + '4' + tmpUuid.slice(12, 15), | |
1025 | + pref + tmpUuid.slice(15, 18), | |
1026 | + tmpUuid.slice(20) | |
1027 | + ]; | |
1028 | + return uuid.join('-'); | |
1029 | + }; | |
1030 | + | |
1031 | + this.Agent = this.DefaultAgent; | |
1032 | + return this; | |
1033 | + }; | |
1034 | + | |
1035 | + exports.DeviceUUID = DeviceUUID; | |
1036 | + return new DeviceUUID(navigator.userAgent); | |
1037 | + | |
1038 | +})(this); | |
\ No newline at end of file |
@@ -0,0 +1,1038 @@ | ||
1 | +/*! | |
2 | + * device-uuid.js v1.0.4 (https://github.com/biggora/device-uuid/) | |
3 | + * Copyright 2016-2017 Alexey Gordeyev | |
4 | + * Licensed under MIT (https://github.com/biggora/device-uuid/blob/master/LICENSE) | |
5 | + */ | |
6 | +/*global | |
7 | + screen, window, navigator | |
8 | + */ | |
9 | +(function (exports) { | |
10 | + 'use strict'; | |
11 | + | |
12 | + var BOTS = [ | |
13 | + '\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/', | |
14 | + 'googlebot', | |
15 | + 'baiduspider', | |
16 | + 'gurujibot', | |
17 | + 'yandexbot', | |
18 | + 'slurp', | |
19 | + 'msnbot', | |
20 | + 'bingbot', | |
21 | + 'facebookexternalhit', | |
22 | + 'linkedinbot', | |
23 | + 'twitterbot', | |
24 | + 'slackbot', | |
25 | + 'telegrambot', | |
26 | + 'applebot', | |
27 | + 'pingdom', | |
28 | + 'tumblr ', | |
29 | + 'Embedly', | |
30 | + 'spbot' | |
31 | + ]; | |
32 | + var IS_BOT_REGEXP = new RegExp('^.*(' + BOTS.join('|') + ').*$'); | |
33 | + | |
34 | + var DeviceUUID = function (options) { | |
35 | + options = options ? options : {}; | |
36 | + var defOptions = { | |
37 | + version: false, | |
38 | + language: false, | |
39 | + platform: true, | |
40 | + os: true, | |
41 | + pixelDepth: true, | |
42 | + colorDepth: true, | |
43 | + resolution: false, | |
44 | + isAuthoritative: true, | |
45 | + silkAccelerated: true, | |
46 | + isKindleFire: true, | |
47 | + isDesktop: true, | |
48 | + isMobile: true, | |
49 | + isTablet: true, | |
50 | + isWindows: true, | |
51 | + isLinux: true, | |
52 | + isLinux64: true, | |
53 | + isChromeOS: true, | |
54 | + isMac: true, | |
55 | + isiPad: true, | |
56 | + isiPhone: true, | |
57 | + isiPod: true, | |
58 | + isAndroid: true, | |
59 | + isSamsung: true, | |
60 | + isSmartTV: true, | |
61 | + isRaspberry: true, | |
62 | + isBlackberry: true, | |
63 | + isTouchScreen: true, | |
64 | + isOpera: false, | |
65 | + isIE: false, | |
66 | + isEdge: false, | |
67 | + isIECompatibilityMode: false, | |
68 | + isSafari: false, | |
69 | + isFirefox: false, | |
70 | + isWebkit: false, | |
71 | + isChrome: false, | |
72 | + isKonqueror: false, | |
73 | + isOmniWeb: false, | |
74 | + isSeaMonkey: false, | |
75 | + isFlock: false, | |
76 | + isAmaya: false, | |
77 | + isPhantomJS: false, | |
78 | + isEpiphany: false, | |
79 | + source: false, | |
80 | + cpuCores: false | |
81 | + }; | |
82 | + for (var key in options) { | |
83 | + if (options.hasOwnProperty(key) && typeof defOptions[key] !== 'undefined') { | |
84 | + defOptions[key] = options[key]; | |
85 | + } | |
86 | + } | |
87 | + this.options = defOptions; | |
88 | + this.version = '1.0.0'; | |
89 | + this._Versions = { | |
90 | + Edge: /Edge\/([\d\w\.\-]+)/i, | |
91 | + Firefox: /firefox\/([\d\w\.\-]+)/i, | |
92 | + IE: /msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i, | |
93 | + Chrome: /chrome\/([\d\w\.\-]+)/i, | |
94 | + Chromium: /(?:chromium|crios)\/([\d\w\.\-]+)/i, | |
95 | + Safari: /version\/([\d\w\.\-]+)/i, | |
96 | + Opera: /version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i, | |
97 | + Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
98 | + Psp: /([\d\w\.\-]+)\)?\s*$/i, | |
99 | + Amaya: /amaya\/([\d\w\.\-]+)/i, | |
100 | + SeaMonkey: /seamonkey\/([\d\w\.\-]+)/i, | |
101 | + OmniWeb: /omniweb\/v([\d\w\.\-]+)/i, | |
102 | + Flock: /flock\/([\d\w\.\-]+)/i, | |
103 | + Epiphany: /epiphany\/([\d\w\.\-]+)/i, | |
104 | + WinJs: /msapphost\/([\d\w\.\-]+)/i, | |
105 | + PhantomJS: /phantomjs\/([\d\w\.\-]+)/i, | |
106 | + UC: /UCBrowser\/([\d\w\.]+)/i | |
107 | + }; | |
108 | + this._Browsers = { | |
109 | + Edge: /edge/i, | |
110 | + Amaya: /amaya/i, | |
111 | + Konqueror: /konqueror/i, | |
112 | + Epiphany: /epiphany/i, | |
113 | + SeaMonkey: /seamonkey/i, | |
114 | + Flock: /flock/i, | |
115 | + OmniWeb: /omniweb/i, | |
116 | + Chromium: /chromium|crios/i, | |
117 | + Chrome: /chrome/i, | |
118 | + Safari: /safari/i, | |
119 | + IE: /msie|trident/i, | |
120 | + Opera: /opera|OPR/i, | |
121 | + PS3: /playstation 3/i, | |
122 | + PSP: /playstation portable/i, | |
123 | + Firefox: /firefox/i, | |
124 | + WinJs: /msapphost/i, | |
125 | + PhantomJS: /phantomjs/i, | |
126 | + UC: /UCBrowser/i | |
127 | + }; | |
128 | + this._OS = { | |
129 | + Windows10: /windows nt 10\.0/i, | |
130 | + Windows81: /windows nt 6\.3/i, | |
131 | + Windows8: /windows nt 6\.2/i, | |
132 | + Windows7: /windows nt 6\.1/i, | |
133 | + UnknownWindows: /windows nt 6\.\d+/i, | |
134 | + WindowsVista: /windows nt 6\.0/i, | |
135 | + Windows2003: /windows nt 5\.2/i, | |
136 | + WindowsXP: /windows nt 5\.1/i, | |
137 | + Windows2000: /windows nt 5\.0/i, | |
138 | + WindowsPhone8: /windows phone 8\./, | |
139 | + OSXCheetah: /os x 10[._]0/i, | |
140 | + OSXPuma: /os x 10[._]1(\D|$)/i, | |
141 | + OSXJaguar: /os x 10[._]2/i, | |
142 | + OSXPanther: /os x 10[._]3/i, | |
143 | + OSXTiger: /os x 10[._]4/i, | |
144 | + OSXLeopard: /os x 10[._]5/i, | |
145 | + OSXSnowLeopard: /os x 10[._]6/i, | |
146 | + OSXLion: /os x 10[._]7/i, | |
147 | + OSXMountainLion: /os x 10[._]8/i, | |
148 | + OSXMavericks: /os x 10[._]9/i, | |
149 | + OSXYosemite: /os x 10[._]10/i, | |
150 | + OSXElCapitan: /os x 10[._]11/i, | |
151 | + OSXSierra: /os x 10[._]12/i, | |
152 | + Mac: /os x/i, | |
153 | + Linux: /linux/i, | |
154 | + Linux64: /linux x86_64/i, | |
155 | + ChromeOS: /cros/i, | |
156 | + Wii: /wii/i, | |
157 | + PS3: /playstation 3/i, | |
158 | + PSP: /playstation portable/i, | |
159 | + iPad: /\(iPad.*os (\d+)[._](\d+)/i, | |
160 | + iPhone: /\(iPhone.*os (\d+)[._](\d+)/i, | |
161 | + Bada: /Bada\/(\d+)\.(\d+)/i, | |
162 | + Curl: /curl\/(\d+)\.(\d+)\.(\d+)/i | |
163 | + }; | |
164 | + this._Platform = { | |
165 | + Windows: /windows nt/i, | |
166 | + WindowsPhone: /windows phone/i, | |
167 | + Mac: /macintosh/i, | |
168 | + Linux: /linux/i, | |
169 | + Wii: /wii/i, | |
170 | + Playstation: /playstation/i, | |
171 | + iPad: /ipad/i, | |
172 | + iPod: /ipod/i, | |
173 | + iPhone: /iphone/i, | |
174 | + Android: /android/i, | |
175 | + Blackberry: /blackberry/i, | |
176 | + Samsung: /samsung/i, | |
177 | + Curl: /curl/i | |
178 | + }; | |
179 | + | |
180 | + this.DefaultAgent = { | |
181 | + isAuthoritative: true, | |
182 | + isMobile: false, | |
183 | + isTablet: false, | |
184 | + isiPad: false, | |
185 | + isiPod: false, | |
186 | + isiPhone: false, | |
187 | + isAndroid: false, | |
188 | + isBlackberry: false, | |
189 | + isOpera: false, | |
190 | + isIE: false, | |
191 | + isEdge: false, | |
192 | + isIECompatibilityMode: false, | |
193 | + isSafari: false, | |
194 | + isFirefox: false, | |
195 | + isWebkit: false, | |
196 | + isChrome: false, | |
197 | + isKonqueror: false, | |
198 | + isOmniWeb: false, | |
199 | + isSeaMonkey: false, | |
200 | + isFlock: false, | |
201 | + isAmaya: false, | |
202 | + isPhantomJS: false, | |
203 | + isEpiphany: false, | |
204 | + isDesktop: false, | |
205 | + isWindows: false, | |
206 | + isLinux: false, | |
207 | + isLinux64: false, | |
208 | + isMac: false, | |
209 | + isChromeOS: false, | |
210 | + isBada: false, | |
211 | + isSamsung: false, | |
212 | + isRaspberry: false, | |
213 | + isBot: false, | |
214 | + isCurl: false, | |
215 | + isAndroidTablet: false, | |
216 | + isWinJs: false, | |
217 | + isKindleFire: false, | |
218 | + isSilk: false, | |
219 | + isCaptive: false, | |
220 | + isSmartTV: false, | |
221 | + isUC: false, | |
222 | + isTouchScreen: false, | |
223 | + silkAccelerated: false, | |
224 | + colorDepth: -1, | |
225 | + pixelDepth: -1, | |
226 | + resolution: [], | |
227 | + cpuCores: -1, | |
228 | + language: 'unknown', | |
229 | + browser: 'unknown', | |
230 | + version: 'unknown', | |
231 | + os: 'unknown', | |
232 | + platform: 'unknown', | |
233 | + geoIp: {}, | |
234 | + source: '', | |
235 | + hashInt: function (string) { | |
236 | + var hash = 0, i, chr, len; | |
237 | + if (string.length === 0) { return hash; } | |
238 | + for (i = 0, len = string.length; i < len; i++) { | |
239 | + chr = string.charCodeAt(i); | |
240 | + hash = ((hash << 5) - hash) + chr; | |
241 | + hash |= 0; | |
242 | + } | |
243 | + return hash; | |
244 | + }, | |
245 | + hashMD5: function (string) { | |
246 | + function rotateLeft(lValue, iShiftBits) { | |
247 | + return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); | |
248 | + } | |
249 | + | |
250 | + function addUnsigned(lX, lY) { | |
251 | + var lX4, lY4, lX8, lY8, lResult; | |
252 | + lX8 = (lX & 0x80000000); | |
253 | + lY8 = (lY & 0x80000000); | |
254 | + lX4 = (lX & 0x40000000); | |
255 | + lY4 = (lY & 0x40000000); | |
256 | + lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); | |
257 | + | |
258 | + if (lX4 & lY4) { | |
259 | + return (lResult ^ 0x80000000 ^ lX8 ^ lY8); | |
260 | + } | |
261 | + if (lX4 | lY4) { | |
262 | + if (lResult & 0x40000000) { | |
263 | + return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); | |
264 | + } else { | |
265 | + return (lResult ^ 0x40000000 ^ lX8 ^ lY8); | |
266 | + } | |
267 | + } else { | |
268 | + return (lResult ^ lX8 ^ lY8); | |
269 | + } | |
270 | + } | |
271 | + | |
272 | + function gF(x, y, z) { | |
273 | + return (x & y) | ((~x) & z); | |
274 | + } | |
275 | + | |
276 | + function gG(x, y, z) { | |
277 | + return (x & z) | (y & (~z)); | |
278 | + } | |
279 | + | |
280 | + function gH(x, y, z) { | |
281 | + return (x ^ y ^ z); | |
282 | + } | |
283 | + | |
284 | + function gI(x, y, z) { | |
285 | + return (y ^ (x | (~z))); | |
286 | + } | |
287 | + | |
288 | + function gFF(a, b, c, d, x, s, ac) { | |
289 | + a = addUnsigned(a, addUnsigned(addUnsigned(gF(b, c, d), x), ac)); | |
290 | + return addUnsigned(rotateLeft(a, s), b); | |
291 | + } | |
292 | + | |
293 | + function gGG(a, b, c, d, x, s, ac) { | |
294 | + a = addUnsigned(a, addUnsigned(addUnsigned(gG(b, c, d), x), ac)); | |
295 | + return addUnsigned(rotateLeft(a, s), b); | |
296 | + } | |
297 | + | |
298 | + function gHH(a, b, c, d, x, s, ac) { | |
299 | + a = addUnsigned(a, addUnsigned(addUnsigned(gH(b, c, d), x), ac)); | |
300 | + return addUnsigned(rotateLeft(a, s), b); | |
301 | + } | |
302 | + | |
303 | + function gII(a, b, c, d, x, s, ac) { | |
304 | + a = addUnsigned(a, addUnsigned(addUnsigned(gI(b, c, d), x), ac)); | |
305 | + return addUnsigned(rotateLeft(a, s), b); | |
306 | + } | |
307 | + | |
308 | + function convertToWordArray(string) { | |
309 | + var lWordCount; | |
310 | + var lMessageLength = string.length; | |
311 | + var lNumberOfWordsTemp1 = lMessageLength + 8; | |
312 | + var lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64; | |
313 | + var lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16; | |
314 | + var lWordArray = new Array(lNumberOfWords - 1); | |
315 | + var lBytePosition = 0; | |
316 | + var lByteCount = 0; | |
317 | + | |
318 | + while (lByteCount < lMessageLength) { | |
319 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
320 | + lBytePosition = (lByteCount % 4) * 8; | |
321 | + lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); | |
322 | + lByteCount++; | |
323 | + } | |
324 | + | |
325 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
326 | + lBytePosition = (lByteCount % 4) * 8; | |
327 | + lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); | |
328 | + lWordArray[lNumberOfWords - 2] = lMessageLength << 3; | |
329 | + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; | |
330 | + return lWordArray; | |
331 | + } | |
332 | + | |
333 | + function wordToHex(lValue) { | |
334 | + var wordToHexValue = '', wordToHexValueTemp = '', lByte, lCount; | |
335 | + for (lCount = 0; lCount <= 3; lCount++) { | |
336 | + lByte = (lValue >>> (lCount * 8)) & 255; | |
337 | + wordToHexValueTemp = '0' + lByte.toString(16); | |
338 | + wordToHexValue = wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2); | |
339 | + } | |
340 | + return wordToHexValue; | |
341 | + } | |
342 | + | |
343 | + function utf8Encode(string) { | |
344 | + string = string.replace(/\r\n/g, '\n'); | |
345 | + var utftext = ''; | |
346 | + | |
347 | + for (var n = 0; n < string.length; n++) { | |
348 | + var c = string.charCodeAt(n); | |
349 | + if (c < 128) { | |
350 | + utftext += String.fromCharCode(c); | |
351 | + } else if ((c > 127) && (c < 2048)) { | |
352 | + utftext += String.fromCharCode((c >> 6) | 192); | |
353 | + utftext += String.fromCharCode((c & 63) | 128); | |
354 | + } else { | |
355 | + utftext += String.fromCharCode((c >> 12) | 224); | |
356 | + utftext += String.fromCharCode(((c >> 6) & 63) | 128); | |
357 | + utftext += String.fromCharCode((c & 63) | 128); | |
358 | + } | |
359 | + } | |
360 | + return utftext; | |
361 | + } | |
362 | + | |
363 | + var x = []; | |
364 | + var k, AA, BB, CC, DD, a, b, c, d; | |
365 | + var S11 = 7, S12 = 12, S13 = 17, S14 = 22; | |
366 | + var S21 = 5, S22 = 9, S23 = 14, S24 = 20; | |
367 | + var S31 = 4, S32 = 11, S33 = 16, S34 = 23; | |
368 | + var S41 = 6, S42 = 10, S43 = 15, S44 = 21; | |
369 | + string = utf8Encode(string); | |
370 | + x = convertToWordArray(string); | |
371 | + a = 0x67452301; | |
372 | + b = 0xEFCDAB89; | |
373 | + c = 0x98BADCFE; | |
374 | + d = 0x10325476; | |
375 | + | |
376 | + for (k = 0; k < x.length; k += 16) { | |
377 | + AA = a; | |
378 | + BB = b; | |
379 | + CC = c; | |
380 | + DD = d; | |
381 | + a = gFF(a, b, c, d, x[k + 0], S11, 0xD76AA478); | |
382 | + d = gFF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); | |
383 | + c = gFF(c, d, a, b, x[k + 2], S13, 0x242070DB); | |
384 | + b = gFF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); | |
385 | + a = gFF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); | |
386 | + d = gFF(d, a, b, c, x[k + 5], S12, 0x4787C62A); | |
387 | + c = gFF(c, d, a, b, x[k + 6], S13, 0xA8304613); | |
388 | + b = gFF(b, c, d, a, x[k + 7], S14, 0xFD469501); | |
389 | + a = gFF(a, b, c, d, x[k + 8], S11, 0x698098D8); | |
390 | + d = gFF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); | |
391 | + c = gFF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); | |
392 | + b = gFF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); | |
393 | + a = gFF(a, b, c, d, x[k + 12], S11, 0x6B901122); | |
394 | + d = gFF(d, a, b, c, x[k + 13], S12, 0xFD987193); | |
395 | + c = gFF(c, d, a, b, x[k + 14], S13, 0xA679438E); | |
396 | + b = gFF(b, c, d, a, x[k + 15], S14, 0x49B40821); | |
397 | + a = gGG(a, b, c, d, x[k + 1], S21, 0xF61E2562); | |
398 | + d = gGG(d, a, b, c, x[k + 6], S22, 0xC040B340); | |
399 | + c = gGG(c, d, a, b, x[k + 11], S23, 0x265E5A51); | |
400 | + b = gGG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); | |
401 | + a = gGG(a, b, c, d, x[k + 5], S21, 0xD62F105D); | |
402 | + d = gGG(d, a, b, c, x[k + 10], S22, 0x2441453); | |
403 | + c = gGG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); | |
404 | + b = gGG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); | |
405 | + a = gGG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); | |
406 | + d = gGG(d, a, b, c, x[k + 14], S22, 0xC33707D6); | |
407 | + c = gGG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); | |
408 | + b = gGG(b, c, d, a, x[k + 8], S24, 0x455A14ED); | |
409 | + a = gGG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); | |
410 | + d = gGG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); | |
411 | + c = gGG(c, d, a, b, x[k + 7], S23, 0x676F02D9); | |
412 | + b = gGG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); | |
413 | + a = gHH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); | |
414 | + d = gHH(d, a, b, c, x[k + 8], S32, 0x8771F681); | |
415 | + c = gHH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); | |
416 | + b = gHH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); | |
417 | + a = gHH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); | |
418 | + d = gHH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); | |
419 | + c = gHH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); | |
420 | + b = gHH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); | |
421 | + a = gHH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); | |
422 | + d = gHH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); | |
423 | + c = gHH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); | |
424 | + b = gHH(b, c, d, a, x[k + 6], S34, 0x4881D05); | |
425 | + a = gHH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); | |
426 | + d = gHH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); | |
427 | + c = gHH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); | |
428 | + b = gHH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); | |
429 | + a = gII(a, b, c, d, x[k + 0], S41, 0xF4292244); | |
430 | + d = gII(d, a, b, c, x[k + 7], S42, 0x432AFF97); | |
431 | + c = gII(c, d, a, b, x[k + 14], S43, 0xAB9423A7); | |
432 | + b = gII(b, c, d, a, x[k + 5], S44, 0xFC93A039); | |
433 | + a = gII(a, b, c, d, x[k + 12], S41, 0x655B59C3); | |
434 | + d = gII(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); | |
435 | + c = gII(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); | |
436 | + b = gII(b, c, d, a, x[k + 1], S44, 0x85845DD1); | |
437 | + a = gII(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); | |
438 | + d = gII(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); | |
439 | + c = gII(c, d, a, b, x[k + 6], S43, 0xA3014314); | |
440 | + b = gII(b, c, d, a, x[k + 13], S44, 0x4E0811A1); | |
441 | + a = gII(a, b, c, d, x[k + 4], S41, 0xF7537E82); | |
442 | + d = gII(d, a, b, c, x[k + 11], S42, 0xBD3AF235); | |
443 | + c = gII(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); | |
444 | + b = gII(b, c, d, a, x[k + 9], S44, 0xEB86D391); | |
445 | + a = addUnsigned(a, AA); | |
446 | + b = addUnsigned(b, BB); | |
447 | + c = addUnsigned(c, CC); | |
448 | + d = addUnsigned(d, DD); | |
449 | + } | |
450 | + var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); | |
451 | + return temp.toLowerCase(); | |
452 | + } | |
453 | + }; | |
454 | + | |
455 | + this.Agent = {}; | |
456 | + | |
457 | + this.getBrowser = function (string) { | |
458 | + switch (true) { | |
459 | + case this._Browsers.Edge.test(string): | |
460 | + this.Agent.isEdge = true; | |
461 | + return 'Edge'; | |
462 | + case this._Browsers.PhantomJS.test(string): | |
463 | + this.Agent.isPhantomJS = true; | |
464 | + return 'PhantomJS'; | |
465 | + case this._Browsers.Konqueror.test(string): | |
466 | + this.Agent.isKonqueror = true; | |
467 | + return 'Konqueror'; | |
468 | + case this._Browsers.Amaya.test(string): | |
469 | + this.Agent.isAmaya = true; | |
470 | + return 'Amaya'; | |
471 | + case this._Browsers.Epiphany.test(string): | |
472 | + this.Agent.isEpiphany = true; | |
473 | + return 'Epiphany'; | |
474 | + case this._Browsers.SeaMonkey.test(string): | |
475 | + this.Agent.isSeaMonkey = true; | |
476 | + return 'SeaMonkey'; | |
477 | + case this._Browsers.Flock.test(string): | |
478 | + this.Agent.isFlock = true; | |
479 | + return 'Flock'; | |
480 | + case this._Browsers.OmniWeb.test(string): | |
481 | + this.Agent.isOmniWeb = true; | |
482 | + return 'OmniWeb'; | |
483 | + case this._Browsers.Opera.test(string): | |
484 | + this.Agent.isOpera = true; | |
485 | + return 'Opera'; | |
486 | + case this._Browsers.Chromium.test(string): | |
487 | + this.Agent.isChrome = true; | |
488 | + return 'Chromium'; | |
489 | + case this._Browsers.Chrome.test(string): | |
490 | + this.Agent.isChrome = true; | |
491 | + return 'Chrome'; | |
492 | + case this._Browsers.Safari.test(string): | |
493 | + this.Agent.isSafari = true; | |
494 | + return 'Safari'; | |
495 | + case this._Browsers.WinJs.test(string): | |
496 | + this.Agent.isWinJs = true; | |
497 | + return 'WinJs'; | |
498 | + case this._Browsers.IE.test(string): | |
499 | + this.Agent.isIE = true; | |
500 | + return 'IE'; | |
501 | + case this._Browsers.PS3.test(string): | |
502 | + return 'ps3'; | |
503 | + case this._Browsers.PSP.test(string): | |
504 | + return 'psp'; | |
505 | + case this._Browsers.Firefox.test(string): | |
506 | + this.Agent.isFirefox = true; | |
507 | + return 'Firefox'; | |
508 | + case this._Browsers.UC.test(string): | |
509 | + this.Agent.isUC = true; | |
510 | + return 'UCBrowser'; | |
511 | + default: | |
512 | + // If the UA does not start with Mozilla guess the user agent. | |
513 | + if (string.indexOf('Mozilla') !== 0 && /^([\d\w\-\.]+)\/[\d\w\.\-]+/i.test(string)) { | |
514 | + this.Agent.isAuthoritative = false; | |
515 | + return RegExp.$1; | |
516 | + } | |
517 | + return 'unknown'; | |
518 | + } | |
519 | + }; | |
520 | + | |
521 | + this.getBrowserVersion = function (string) { | |
522 | + var regex; | |
523 | + switch (this.Agent.browser) { | |
524 | + case 'Edge': | |
525 | + if (this._Versions.Edge.test(string)) { | |
526 | + return RegExp.$1; | |
527 | + } | |
528 | + break; | |
529 | + case 'PhantomJS': | |
530 | + if (this._Versions.PhantomJS.test(string)) { | |
531 | + return RegExp.$1; | |
532 | + } | |
533 | + break; | |
534 | + case 'Chrome': | |
535 | + if (this._Versions.Chrome.test(string)) { | |
536 | + return RegExp.$1; | |
537 | + } | |
538 | + break; | |
539 | + case 'Chromium': | |
540 | + if (this._Versions.Chromium.test(string)) { | |
541 | + return RegExp.$1; | |
542 | + } | |
543 | + break; | |
544 | + case 'Safari': | |
545 | + if (this._Versions.Safari.test(string)) { | |
546 | + return RegExp.$1; | |
547 | + } | |
548 | + break; | |
549 | + case 'Opera': | |
550 | + if (this._Versions.Opera.test(string)) { | |
551 | + return RegExp.$1 ? RegExp.$1 : RegExp.$2; | |
552 | + } | |
553 | + break; | |
554 | + case 'Firefox': | |
555 | + if (this._Versions.Firefox.test(string)) { | |
556 | + return RegExp.$1; | |
557 | + } | |
558 | + break; | |
559 | + case 'WinJs': | |
560 | + if (this._Versions.WinJs.test(string)) { | |
561 | + return RegExp.$1; | |
562 | + } | |
563 | + break; | |
564 | + case 'IE': | |
565 | + if (this._Versions.IE.test(string)) { | |
566 | + return RegExp.$2 ? RegExp.$2 : RegExp.$1; | |
567 | + } | |
568 | + break; | |
569 | + case 'ps3': | |
570 | + if (this._Versions.Ps3.test(string)) { | |
571 | + return RegExp.$1; | |
572 | + } | |
573 | + break; | |
574 | + case 'psp': | |
575 | + if (this._Versions.Psp.test(string)) { | |
576 | + return RegExp.$1; | |
577 | + } | |
578 | + break; | |
579 | + case 'Amaya': | |
580 | + if (this._Versions.Amaya.test(string)) { | |
581 | + return RegExp.$1; | |
582 | + } | |
583 | + break; | |
584 | + case 'Epiphany': | |
585 | + if (this._Versions.Epiphany.test(string)) { | |
586 | + return RegExp.$1; | |
587 | + } | |
588 | + break; | |
589 | + case 'SeaMonkey': | |
590 | + if (this._Versions.SeaMonkey.test(string)) { | |
591 | + return RegExp.$1; | |
592 | + } | |
593 | + break; | |
594 | + case 'Flock': | |
595 | + if (this._Versions.Flock.test(string)) { | |
596 | + return RegExp.$1; | |
597 | + } | |
598 | + break; | |
599 | + case 'OmniWeb': | |
600 | + if (this._Versions.OmniWeb.test(string)) { | |
601 | + return RegExp.$1; | |
602 | + } | |
603 | + break; | |
604 | + case 'UCBrowser': | |
605 | + if (this._Versions.UC.test(string)) { | |
606 | + return RegExp.$1; | |
607 | + } | |
608 | + break; | |
609 | + default: | |
610 | + if (this.Agent.browser !== 'unknown') { | |
611 | + regex = new RegExp(this.Agent.browser + '[\\/ ]([\\d\\w\\.\\-]+)', 'i'); | |
612 | + if (regex.test(string)) { | |
613 | + return RegExp.$1; | |
614 | + } | |
615 | + } | |
616 | + } | |
617 | + }; | |
618 | + | |
619 | + this.getOS = function (string) { | |
620 | + switch (true) { | |
621 | + case this._OS.WindowsVista.test(string): | |
622 | + this.Agent.isWindows = true; | |
623 | + return 'Windows Vista'; | |
624 | + case this._OS.Windows7.test(string): | |
625 | + this.Agent.isWindows = true; | |
626 | + return 'Windows 7'; | |
627 | + case this._OS.Windows8.test(string): | |
628 | + this.Agent.isWindows = true; | |
629 | + return 'Windows 8'; | |
630 | + case this._OS.Windows81.test(string): | |
631 | + this.Agent.isWindows = true; | |
632 | + return 'Windows 8.1'; | |
633 | + case this._OS.Windows10.test(string): | |
634 | + this.Agent.isWindows = true; | |
635 | + return 'Windows 10.0'; | |
636 | + case this._OS.Windows2003.test(string): | |
637 | + this.Agent.isWindows = true; | |
638 | + return 'Windows 2003'; | |
639 | + case this._OS.WindowsXP.test(string): | |
640 | + this.Agent.isWindows = true; | |
641 | + return 'Windows XP'; | |
642 | + case this._OS.Windows2000.test(string): | |
643 | + this.Agent.isWindows = true; | |
644 | + return 'Windows 2000'; | |
645 | + case this._OS.WindowsPhone8.test(string): | |
646 | + return 'Windows Phone 8'; | |
647 | + case this._OS.Linux64.test(string): | |
648 | + this.Agent.isLinux = true; | |
649 | + this.Agent.isLinux64 = true; | |
650 | + return 'Linux 64'; | |
651 | + case this._OS.Linux.test(string): | |
652 | + this.Agent.isLinux = true; | |
653 | + return 'Linux'; | |
654 | + case this._OS.ChromeOS.test(string): | |
655 | + this.Agent.isChromeOS = true; | |
656 | + return 'Chrome OS'; | |
657 | + case this._OS.Wii.test(string): | |
658 | + return 'Wii'; | |
659 | + case this._OS.PS3.test(string): | |
660 | + return 'Playstation'; | |
661 | + case this._OS.PSP.test(string): | |
662 | + return 'Playstation'; | |
663 | + case this._OS.OSXCheetah.test(string): | |
664 | + this.Agent.isMac = true; | |
665 | + return 'OS X Cheetah'; | |
666 | + case this._OS.OSXPuma.test(string): | |
667 | + this.Agent.isMac = true; | |
668 | + return 'OS X Puma'; | |
669 | + case this._OS.OSXJaguar.test(string): | |
670 | + this.Agent.isMac = true; | |
671 | + return 'OS X Jaguar'; | |
672 | + case this._OS.OSXPanther.test(string): | |
673 | + this.Agent.isMac = true; | |
674 | + return 'OS X Panther'; | |
675 | + case this._OS.OSXTiger.test(string): | |
676 | + this.Agent.isMac = true; | |
677 | + return 'OS X Tiger'; | |
678 | + case this._OS.OSXLeopard.test(string): | |
679 | + this.Agent.isMac = true; | |
680 | + return 'OS X Leopard'; | |
681 | + case this._OS.OSXSnowLeopard.test(string): | |
682 | + this.Agent.isMac = true; | |
683 | + return 'OS X Snow Leopard'; | |
684 | + case this._OS.OSXLion.test(string): | |
685 | + this.Agent.isMac = true; | |
686 | + return 'OS X Lion'; | |
687 | + case this._OS.OSXMountainLion.test(string): | |
688 | + this.Agent.isMac = true; | |
689 | + return 'OS X Mountain Lion'; | |
690 | + case this._OS.OSXMavericks.test(string): | |
691 | + this.Agent.isMac = true; | |
692 | + return 'OS X Mavericks'; | |
693 | + case this._OS.OSXYosemite.test(string): | |
694 | + this.Agent.isMac = true; | |
695 | + return 'OS X Yosemite'; | |
696 | + case this._OS.OSXElCapitan.test(string): | |
697 | + this.Agent.isMac = true; | |
698 | + return 'OS X El Capitan'; | |
699 | + case this._OS.OSXSierra.test(string): | |
700 | + this.Agent.isMac = true; | |
701 | + return 'macOS Sierra'; | |
702 | + case this._OS.Mac.test(string): | |
703 | + this.Agent.isMac = true; | |
704 | + return 'OS X'; | |
705 | + case this._OS.iPad.test(string): | |
706 | + this.Agent.isiPad = true; | |
707 | + return string.match(this._OS.iPad)[0].replace('_', '.'); | |
708 | + case this._OS.iPhone.test(string): | |
709 | + this.Agent.isiPhone = true; | |
710 | + return string.match(this._OS.iPhone)[0].replace('_', '.'); | |
711 | + case this._OS.Bada.test(string): | |
712 | + this.Agent.isBada = true; | |
713 | + return 'Bada'; | |
714 | + case this._OS.Curl.test(string): | |
715 | + this.Agent.isCurl = true; | |
716 | + return 'Curl'; | |
717 | + default: | |
718 | + return 'unknown'; | |
719 | + } | |
720 | + }; | |
721 | + | |
722 | + this.getPlatform = function (string) { | |
723 | + switch (true) { | |
724 | + case this._Platform.Windows.test(string): | |
725 | + return 'Microsoft Windows'; | |
726 | + case this._Platform.WindowsPhone.test(string): | |
727 | + this.Agent.isWindowsPhone = true; | |
728 | + return 'Microsoft Windows Phone'; | |
729 | + case this._Platform.Mac.test(string): | |
730 | + return 'Apple Mac'; | |
731 | + case this._Platform.Curl.test(string): | |
732 | + return 'Curl'; | |
733 | + case this._Platform.Android.test(string): | |
734 | + this.Agent.isAndroid = true; | |
735 | + return 'Android'; | |
736 | + case this._Platform.Blackberry.test(string): | |
737 | + this.Agent.isBlackberry = true; | |
738 | + return 'Blackberry'; | |
739 | + case this._Platform.Linux.test(string): | |
740 | + return 'Linux'; | |
741 | + case this._Platform.Wii.test(string): | |
742 | + return 'Wii'; | |
743 | + case this._Platform.Playstation.test(string): | |
744 | + return 'Playstation'; | |
745 | + case this._Platform.iPad.test(string): | |
746 | + this.Agent.isiPad = true; | |
747 | + return 'iPad'; | |
748 | + case this._Platform.iPod.test(string): | |
749 | + this.Agent.isiPod = true; | |
750 | + return 'iPod'; | |
751 | + case this._Platform.iPhone.test(string): | |
752 | + this.Agent.isiPhone = true; | |
753 | + return 'iPhone'; | |
754 | + case this._Platform.Samsung.test(string): | |
755 | + this.Agent.isiSamsung = true; | |
756 | + return 'Samsung'; | |
757 | + default: | |
758 | + return 'unknown'; | |
759 | + } | |
760 | + }; | |
761 | + | |
762 | + this.testCompatibilityMode = function () { | |
763 | + var ua = this; | |
764 | + if (this.Agent.isIE) { | |
765 | + if (/Trident\/(\d)\.0/i.test(ua.Agent.source)) { | |
766 | + var tridentVersion = parseInt(RegExp.$1, 10); | |
767 | + var version = parseInt(ua.Agent.version, 10); | |
768 | + if (version === 7 && tridentVersion === 7) { | |
769 | + ua.Agent.isIECompatibilityMode = true; | |
770 | + ua.Agent.version = 11.0; | |
771 | + } | |
772 | + | |
773 | + if (version === 7 && tridentVersion === 6) { | |
774 | + ua.Agent.isIECompatibilityMode = true; | |
775 | + ua.Agent.version = 10.0; | |
776 | + } | |
777 | + | |
778 | + if (version === 7 && tridentVersion === 5) { | |
779 | + ua.Agent.isIECompatibilityMode = true; | |
780 | + ua.Agent.version = 9.0; | |
781 | + } | |
782 | + | |
783 | + if (version === 7 && tridentVersion === 4) { | |
784 | + ua.Agent.isIECompatibilityMode = true; | |
785 | + ua.Agent.version = 8.0; | |
786 | + } | |
787 | + } | |
788 | + } | |
789 | + }; | |
790 | + | |
791 | + this.testSilk = function () { | |
792 | + var ua = this; | |
793 | + switch (true) { | |
794 | + case new RegExp('silk', 'gi').test(ua.Agent.source): | |
795 | + this.Agent.isSilk = true; | |
796 | + break; | |
797 | + default: | |
798 | + } | |
799 | + | |
800 | + if (/Silk-Accelerated=true/gi.test(ua.Agent.source)) { | |
801 | + this.Agent.SilkAccelerated = true; | |
802 | + } | |
803 | + return this.Agent.isSilk ? 'Silk' : false; | |
804 | + }; | |
805 | + | |
806 | + this.testKindleFire = function () { | |
807 | + var ua = this; | |
808 | + switch (true) { | |
809 | + case /KFOT/gi.test(ua.Agent.source): | |
810 | + this.Agent.isKindleFire = true; | |
811 | + return 'Kindle Fire'; | |
812 | + case /KFTT/gi.test(ua.Agent.source): | |
813 | + this.Agent.isKindleFire = true; | |
814 | + return 'Kindle Fire HD'; | |
815 | + case /KFJWI/gi.test(ua.Agent.source): | |
816 | + this.Agent.isKindleFire = true; | |
817 | + return 'Kindle Fire HD 8.9'; | |
818 | + case /KFJWA/gi.test(ua.Agent.source): | |
819 | + this.Agent.isKindleFire = true; | |
820 | + return 'Kindle Fire HD 8.9 4G'; | |
821 | + case /KFSOWI/gi.test(ua.Agent.source): | |
822 | + this.Agent.isKindleFire = true; | |
823 | + return 'Kindle Fire HD 7'; | |
824 | + case /KFTHWI/gi.test(ua.Agent.source): | |
825 | + this.Agent.isKindleFire = true; | |
826 | + return 'Kindle Fire HDX 7'; | |
827 | + case /KFTHWA/gi.test(ua.Agent.source): | |
828 | + this.Agent.isKindleFire = true; | |
829 | + return 'Kindle Fire HDX 7 4G'; | |
830 | + case /KFAPWI/gi.test(ua.Agent.source): | |
831 | + this.Agent.isKindleFire = true; | |
832 | + return 'Kindle Fire HDX 8.9'; | |
833 | + case /KFAPWA/gi.test(ua.Agent.source): | |
834 | + this.Agent.isKindleFire = true; | |
835 | + return 'Kindle Fire HDX 8.9 4G'; | |
836 | + default: | |
837 | + return false; | |
838 | + } | |
839 | + }; | |
840 | + | |
841 | + this.testCaptiveNetwork = function () { | |
842 | + var ua = this; | |
843 | + switch (true) { | |
844 | + case /CaptiveNetwork/gi.test(ua.Agent.source): | |
845 | + ua.Agent.isCaptive = true; | |
846 | + ua.Agent.isMac = true; | |
847 | + ua.Agent.platform = 'Apple Mac'; | |
848 | + return 'CaptiveNetwork'; | |
849 | + default: | |
850 | + return false; | |
851 | + } | |
852 | + }; | |
853 | + | |
854 | + this.testMobile = function testMobile() { | |
855 | + var ua = this; | |
856 | + switch (true) { | |
857 | + case ua.Agent.isWindows: | |
858 | + case ua.Agent.isLinux: | |
859 | + case ua.Agent.isMac: | |
860 | + case ua.Agent.isChromeOS: | |
861 | + ua.Agent.isDesktop = true; | |
862 | + break; | |
863 | + case ua.Agent.isAndroid: | |
864 | + case ua.Agent.isSamsung: | |
865 | + ua.Agent.isMobile = true; | |
866 | + ua.Agent.isDesktop = false; | |
867 | + break; | |
868 | + default: | |
869 | + } | |
870 | + switch (true) { | |
871 | + case ua.Agent.isiPad: | |
872 | + case ua.Agent.isiPod: | |
873 | + case ua.Agent.isiPhone: | |
874 | + case ua.Agent.isBada: | |
875 | + case ua.Agent.isBlackberry: | |
876 | + case ua.Agent.isAndroid: | |
877 | + case ua.Agent.isWindowsPhone: | |
878 | + ua.Agent.isMobile = true; | |
879 | + ua.Agent.isDesktop = false; | |
880 | + break; | |
881 | + default: | |
882 | + } | |
883 | + if (/mobile/i.test(ua.Agent.source)) { | |
884 | + ua.Agent.isMobile = true; | |
885 | + ua.Agent.isDesktop = false; | |
886 | + } | |
887 | + }; | |
888 | + | |
889 | + this.testTablet = function testTablet() { | |
890 | + var ua = this; | |
891 | + switch (true) { | |
892 | + case ua.Agent.isiPad: | |
893 | + case ua.Agent.isAndroidTablet: | |
894 | + case ua.Agent.isKindleFire: | |
895 | + ua.Agent.isTablet = true; | |
896 | + break; | |
897 | + } | |
898 | + if (/tablet/i.test(ua.Agent.source)) { | |
899 | + ua.Agent.isTablet = true; | |
900 | + } | |
901 | + }; | |
902 | + | |
903 | + this.testNginxGeoIP = function testNginxGeoIP(headers) { | |
904 | + var ua = this; | |
905 | + Object.keys(headers).forEach(function (key) { | |
906 | + if (/^GEOIP/i.test(key)) { | |
907 | + ua.Agent.geoIp[key] = headers[key]; | |
908 | + } | |
909 | + }); | |
910 | + }; | |
911 | + | |
912 | + this.testBot = function testBot() { | |
913 | + var ua = this; | |
914 | + var isBot = IS_BOT_REGEXP.exec(ua.Agent.source.toLowerCase()); | |
915 | + if (isBot) { | |
916 | + ua.Agent.isBot = isBot[1]; | |
917 | + } else if (!ua.Agent.isAuthoritative) { | |
918 | + // Test unauthoritative parse for `bot` in UA to flag for bot | |
919 | + ua.Agent.isBot = /bot/i.test(ua.Agent.source); | |
920 | + } | |
921 | + }; | |
922 | + | |
923 | + this.testSmartTV = function testBot() { | |
924 | + var ua = this; | |
925 | + var isSmartTV = new RegExp('smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv', 'gi').exec(ua.Agent.source.toLowerCase()); | |
926 | + if (isSmartTV) { | |
927 | + ua.Agent.isSmartTV = isSmartTV[1]; | |
928 | + } | |
929 | + }; | |
930 | + | |
931 | + this.testAndroidTablet = function testAndroidTablet() { | |
932 | + var ua = this; | |
933 | + if (ua.Agent.isAndroid && !/mobile/i.test(ua.Agent.source)) { | |
934 | + ua.Agent.isAndroidTablet = true; | |
935 | + } | |
936 | + }; | |
937 | + | |
938 | + this.testTouchSupport = function () { | |
939 | + var ua = this; | |
940 | + ua.Agent.isTouchScreen = (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); | |
941 | + }; | |
942 | + | |
943 | + this.getLaguage = function () { | |
944 | + var ua = this; | |
945 | + ua.Agent.language = (navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || '').toLowerCase(); | |
946 | + }; | |
947 | + | |
948 | + this.getColorDepth = function () { | |
949 | + var ua = this; | |
950 | + ua.Agent.colorDepth = screen.colorDepth || -1; | |
951 | + }; | |
952 | + | |
953 | + this.getScreenResolution = function () { | |
954 | + var ua = this; | |
955 | + ua.Agent.resolution = [screen.availWidth, screen.availHeight]; | |
956 | + }; | |
957 | + | |
958 | + this.getPixelDepth = function () { | |
959 | + var ua = this; | |
960 | + ua.Agent.pixelDepth = screen.pixelDepth || -1; | |
961 | + }; | |
962 | + | |
963 | + this.getCPU = function () { | |
964 | + var ua = this; | |
965 | + ua.Agent.cpuCores = navigator.hardwareConcurrency || -1; | |
966 | + }; | |
967 | + | |
968 | + this.reset = function reset() { | |
969 | + var ua = this; | |
970 | + for (var key in ua.DefaultAgent) { | |
971 | + if (ua.DefaultAgent.hasOwnProperty(key)) { | |
972 | + ua.Agent[key] = ua.DefaultAgent[key]; | |
973 | + } | |
974 | + } | |
975 | + return ua; | |
976 | + }; | |
977 | + | |
978 | + this.parse = function get(source) { | |
979 | + source = source || navigator.userAgent; | |
980 | + var ua = new DeviceUUID(); | |
981 | + ua.Agent.source = source.replace(/^\s*/, '').replace(/\s*$/, ''); | |
982 | + ua.Agent.os = ua.getOS(ua.Agent.source); | |
983 | + ua.Agent.platform = ua.getPlatform(ua.Agent.source); | |
984 | + ua.Agent.browser = ua.getBrowser(ua.Agent.source); | |
985 | + ua.Agent.version = ua.getBrowserVersion(ua.Agent.source); | |
986 | + ua.testBot(); | |
987 | + ua.testSmartTV(); | |
988 | + ua.testMobile(); | |
989 | + ua.testAndroidTablet(); | |
990 | + ua.testTablet(); | |
991 | + ua.testCompatibilityMode(); | |
992 | + ua.testSilk(); | |
993 | + ua.testKindleFire(); | |
994 | + ua.testCaptiveNetwork(); | |
995 | + ua.testTouchSupport(); | |
996 | + ua.getLaguage(); | |
997 | + ua.getColorDepth(); | |
998 | + ua.getPixelDepth(); | |
999 | + ua.getScreenResolution(); | |
1000 | + ua.getCPU(); | |
1001 | + return ua.Agent; | |
1002 | + }; | |
1003 | + | |
1004 | + this.get = function (customData) { | |
1005 | + var pref = 'a', du = this.parse(); | |
1006 | + var dua = []; | |
1007 | + for (var key in this.options) { | |
1008 | + if (this.options.hasOwnProperty(key) && this.options[key] === true) { | |
1009 | + dua.push(du[key]); | |
1010 | + } | |
1011 | + } | |
1012 | + if (customData) { | |
1013 | + dua.push(customData); | |
1014 | + } | |
1015 | + if (!this.options.resolution && du.isMobile) { | |
1016 | + dua.push(du.resolution); | |
1017 | + } | |
1018 | + // 8, 9, a, b | |
1019 | + pref = 'b'; | |
1020 | + var tmpUuid = du.hashMD5(dua.join(':')); | |
1021 | + var uuid = [ | |
1022 | + tmpUuid.slice(0, 8), | |
1023 | + tmpUuid.slice(8, 12), | |
1024 | + '4' + tmpUuid.slice(12, 15), | |
1025 | + pref + tmpUuid.slice(15, 18), | |
1026 | + tmpUuid.slice(20) | |
1027 | + ]; | |
1028 | + return uuid.join('-'); | |
1029 | + }; | |
1030 | + | |
1031 | + this.Agent = this.DefaultAgent; | |
1032 | + return this; | |
1033 | + }; | |
1034 | + | |
1035 | + exports.DeviceUUID = DeviceUUID; | |
1036 | + return new DeviceUUID(navigator.userAgent); | |
1037 | + | |
1038 | +})(this); | |
\ No newline at end of file |
@@ -0,0 +1,1038 @@ | ||
1 | +/*! | |
2 | + * device-uuid.js v1.0.4 (https://github.com/biggora/device-uuid/) | |
3 | + * Copyright 2016-2017 Alexey Gordeyev | |
4 | + * Licensed under MIT (https://github.com/biggora/device-uuid/blob/master/LICENSE) | |
5 | + */ | |
6 | +/*global | |
7 | + screen, window, navigator | |
8 | + */ | |
9 | +(function (exports) { | |
10 | + 'use strict'; | |
11 | + | |
12 | + var BOTS = [ | |
13 | + '\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/', | |
14 | + 'googlebot', | |
15 | + 'baiduspider', | |
16 | + 'gurujibot', | |
17 | + 'yandexbot', | |
18 | + 'slurp', | |
19 | + 'msnbot', | |
20 | + 'bingbot', | |
21 | + 'facebookexternalhit', | |
22 | + 'linkedinbot', | |
23 | + 'twitterbot', | |
24 | + 'slackbot', | |
25 | + 'telegrambot', | |
26 | + 'applebot', | |
27 | + 'pingdom', | |
28 | + 'tumblr ', | |
29 | + 'Embedly', | |
30 | + 'spbot' | |
31 | + ]; | |
32 | + var IS_BOT_REGEXP = new RegExp('^.*(' + BOTS.join('|') + ').*$'); | |
33 | + | |
34 | + var DeviceUUID = function (options) { | |
35 | + options = options ? options : {}; | |
36 | + var defOptions = { | |
37 | + version: false, | |
38 | + language: false, | |
39 | + platform: true, | |
40 | + os: true, | |
41 | + pixelDepth: true, | |
42 | + colorDepth: true, | |
43 | + resolution: false, | |
44 | + isAuthoritative: true, | |
45 | + silkAccelerated: true, | |
46 | + isKindleFire: true, | |
47 | + isDesktop: true, | |
48 | + isMobile: true, | |
49 | + isTablet: true, | |
50 | + isWindows: true, | |
51 | + isLinux: true, | |
52 | + isLinux64: true, | |
53 | + isChromeOS: true, | |
54 | + isMac: true, | |
55 | + isiPad: true, | |
56 | + isiPhone: true, | |
57 | + isiPod: true, | |
58 | + isAndroid: true, | |
59 | + isSamsung: true, | |
60 | + isSmartTV: true, | |
61 | + isRaspberry: true, | |
62 | + isBlackberry: true, | |
63 | + isTouchScreen: true, | |
64 | + isOpera: false, | |
65 | + isIE: false, | |
66 | + isEdge: false, | |
67 | + isIECompatibilityMode: false, | |
68 | + isSafari: false, | |
69 | + isFirefox: false, | |
70 | + isWebkit: false, | |
71 | + isChrome: false, | |
72 | + isKonqueror: false, | |
73 | + isOmniWeb: false, | |
74 | + isSeaMonkey: false, | |
75 | + isFlock: false, | |
76 | + isAmaya: false, | |
77 | + isPhantomJS: false, | |
78 | + isEpiphany: false, | |
79 | + source: false, | |
80 | + cpuCores: false | |
81 | + }; | |
82 | + for (var key in options) { | |
83 | + if (options.hasOwnProperty(key) && typeof defOptions[key] !== 'undefined') { | |
84 | + defOptions[key] = options[key]; | |
85 | + } | |
86 | + } | |
87 | + this.options = defOptions; | |
88 | + this.version = '1.0.0'; | |
89 | + this._Versions = { | |
90 | + Edge: /Edge\/([\d\w\.\-]+)/i, | |
91 | + Firefox: /firefox\/([\d\w\.\-]+)/i, | |
92 | + IE: /msie\s([\d\.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i, | |
93 | + Chrome: /chrome\/([\d\w\.\-]+)/i, | |
94 | + Chromium: /(?:chromium|crios)\/([\d\w\.\-]+)/i, | |
95 | + Safari: /version\/([\d\w\.\-]+)/i, | |
96 | + Opera: /version\/([\d\w\.\-]+)|OPR\/([\d\w\.\-]+)/i, | |
97 | + Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
98 | + Psp: /([\d\w\.\-]+)\)?\s*$/i, | |
99 | + Amaya: /amaya\/([\d\w\.\-]+)/i, | |
100 | + SeaMonkey: /seamonkey\/([\d\w\.\-]+)/i, | |
101 | + OmniWeb: /omniweb\/v([\d\w\.\-]+)/i, | |
102 | + Flock: /flock\/([\d\w\.\-]+)/i, | |
103 | + Epiphany: /epiphany\/([\d\w\.\-]+)/i, | |
104 | + WinJs: /msapphost\/([\d\w\.\-]+)/i, | |
105 | + PhantomJS: /phantomjs\/([\d\w\.\-]+)/i, | |
106 | + UC: /UCBrowser\/([\d\w\.]+)/i | |
107 | + }; | |
108 | + this._Browsers = { | |
109 | + Edge: /edge/i, | |
110 | + Amaya: /amaya/i, | |
111 | + Konqueror: /konqueror/i, | |
112 | + Epiphany: /epiphany/i, | |
113 | + SeaMonkey: /seamonkey/i, | |
114 | + Flock: /flock/i, | |
115 | + OmniWeb: /omniweb/i, | |
116 | + Chromium: /chromium|crios/i, | |
117 | + Chrome: /chrome/i, | |
118 | + Safari: /safari/i, | |
119 | + IE: /msie|trident/i, | |
120 | + Opera: /opera|OPR/i, | |
121 | + PS3: /playstation 3/i, | |
122 | + PSP: /playstation portable/i, | |
123 | + Firefox: /firefox/i, | |
124 | + WinJs: /msapphost/i, | |
125 | + PhantomJS: /phantomjs/i, | |
126 | + UC: /UCBrowser/i | |
127 | + }; | |
128 | + this._OS = { | |
129 | + Windows10: /windows nt 10\.0/i, | |
130 | + Windows81: /windows nt 6\.3/i, | |
131 | + Windows8: /windows nt 6\.2/i, | |
132 | + Windows7: /windows nt 6\.1/i, | |
133 | + UnknownWindows: /windows nt 6\.\d+/i, | |
134 | + WindowsVista: /windows nt 6\.0/i, | |
135 | + Windows2003: /windows nt 5\.2/i, | |
136 | + WindowsXP: /windows nt 5\.1/i, | |
137 | + Windows2000: /windows nt 5\.0/i, | |
138 | + WindowsPhone8: /windows phone 8\./, | |
139 | + OSXCheetah: /os x 10[._]0/i, | |
140 | + OSXPuma: /os x 10[._]1(\D|$)/i, | |
141 | + OSXJaguar: /os x 10[._]2/i, | |
142 | + OSXPanther: /os x 10[._]3/i, | |
143 | + OSXTiger: /os x 10[._]4/i, | |
144 | + OSXLeopard: /os x 10[._]5/i, | |
145 | + OSXSnowLeopard: /os x 10[._]6/i, | |
146 | + OSXLion: /os x 10[._]7/i, | |
147 | + OSXMountainLion: /os x 10[._]8/i, | |
148 | + OSXMavericks: /os x 10[._]9/i, | |
149 | + OSXYosemite: /os x 10[._]10/i, | |
150 | + OSXElCapitan: /os x 10[._]11/i, | |
151 | + OSXSierra: /os x 10[._]12/i, | |
152 | + Mac: /os x/i, | |
153 | + Linux: /linux/i, | |
154 | + Linux64: /linux x86_64/i, | |
155 | + ChromeOS: /cros/i, | |
156 | + Wii: /wii/i, | |
157 | + PS3: /playstation 3/i, | |
158 | + PSP: /playstation portable/i, | |
159 | + iPad: /\(iPad.*os (\d+)[._](\d+)/i, | |
160 | + iPhone: /\(iPhone.*os (\d+)[._](\d+)/i, | |
161 | + Bada: /Bada\/(\d+)\.(\d+)/i, | |
162 | + Curl: /curl\/(\d+)\.(\d+)\.(\d+)/i | |
163 | + }; | |
164 | + this._Platform = { | |
165 | + Windows: /windows nt/i, | |
166 | + WindowsPhone: /windows phone/i, | |
167 | + Mac: /macintosh/i, | |
168 | + Linux: /linux/i, | |
169 | + Wii: /wii/i, | |
170 | + Playstation: /playstation/i, | |
171 | + iPad: /ipad/i, | |
172 | + iPod: /ipod/i, | |
173 | + iPhone: /iphone/i, | |
174 | + Android: /android/i, | |
175 | + Blackberry: /blackberry/i, | |
176 | + Samsung: /samsung/i, | |
177 | + Curl: /curl/i | |
178 | + }; | |
179 | + | |
180 | + this.DefaultAgent = { | |
181 | + isAuthoritative: true, | |
182 | + isMobile: false, | |
183 | + isTablet: false, | |
184 | + isiPad: false, | |
185 | + isiPod: false, | |
186 | + isiPhone: false, | |
187 | + isAndroid: false, | |
188 | + isBlackberry: false, | |
189 | + isOpera: false, | |
190 | + isIE: false, | |
191 | + isEdge: false, | |
192 | + isIECompatibilityMode: false, | |
193 | + isSafari: false, | |
194 | + isFirefox: false, | |
195 | + isWebkit: false, | |
196 | + isChrome: false, | |
197 | + isKonqueror: false, | |
198 | + isOmniWeb: false, | |
199 | + isSeaMonkey: false, | |
200 | + isFlock: false, | |
201 | + isAmaya: false, | |
202 | + isPhantomJS: false, | |
203 | + isEpiphany: false, | |
204 | + isDesktop: false, | |
205 | + isWindows: false, | |
206 | + isLinux: false, | |
207 | + isLinux64: false, | |
208 | + isMac: false, | |
209 | + isChromeOS: false, | |
210 | + isBada: false, | |
211 | + isSamsung: false, | |
212 | + isRaspberry: false, | |
213 | + isBot: false, | |
214 | + isCurl: false, | |
215 | + isAndroidTablet: false, | |
216 | + isWinJs: false, | |
217 | + isKindleFire: false, | |
218 | + isSilk: false, | |
219 | + isCaptive: false, | |
220 | + isSmartTV: false, | |
221 | + isUC: false, | |
222 | + isTouchScreen: false, | |
223 | + silkAccelerated: false, | |
224 | + colorDepth: -1, | |
225 | + pixelDepth: -1, | |
226 | + resolution: [], | |
227 | + cpuCores: -1, | |
228 | + language: 'unknown', | |
229 | + browser: 'unknown', | |
230 | + version: 'unknown', | |
231 | + os: 'unknown', | |
232 | + platform: 'unknown', | |
233 | + geoIp: {}, | |
234 | + source: '', | |
235 | + hashInt: function (string) { | |
236 | + var hash = 0, i, chr, len; | |
237 | + if (string.length === 0) { return hash; } | |
238 | + for (i = 0, len = string.length; i < len; i++) { | |
239 | + chr = string.charCodeAt(i); | |
240 | + hash = ((hash << 5) - hash) + chr; | |
241 | + hash |= 0; | |
242 | + } | |
243 | + return hash; | |
244 | + }, | |
245 | + hashMD5: function (string) { | |
246 | + function rotateLeft(lValue, iShiftBits) { | |
247 | + return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); | |
248 | + } | |
249 | + | |
250 | + function addUnsigned(lX, lY) { | |
251 | + var lX4, lY4, lX8, lY8, lResult; | |
252 | + lX8 = (lX & 0x80000000); | |
253 | + lY8 = (lY & 0x80000000); | |
254 | + lX4 = (lX & 0x40000000); | |
255 | + lY4 = (lY & 0x40000000); | |
256 | + lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); | |
257 | + | |
258 | + if (lX4 & lY4) { | |
259 | + return (lResult ^ 0x80000000 ^ lX8 ^ lY8); | |
260 | + } | |
261 | + if (lX4 | lY4) { | |
262 | + if (lResult & 0x40000000) { | |
263 | + return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); | |
264 | + } else { | |
265 | + return (lResult ^ 0x40000000 ^ lX8 ^ lY8); | |
266 | + } | |
267 | + } else { | |
268 | + return (lResult ^ lX8 ^ lY8); | |
269 | + } | |
270 | + } | |
271 | + | |
272 | + function gF(x, y, z) { | |
273 | + return (x & y) | ((~x) & z); | |
274 | + } | |
275 | + | |
276 | + function gG(x, y, z) { | |
277 | + return (x & z) | (y & (~z)); | |
278 | + } | |
279 | + | |
280 | + function gH(x, y, z) { | |
281 | + return (x ^ y ^ z); | |
282 | + } | |
283 | + | |
284 | + function gI(x, y, z) { | |
285 | + return (y ^ (x | (~z))); | |
286 | + } | |
287 | + | |
288 | + function gFF(a, b, c, d, x, s, ac) { | |
289 | + a = addUnsigned(a, addUnsigned(addUnsigned(gF(b, c, d), x), ac)); | |
290 | + return addUnsigned(rotateLeft(a, s), b); | |
291 | + } | |
292 | + | |
293 | + function gGG(a, b, c, d, x, s, ac) { | |
294 | + a = addUnsigned(a, addUnsigned(addUnsigned(gG(b, c, d), x), ac)); | |
295 | + return addUnsigned(rotateLeft(a, s), b); | |
296 | + } | |
297 | + | |
298 | + function gHH(a, b, c, d, x, s, ac) { | |
299 | + a = addUnsigned(a, addUnsigned(addUnsigned(gH(b, c, d), x), ac)); | |
300 | + return addUnsigned(rotateLeft(a, s), b); | |
301 | + } | |
302 | + | |
303 | + function gII(a, b, c, d, x, s, ac) { | |
304 | + a = addUnsigned(a, addUnsigned(addUnsigned(gI(b, c, d), x), ac)); | |
305 | + return addUnsigned(rotateLeft(a, s), b); | |
306 | + } | |
307 | + | |
308 | + function convertToWordArray(string) { | |
309 | + var lWordCount; | |
310 | + var lMessageLength = string.length; | |
311 | + var lNumberOfWordsTemp1 = lMessageLength + 8; | |
312 | + var lNumberOfWordsTemp2 = (lNumberOfWordsTemp1 - (lNumberOfWordsTemp1 % 64)) / 64; | |
313 | + var lNumberOfWords = (lNumberOfWordsTemp2 + 1) * 16; | |
314 | + var lWordArray = new Array(lNumberOfWords - 1); | |
315 | + var lBytePosition = 0; | |
316 | + var lByteCount = 0; | |
317 | + | |
318 | + while (lByteCount < lMessageLength) { | |
319 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
320 | + lBytePosition = (lByteCount % 4) * 8; | |
321 | + lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); | |
322 | + lByteCount++; | |
323 | + } | |
324 | + | |
325 | + lWordCount = (lByteCount - (lByteCount % 4)) / 4; | |
326 | + lBytePosition = (lByteCount % 4) * 8; | |
327 | + lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); | |
328 | + lWordArray[lNumberOfWords - 2] = lMessageLength << 3; | |
329 | + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; | |
330 | + return lWordArray; | |
331 | + } | |
332 | + | |
333 | + function wordToHex(lValue) { | |
334 | + var wordToHexValue = '', wordToHexValueTemp = '', lByte, lCount; | |
335 | + for (lCount = 0; lCount <= 3; lCount++) { | |
336 | + lByte = (lValue >>> (lCount * 8)) & 255; | |
337 | + wordToHexValueTemp = '0' + lByte.toString(16); | |
338 | + wordToHexValue = wordToHexValue + wordToHexValueTemp.substr(wordToHexValueTemp.length - 2, 2); | |
339 | + } | |
340 | + return wordToHexValue; | |
341 | + } | |
342 | + | |
343 | + function utf8Encode(string) { | |
344 | + string = string.replace(/\r\n/g, '\n'); | |
345 | + var utftext = ''; | |
346 | + | |
347 | + for (var n = 0; n < string.length; n++) { | |
348 | + var c = string.charCodeAt(n); | |
349 | + if (c < 128) { | |
350 | + utftext += String.fromCharCode(c); | |
351 | + } else if ((c > 127) && (c < 2048)) { | |
352 | + utftext += String.fromCharCode((c >> 6) | 192); | |
353 | + utftext += String.fromCharCode((c & 63) | 128); | |
354 | + } else { | |
355 | + utftext += String.fromCharCode((c >> 12) | 224); | |
356 | + utftext += String.fromCharCode(((c >> 6) & 63) | 128); | |
357 | + utftext += String.fromCharCode((c & 63) | 128); | |
358 | + } | |
359 | + } | |
360 | + return utftext; | |
361 | + } | |
362 | + | |
363 | + var x = []; | |
364 | + var k, AA, BB, CC, DD, a, b, c, d; | |
365 | + var S11 = 7, S12 = 12, S13 = 17, S14 = 22; | |
366 | + var S21 = 5, S22 = 9, S23 = 14, S24 = 20; | |
367 | + var S31 = 4, S32 = 11, S33 = 16, S34 = 23; | |
368 | + var S41 = 6, S42 = 10, S43 = 15, S44 = 21; | |
369 | + string = utf8Encode(string); | |
370 | + x = convertToWordArray(string); | |
371 | + a = 0x67452301; | |
372 | + b = 0xEFCDAB89; | |
373 | + c = 0x98BADCFE; | |
374 | + d = 0x10325476; | |
375 | + | |
376 | + for (k = 0; k < x.length; k += 16) { | |
377 | + AA = a; | |
378 | + BB = b; | |
379 | + CC = c; | |
380 | + DD = d; | |
381 | + a = gFF(a, b, c, d, x[k + 0], S11, 0xD76AA478); | |
382 | + d = gFF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); | |
383 | + c = gFF(c, d, a, b, x[k + 2], S13, 0x242070DB); | |
384 | + b = gFF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); | |
385 | + a = gFF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); | |
386 | + d = gFF(d, a, b, c, x[k + 5], S12, 0x4787C62A); | |
387 | + c = gFF(c, d, a, b, x[k + 6], S13, 0xA8304613); | |
388 | + b = gFF(b, c, d, a, x[k + 7], S14, 0xFD469501); | |
389 | + a = gFF(a, b, c, d, x[k + 8], S11, 0x698098D8); | |
390 | + d = gFF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); | |
391 | + c = gFF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); | |
392 | + b = gFF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); | |
393 | + a = gFF(a, b, c, d, x[k + 12], S11, 0x6B901122); | |
394 | + d = gFF(d, a, b, c, x[k + 13], S12, 0xFD987193); | |
395 | + c = gFF(c, d, a, b, x[k + 14], S13, 0xA679438E); | |
396 | + b = gFF(b, c, d, a, x[k + 15], S14, 0x49B40821); | |
397 | + a = gGG(a, b, c, d, x[k + 1], S21, 0xF61E2562); | |
398 | + d = gGG(d, a, b, c, x[k + 6], S22, 0xC040B340); | |
399 | + c = gGG(c, d, a, b, x[k + 11], S23, 0x265E5A51); | |
400 | + b = gGG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); | |
401 | + a = gGG(a, b, c, d, x[k + 5], S21, 0xD62F105D); | |
402 | + d = gGG(d, a, b, c, x[k + 10], S22, 0x2441453); | |
403 | + c = gGG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); | |
404 | + b = gGG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); | |
405 | + a = gGG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); | |
406 | + d = gGG(d, a, b, c, x[k + 14], S22, 0xC33707D6); | |
407 | + c = gGG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); | |
408 | + b = gGG(b, c, d, a, x[k + 8], S24, 0x455A14ED); | |
409 | + a = gGG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); | |
410 | + d = gGG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); | |
411 | + c = gGG(c, d, a, b, x[k + 7], S23, 0x676F02D9); | |
412 | + b = gGG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); | |
413 | + a = gHH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); | |
414 | + d = gHH(d, a, b, c, x[k + 8], S32, 0x8771F681); | |
415 | + c = gHH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); | |
416 | + b = gHH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); | |
417 | + a = gHH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); | |
418 | + d = gHH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); | |
419 | + c = gHH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); | |
420 | + b = gHH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); | |
421 | + a = gHH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); | |
422 | + d = gHH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); | |
423 | + c = gHH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); | |
424 | + b = gHH(b, c, d, a, x[k + 6], S34, 0x4881D05); | |
425 | + a = gHH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); | |
426 | + d = gHH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); | |
427 | + c = gHH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); | |
428 | + b = gHH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); | |
429 | + a = gII(a, b, c, d, x[k + 0], S41, 0xF4292244); | |
430 | + d = gII(d, a, b, c, x[k + 7], S42, 0x432AFF97); | |
431 | + c = gII(c, d, a, b, x[k + 14], S43, 0xAB9423A7); | |
432 | + b = gII(b, c, d, a, x[k + 5], S44, 0xFC93A039); | |
433 | + a = gII(a, b, c, d, x[k + 12], S41, 0x655B59C3); | |
434 | + d = gII(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); | |
435 | + c = gII(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); | |
436 | + b = gII(b, c, d, a, x[k + 1], S44, 0x85845DD1); | |
437 | + a = gII(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); | |
438 | + d = gII(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); | |
439 | + c = gII(c, d, a, b, x[k + 6], S43, 0xA3014314); | |
440 | + b = gII(b, c, d, a, x[k + 13], S44, 0x4E0811A1); | |
441 | + a = gII(a, b, c, d, x[k + 4], S41, 0xF7537E82); | |
442 | + d = gII(d, a, b, c, x[k + 11], S42, 0xBD3AF235); | |
443 | + c = gII(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); | |
444 | + b = gII(b, c, d, a, x[k + 9], S44, 0xEB86D391); | |
445 | + a = addUnsigned(a, AA); | |
446 | + b = addUnsigned(b, BB); | |
447 | + c = addUnsigned(c, CC); | |
448 | + d = addUnsigned(d, DD); | |
449 | + } | |
450 | + var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); | |
451 | + return temp.toLowerCase(); | |
452 | + } | |
453 | + }; | |
454 | + | |
455 | + this.Agent = {}; | |
456 | + | |
457 | + this.getBrowser = function (string) { | |
458 | + switch (true) { | |
459 | + case this._Browsers.Edge.test(string): | |
460 | + this.Agent.isEdge = true; | |
461 | + return 'Edge'; | |
462 | + case this._Browsers.PhantomJS.test(string): | |
463 | + this.Agent.isPhantomJS = true; | |
464 | + return 'PhantomJS'; | |
465 | + case this._Browsers.Konqueror.test(string): | |
466 | + this.Agent.isKonqueror = true; | |
467 | + return 'Konqueror'; | |
468 | + case this._Browsers.Amaya.test(string): | |
469 | + this.Agent.isAmaya = true; | |
470 | + return 'Amaya'; | |
471 | + case this._Browsers.Epiphany.test(string): | |
472 | + this.Agent.isEpiphany = true; | |
473 | + return 'Epiphany'; | |
474 | + case this._Browsers.SeaMonkey.test(string): | |
475 | + this.Agent.isSeaMonkey = true; | |
476 | + return 'SeaMonkey'; | |
477 | + case this._Browsers.Flock.test(string): | |
478 | + this.Agent.isFlock = true; | |
479 | + return 'Flock'; | |
480 | + case this._Browsers.OmniWeb.test(string): | |
481 | + this.Agent.isOmniWeb = true; | |
482 | + return 'OmniWeb'; | |
483 | + case this._Browsers.Opera.test(string): | |
484 | + this.Agent.isOpera = true; | |
485 | + return 'Opera'; | |
486 | + case this._Browsers.Chromium.test(string): | |
487 | + this.Agent.isChrome = true; | |
488 | + return 'Chromium'; | |
489 | + case this._Browsers.Chrome.test(string): | |
490 | + this.Agent.isChrome = true; | |
491 | + return 'Chrome'; | |
492 | + case this._Browsers.Safari.test(string): | |
493 | + this.Agent.isSafari = true; | |
494 | + return 'Safari'; | |
495 | + case this._Browsers.WinJs.test(string): | |
496 | + this.Agent.isWinJs = true; | |
497 | + return 'WinJs'; | |
498 | + case this._Browsers.IE.test(string): | |
499 | + this.Agent.isIE = true; | |
500 | + return 'IE'; | |
501 | + case this._Browsers.PS3.test(string): | |
502 | + return 'ps3'; | |
503 | + case this._Browsers.PSP.test(string): | |
504 | + return 'psp'; | |
505 | + case this._Browsers.Firefox.test(string): | |
506 | + this.Agent.isFirefox = true; | |
507 | + return 'Firefox'; | |
508 | + case this._Browsers.UC.test(string): | |
509 | + this.Agent.isUC = true; | |
510 | + return 'UCBrowser'; | |
511 | + default: | |
512 | + // If the UA does not start with Mozilla guess the user agent. | |
513 | + if (string.indexOf('Mozilla') !== 0 && /^([\d\w\-\.]+)\/[\d\w\.\-]+/i.test(string)) { | |
514 | + this.Agent.isAuthoritative = false; | |
515 | + return RegExp.$1; | |
516 | + } | |
517 | + return 'unknown'; | |
518 | + } | |
519 | + }; | |
520 | + | |
521 | + this.getBrowserVersion = function (string) { | |
522 | + var regex; | |
523 | + switch (this.Agent.browser) { | |
524 | + case 'Edge': | |
525 | + if (this._Versions.Edge.test(string)) { | |
526 | + return RegExp.$1; | |
527 | + } | |
528 | + break; | |
529 | + case 'PhantomJS': | |
530 | + if (this._Versions.PhantomJS.test(string)) { | |
531 | + return RegExp.$1; | |
532 | + } | |
533 | + break; | |
534 | + case 'Chrome': | |
535 | + if (this._Versions.Chrome.test(string)) { | |
536 | + return RegExp.$1; | |
537 | + } | |
538 | + break; | |
539 | + case 'Chromium': | |
540 | + if (this._Versions.Chromium.test(string)) { | |
541 | + return RegExp.$1; | |
542 | + } | |
543 | + break; | |
544 | + case 'Safari': | |
545 | + if (this._Versions.Safari.test(string)) { | |
546 | + return RegExp.$1; | |
547 | + } | |
548 | + break; | |
549 | + case 'Opera': | |
550 | + if (this._Versions.Opera.test(string)) { | |
551 | + return RegExp.$1 ? RegExp.$1 : RegExp.$2; | |
552 | + } | |
553 | + break; | |
554 | + case 'Firefox': | |
555 | + if (this._Versions.Firefox.test(string)) { | |
556 | + return RegExp.$1; | |
557 | + } | |
558 | + break; | |
559 | + case 'WinJs': | |
560 | + if (this._Versions.WinJs.test(string)) { | |
561 | + return RegExp.$1; | |
562 | + } | |
563 | + break; | |
564 | + case 'IE': | |
565 | + if (this._Versions.IE.test(string)) { | |
566 | + return RegExp.$2 ? RegExp.$2 : RegExp.$1; | |
567 | + } | |
568 | + break; | |
569 | + case 'ps3': | |
570 | + if (this._Versions.Ps3.test(string)) { | |
571 | + return RegExp.$1; | |
572 | + } | |
573 | + break; | |
574 | + case 'psp': | |
575 | + if (this._Versions.Psp.test(string)) { | |
576 | + return RegExp.$1; | |
577 | + } | |
578 | + break; | |
579 | + case 'Amaya': | |
580 | + if (this._Versions.Amaya.test(string)) { | |
581 | + return RegExp.$1; | |
582 | + } | |
583 | + break; | |
584 | + case 'Epiphany': | |
585 | + if (this._Versions.Epiphany.test(string)) { | |
586 | + return RegExp.$1; | |
587 | + } | |
588 | + break; | |
589 | + case 'SeaMonkey': | |
590 | + if (this._Versions.SeaMonkey.test(string)) { | |
591 | + return RegExp.$1; | |
592 | + } | |
593 | + break; | |
594 | + case 'Flock': | |
595 | + if (this._Versions.Flock.test(string)) { | |
596 | + return RegExp.$1; | |
597 | + } | |
598 | + break; | |
599 | + case 'OmniWeb': | |
600 | + if (this._Versions.OmniWeb.test(string)) { | |
601 | + return RegExp.$1; | |
602 | + } | |
603 | + break; | |
604 | + case 'UCBrowser': | |
605 | + if (this._Versions.UC.test(string)) { | |
606 | + return RegExp.$1; | |
607 | + } | |
608 | + break; | |
609 | + default: | |
610 | + if (this.Agent.browser !== 'unknown') { | |
611 | + regex = new RegExp(this.Agent.browser + '[\\/ ]([\\d\\w\\.\\-]+)', 'i'); | |
612 | + if (regex.test(string)) { | |
613 | + return RegExp.$1; | |
614 | + } | |
615 | + } | |
616 | + } | |
617 | + }; | |
618 | + | |
619 | + this.getOS = function (string) { | |
620 | + switch (true) { | |
621 | + case this._OS.WindowsVista.test(string): | |
622 | + this.Agent.isWindows = true; | |
623 | + return 'Windows Vista'; | |
624 | + case this._OS.Windows7.test(string): | |
625 | + this.Agent.isWindows = true; | |
626 | + return 'Windows 7'; | |
627 | + case this._OS.Windows8.test(string): | |
628 | + this.Agent.isWindows = true; | |
629 | + return 'Windows 8'; | |
630 | + case this._OS.Windows81.test(string): | |
631 | + this.Agent.isWindows = true; | |
632 | + return 'Windows 8.1'; | |
633 | + case this._OS.Windows10.test(string): | |
634 | + this.Agent.isWindows = true; | |
635 | + return 'Windows 10.0'; | |
636 | + case this._OS.Windows2003.test(string): | |
637 | + this.Agent.isWindows = true; | |
638 | + return 'Windows 2003'; | |
639 | + case this._OS.WindowsXP.test(string): | |
640 | + this.Agent.isWindows = true; | |
641 | + return 'Windows XP'; | |
642 | + case this._OS.Windows2000.test(string): | |
643 | + this.Agent.isWindows = true; | |
644 | + return 'Windows 2000'; | |
645 | + case this._OS.WindowsPhone8.test(string): | |
646 | + return 'Windows Phone 8'; | |
647 | + case this._OS.Linux64.test(string): | |
648 | + this.Agent.isLinux = true; | |
649 | + this.Agent.isLinux64 = true; | |
650 | + return 'Linux 64'; | |
651 | + case this._OS.Linux.test(string): | |
652 | + this.Agent.isLinux = true; | |
653 | + return 'Linux'; | |
654 | + case this._OS.ChromeOS.test(string): | |
655 | + this.Agent.isChromeOS = true; | |
656 | + return 'Chrome OS'; | |
657 | + case this._OS.Wii.test(string): | |
658 | + return 'Wii'; | |
659 | + case this._OS.PS3.test(string): | |
660 | + return 'Playstation'; | |
661 | + case this._OS.PSP.test(string): | |
662 | + return 'Playstation'; | |
663 | + case this._OS.OSXCheetah.test(string): | |
664 | + this.Agent.isMac = true; | |
665 | + return 'OS X Cheetah'; | |
666 | + case this._OS.OSXPuma.test(string): | |
667 | + this.Agent.isMac = true; | |
668 | + return 'OS X Puma'; | |
669 | + case this._OS.OSXJaguar.test(string): | |
670 | + this.Agent.isMac = true; | |
671 | + return 'OS X Jaguar'; | |
672 | + case this._OS.OSXPanther.test(string): | |
673 | + this.Agent.isMac = true; | |
674 | + return 'OS X Panther'; | |
675 | + case this._OS.OSXTiger.test(string): | |
676 | + this.Agent.isMac = true; | |
677 | + return 'OS X Tiger'; | |
678 | + case this._OS.OSXLeopard.test(string): | |
679 | + this.Agent.isMac = true; | |
680 | + return 'OS X Leopard'; | |
681 | + case this._OS.OSXSnowLeopard.test(string): | |
682 | + this.Agent.isMac = true; | |
683 | + return 'OS X Snow Leopard'; | |
684 | + case this._OS.OSXLion.test(string): | |
685 | + this.Agent.isMac = true; | |
686 | + return 'OS X Lion'; | |
687 | + case this._OS.OSXMountainLion.test(string): | |
688 | + this.Agent.isMac = true; | |
689 | + return 'OS X Mountain Lion'; | |
690 | + case this._OS.OSXMavericks.test(string): | |
691 | + this.Agent.isMac = true; | |
692 | + return 'OS X Mavericks'; | |
693 | + case this._OS.OSXYosemite.test(string): | |
694 | + this.Agent.isMac = true; | |
695 | + return 'OS X Yosemite'; | |
696 | + case this._OS.OSXElCapitan.test(string): | |
697 | + this.Agent.isMac = true; | |
698 | + return 'OS X El Capitan'; | |
699 | + case this._OS.OSXSierra.test(string): | |
700 | + this.Agent.isMac = true; | |
701 | + return 'macOS Sierra'; | |
702 | + case this._OS.Mac.test(string): | |
703 | + this.Agent.isMac = true; | |
704 | + return 'OS X'; | |
705 | + case this._OS.iPad.test(string): | |
706 | + this.Agent.isiPad = true; | |
707 | + return string.match(this._OS.iPad)[0].replace('_', '.'); | |
708 | + case this._OS.iPhone.test(string): | |
709 | + this.Agent.isiPhone = true; | |
710 | + return string.match(this._OS.iPhone)[0].replace('_', '.'); | |
711 | + case this._OS.Bada.test(string): | |
712 | + this.Agent.isBada = true; | |
713 | + return 'Bada'; | |
714 | + case this._OS.Curl.test(string): | |
715 | + this.Agent.isCurl = true; | |
716 | + return 'Curl'; | |
717 | + default: | |
718 | + return 'unknown'; | |
719 | + } | |
720 | + }; | |
721 | + | |
722 | + this.getPlatform = function (string) { | |
723 | + switch (true) { | |
724 | + case this._Platform.Windows.test(string): | |
725 | + return 'Microsoft Windows'; | |
726 | + case this._Platform.WindowsPhone.test(string): | |
727 | + this.Agent.isWindowsPhone = true; | |
728 | + return 'Microsoft Windows Phone'; | |
729 | + case this._Platform.Mac.test(string): | |
730 | + return 'Apple Mac'; | |
731 | + case this._Platform.Curl.test(string): | |
732 | + return 'Curl'; | |
733 | + case this._Platform.Android.test(string): | |
734 | + this.Agent.isAndroid = true; | |
735 | + return 'Android'; | |
736 | + case this._Platform.Blackberry.test(string): | |
737 | + this.Agent.isBlackberry = true; | |
738 | + return 'Blackberry'; | |
739 | + case this._Platform.Linux.test(string): | |
740 | + return 'Linux'; | |
741 | + case this._Platform.Wii.test(string): | |
742 | + return 'Wii'; | |
743 | + case this._Platform.Playstation.test(string): | |
744 | + return 'Playstation'; | |
745 | + case this._Platform.iPad.test(string): | |
746 | + this.Agent.isiPad = true; | |
747 | + return 'iPad'; | |
748 | + case this._Platform.iPod.test(string): | |
749 | + this.Agent.isiPod = true; | |
750 | + return 'iPod'; | |
751 | + case this._Platform.iPhone.test(string): | |
752 | + this.Agent.isiPhone = true; | |
753 | + return 'iPhone'; | |
754 | + case this._Platform.Samsung.test(string): | |
755 | + this.Agent.isiSamsung = true; | |
756 | + return 'Samsung'; | |
757 | + default: | |
758 | + return 'unknown'; | |
759 | + } | |
760 | + }; | |
761 | + | |
762 | + this.testCompatibilityMode = function () { | |
763 | + var ua = this; | |
764 | + if (this.Agent.isIE) { | |
765 | + if (/Trident\/(\d)\.0/i.test(ua.Agent.source)) { | |
766 | + var tridentVersion = parseInt(RegExp.$1, 10); | |
767 | + var version = parseInt(ua.Agent.version, 10); | |
768 | + if (version === 7 && tridentVersion === 7) { | |
769 | + ua.Agent.isIECompatibilityMode = true; | |
770 | + ua.Agent.version = 11.0; | |
771 | + } | |
772 | + | |
773 | + if (version === 7 && tridentVersion === 6) { | |
774 | + ua.Agent.isIECompatibilityMode = true; | |
775 | + ua.Agent.version = 10.0; | |
776 | + } | |
777 | + | |
778 | + if (version === 7 && tridentVersion === 5) { | |
779 | + ua.Agent.isIECompatibilityMode = true; | |
780 | + ua.Agent.version = 9.0; | |
781 | + } | |
782 | + | |
783 | + if (version === 7 && tridentVersion === 4) { | |
784 | + ua.Agent.isIECompatibilityMode = true; | |
785 | + ua.Agent.version = 8.0; | |
786 | + } | |
787 | + } | |
788 | + } | |
789 | + }; | |
790 | + | |
791 | + this.testSilk = function () { | |
792 | + var ua = this; | |
793 | + switch (true) { | |
794 | + case new RegExp('silk', 'gi').test(ua.Agent.source): | |
795 | + this.Agent.isSilk = true; | |
796 | + break; | |
797 | + default: | |
798 | + } | |
799 | + | |
800 | + if (/Silk-Accelerated=true/gi.test(ua.Agent.source)) { | |
801 | + this.Agent.SilkAccelerated = true; | |
802 | + } | |
803 | + return this.Agent.isSilk ? 'Silk' : false; | |
804 | + }; | |
805 | + | |
806 | + this.testKindleFire = function () { | |
807 | + var ua = this; | |
808 | + switch (true) { | |
809 | + case /KFOT/gi.test(ua.Agent.source): | |
810 | + this.Agent.isKindleFire = true; | |
811 | + return 'Kindle Fire'; | |
812 | + case /KFTT/gi.test(ua.Agent.source): | |
813 | + this.Agent.isKindleFire = true; | |
814 | + return 'Kindle Fire HD'; | |
815 | + case /KFJWI/gi.test(ua.Agent.source): | |
816 | + this.Agent.isKindleFire = true; | |
817 | + return 'Kindle Fire HD 8.9'; | |
818 | + case /KFJWA/gi.test(ua.Agent.source): | |
819 | + this.Agent.isKindleFire = true; | |
820 | + return 'Kindle Fire HD 8.9 4G'; | |
821 | + case /KFSOWI/gi.test(ua.Agent.source): | |
822 | + this.Agent.isKindleFire = true; | |
823 | + return 'Kindle Fire HD 7'; | |
824 | + case /KFTHWI/gi.test(ua.Agent.source): | |
825 | + this.Agent.isKindleFire = true; | |
826 | + return 'Kindle Fire HDX 7'; | |
827 | + case /KFTHWA/gi.test(ua.Agent.source): | |
828 | + this.Agent.isKindleFire = true; | |
829 | + return 'Kindle Fire HDX 7 4G'; | |
830 | + case /KFAPWI/gi.test(ua.Agent.source): | |
831 | + this.Agent.isKindleFire = true; | |
832 | + return 'Kindle Fire HDX 8.9'; | |
833 | + case /KFAPWA/gi.test(ua.Agent.source): | |
834 | + this.Agent.isKindleFire = true; | |
835 | + return 'Kindle Fire HDX 8.9 4G'; | |
836 | + default: | |
837 | + return false; | |
838 | + } | |
839 | + }; | |
840 | + | |
841 | + this.testCaptiveNetwork = function () { | |
842 | + var ua = this; | |
843 | + switch (true) { | |
844 | + case /CaptiveNetwork/gi.test(ua.Agent.source): | |
845 | + ua.Agent.isCaptive = true; | |
846 | + ua.Agent.isMac = true; | |
847 | + ua.Agent.platform = 'Apple Mac'; | |
848 | + return 'CaptiveNetwork'; | |
849 | + default: | |
850 | + return false; | |
851 | + } | |
852 | + }; | |
853 | + | |
854 | + this.testMobile = function testMobile() { | |
855 | + var ua = this; | |
856 | + switch (true) { | |
857 | + case ua.Agent.isWindows: | |
858 | + case ua.Agent.isLinux: | |
859 | + case ua.Agent.isMac: | |
860 | + case ua.Agent.isChromeOS: | |
861 | + ua.Agent.isDesktop = true; | |
862 | + break; | |
863 | + case ua.Agent.isAndroid: | |
864 | + case ua.Agent.isSamsung: | |
865 | + ua.Agent.isMobile = true; | |
866 | + ua.Agent.isDesktop = false; | |
867 | + break; | |
868 | + default: | |
869 | + } | |
870 | + switch (true) { | |
871 | + case ua.Agent.isiPad: | |
872 | + case ua.Agent.isiPod: | |
873 | + case ua.Agent.isiPhone: | |
874 | + case ua.Agent.isBada: | |
875 | + case ua.Agent.isBlackberry: | |
876 | + case ua.Agent.isAndroid: | |
877 | + case ua.Agent.isWindowsPhone: | |
878 | + ua.Agent.isMobile = true; | |
879 | + ua.Agent.isDesktop = false; | |
880 | + break; | |
881 | + default: | |
882 | + } | |
883 | + if (/mobile/i.test(ua.Agent.source)) { | |
884 | + ua.Agent.isMobile = true; | |
885 | + ua.Agent.isDesktop = false; | |
886 | + } | |
887 | + }; | |
888 | + | |
889 | + this.testTablet = function testTablet() { | |
890 | + var ua = this; | |
891 | + switch (true) { | |
892 | + case ua.Agent.isiPad: | |
893 | + case ua.Agent.isAndroidTablet: | |
894 | + case ua.Agent.isKindleFire: | |
895 | + ua.Agent.isTablet = true; | |
896 | + break; | |
897 | + } | |
898 | + if (/tablet/i.test(ua.Agent.source)) { | |
899 | + ua.Agent.isTablet = true; | |
900 | + } | |
901 | + }; | |
902 | + | |
903 | + this.testNginxGeoIP = function testNginxGeoIP(headers) { | |
904 | + var ua = this; | |
905 | + Object.keys(headers).forEach(function (key) { | |
906 | + if (/^GEOIP/i.test(key)) { | |
907 | + ua.Agent.geoIp[key] = headers[key]; | |
908 | + } | |
909 | + }); | |
910 | + }; | |
911 | + | |
912 | + this.testBot = function testBot() { | |
913 | + var ua = this; | |
914 | + var isBot = IS_BOT_REGEXP.exec(ua.Agent.source.toLowerCase()); | |
915 | + if (isBot) { | |
916 | + ua.Agent.isBot = isBot[1]; | |
917 | + } else if (!ua.Agent.isAuthoritative) { | |
918 | + // Test unauthoritative parse for `bot` in UA to flag for bot | |
919 | + ua.Agent.isBot = /bot/i.test(ua.Agent.source); | |
920 | + } | |
921 | + }; | |
922 | + | |
923 | + this.testSmartTV = function testBot() { | |
924 | + var ua = this; | |
925 | + var isSmartTV = new RegExp('smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv', 'gi').exec(ua.Agent.source.toLowerCase()); | |
926 | + if (isSmartTV) { | |
927 | + ua.Agent.isSmartTV = isSmartTV[1]; | |
928 | + } | |
929 | + }; | |
930 | + | |
931 | + this.testAndroidTablet = function testAndroidTablet() { | |
932 | + var ua = this; | |
933 | + if (ua.Agent.isAndroid && !/mobile/i.test(ua.Agent.source)) { | |
934 | + ua.Agent.isAndroidTablet = true; | |
935 | + } | |
936 | + }; | |
937 | + | |
938 | + this.testTouchSupport = function () { | |
939 | + var ua = this; | |
940 | + ua.Agent.isTouchScreen = (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); | |
941 | + }; | |
942 | + | |
943 | + this.getLaguage = function () { | |
944 | + var ua = this; | |
945 | + ua.Agent.language = (navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || '').toLowerCase(); | |
946 | + }; | |
947 | + | |
948 | + this.getColorDepth = function () { | |
949 | + var ua = this; | |
950 | + ua.Agent.colorDepth = screen.colorDepth || -1; | |
951 | + }; | |
952 | + | |
953 | + this.getScreenResolution = function () { | |
954 | + var ua = this; | |
955 | + ua.Agent.resolution = [screen.availWidth, screen.availHeight]; | |
956 | + }; | |
957 | + | |
958 | + this.getPixelDepth = function () { | |
959 | + var ua = this; | |
960 | + ua.Agent.pixelDepth = screen.pixelDepth || -1; | |
961 | + }; | |
962 | + | |
963 | + this.getCPU = function () { | |
964 | + var ua = this; | |
965 | + ua.Agent.cpuCores = navigator.hardwareConcurrency || -1; | |
966 | + }; | |
967 | + | |
968 | + this.reset = function reset() { | |
969 | + var ua = this; | |
970 | + for (var key in ua.DefaultAgent) { | |
971 | + if (ua.DefaultAgent.hasOwnProperty(key)) { | |
972 | + ua.Agent[key] = ua.DefaultAgent[key]; | |
973 | + } | |
974 | + } | |
975 | + return ua; | |
976 | + }; | |
977 | + | |
978 | + this.parse = function get(source) { | |
979 | + source = source || navigator.userAgent; | |
980 | + var ua = new DeviceUUID(); | |
981 | + ua.Agent.source = source.replace(/^\s*/, '').replace(/\s*$/, ''); | |
982 | + ua.Agent.os = ua.getOS(ua.Agent.source); | |
983 | + ua.Agent.platform = ua.getPlatform(ua.Agent.source); | |
984 | + ua.Agent.browser = ua.getBrowser(ua.Agent.source); | |
985 | + ua.Agent.version = ua.getBrowserVersion(ua.Agent.source); | |
986 | + ua.testBot(); | |
987 | + ua.testSmartTV(); | |
988 | + ua.testMobile(); | |
989 | + ua.testAndroidTablet(); | |
990 | + ua.testTablet(); | |
991 | + ua.testCompatibilityMode(); | |
992 | + ua.testSilk(); | |
993 | + ua.testKindleFire(); | |
994 | + ua.testCaptiveNetwork(); | |
995 | + ua.testTouchSupport(); | |
996 | + ua.getLaguage(); | |
997 | + ua.getColorDepth(); | |
998 | + ua.getPixelDepth(); | |
999 | + ua.getScreenResolution(); | |
1000 | + ua.getCPU(); | |
1001 | + return ua.Agent; | |
1002 | + }; | |
1003 | + | |
1004 | + this.get = function (customData) { | |
1005 | + var pref = 'a', du = this.parse(); | |
1006 | + var dua = []; | |
1007 | + for (var key in this.options) { | |
1008 | + if (this.options.hasOwnProperty(key) && this.options[key] === true) { | |
1009 | + dua.push(du[key]); | |
1010 | + } | |
1011 | + } | |
1012 | + if (customData) { | |
1013 | + dua.push(customData); | |
1014 | + } | |
1015 | + if (!this.options.resolution && du.isMobile) { | |
1016 | + dua.push(du.resolution); | |
1017 | + } | |
1018 | + // 8, 9, a, b | |
1019 | + pref = 'b'; | |
1020 | + var tmpUuid = du.hashMD5(dua.join(':')); | |
1021 | + var uuid = [ | |
1022 | + tmpUuid.slice(0, 8), | |
1023 | + tmpUuid.slice(8, 12), | |
1024 | + '4' + tmpUuid.slice(12, 15), | |
1025 | + pref + tmpUuid.slice(15, 18), | |
1026 | + tmpUuid.slice(20) | |
1027 | + ]; | |
1028 | + return uuid.join('-'); | |
1029 | + }; | |
1030 | + | |
1031 | + this.Agent = this.DefaultAgent; | |
1032 | + return this; | |
1033 | + }; | |
1034 | + | |
1035 | + exports.DeviceUUID = DeviceUUID; | |
1036 | + return new DeviceUUID(navigator.userAgent); | |
1037 | + | |
1038 | +})(this); | |
\ No newline at end of file |
@@ -317,87 +317,6 @@ | ||
317 | 317 | C:\HemaxviSoft\Proyectos\SoftLoteria\obj\Release\SoftLoteria.dll |
318 | 318 | C:\HemaxviSoft\Proyectos\SoftLoteria\obj\Release\SoftLoteria.pdb |
319 | 319 | C:\HemaxviSoft\Proyectos\SoftLoteria\obj\Release\SoftLoteria.csproj.AssemblyReference.cache |
320 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.dll.config | |
321 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.dll | |
322 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.pdb | |
323 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.exe | |
324 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.exe.config | |
325 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.rsp | |
326 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.exe | |
327 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.exe.config | |
328 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.rsp | |
329 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll | |
330 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll | |
331 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.CSharp.Scripting.dll | |
332 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.dll | |
333 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.Scripting.dll | |
334 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.VisualBasic.dll | |
335 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CSharp.Core.targets | |
336 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll | |
337 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.DiaSymReader.Native.x86.dll | |
338 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Managed.Core.targets | |
339 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.VisualBasic.Core.targets | |
340 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Win32.Primitives.dll | |
341 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.AppContext.dll | |
342 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Collections.Immutable.dll | |
343 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Console.dll | |
344 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.DiagnosticSource.dll | |
345 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.FileVersionInfo.dll | |
346 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.StackTrace.dll | |
347 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Globalization.Calendars.dll | |
348 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.Compression.dll | |
349 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.Compression.ZipFile.dll | |
350 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.FileSystem.dll | |
351 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.FileSystem.Primitives.dll | |
352 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Net.Http.dll | |
353 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Net.Sockets.dll | |
354 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Reflection.Metadata.dll | |
355 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Runtime.InteropServices.RuntimeInformation.dll | |
356 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Algorithms.dll | |
357 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Encoding.dll | |
358 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Primitives.dll | |
359 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.X509Certificates.dll | |
360 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Text.Encoding.CodePages.dll | |
361 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Threading.Tasks.Extensions.dll | |
362 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.ValueTuple.dll | |
363 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.ReaderWriter.dll | |
364 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XmlDocument.dll | |
365 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XPath.dll | |
366 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XPath.XDocument.dll | |
367 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.exe | |
368 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.exe.config | |
369 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.rsp | |
370 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\VBCSCompiler.exe | |
371 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\VBCSCompiler.exe.config | |
372 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Antlr3.Runtime.dll | |
373 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\MessagingToolkit.QRCode.dll | |
374 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll | |
375 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.Web.Infrastructure.dll | |
376 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Newtonsoft.Json.dll | |
377 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\QRCoder.dll | |
378 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Helpers.dll | |
379 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Mvc.dll | |
380 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Optimization.dll | |
381 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Razor.dll | |
382 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Deployment.dll | |
383 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.dll | |
384 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Razor.dll | |
385 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\WebGrease.dll | |
386 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Antlr3.Runtime.pdb | |
387 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Newtonsoft.Json.xml | |
388 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Helpers.xml | |
389 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Mvc.xml | |
390 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Optimization.xml | |
391 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Razor.xml | |
392 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.xml | |
393 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Deployment.xml | |
394 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Razor.xml | |
395 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml | |
396 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.AssemblyReference.cache | |
397 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.CoreCompileInputs.cache | |
398 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.CopyComplete | |
399 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.dll | |
400 | -C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.pdb | |
401 | 320 | C:\Users\Lenovo\source\Workspaces\SERVER SoftLoteria\SoftLoteria\bin\SoftLoteria.dll.config |
402 | 321 | C:\Users\Lenovo\source\Workspaces\SERVER SoftLoteria\SoftLoteria\bin\SoftLoteria.dll |
403 | 322 | C:\Users\Lenovo\source\Workspaces\SERVER SoftLoteria\SoftLoteria\bin\SoftLoteria.pdb |
@@ -558,3 +477,84 @@ | ||
558 | 477 | C:\Users\Lenovo\source\Workspaces\SoftBanking\obj\Release\SoftLoteria.csproj.CopyComplete |
559 | 478 | C:\Users\Lenovo\source\Workspaces\SoftBanking\obj\Release\SoftLoteria.dll |
560 | 479 | C:\Users\Lenovo\source\Workspaces\SoftBanking\obj\Release\SoftLoteria.pdb |
480 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.dll.config | |
481 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.dll | |
482 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\SoftLoteria.pdb | |
483 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.exe | |
484 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.exe.config | |
485 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csc.rsp | |
486 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.exe | |
487 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.exe.config | |
488 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\csi.rsp | |
489 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll | |
490 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll | |
491 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.CSharp.Scripting.dll | |
492 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.dll | |
493 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.Scripting.dll | |
494 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CodeAnalysis.VisualBasic.dll | |
495 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.CSharp.Core.targets | |
496 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.DiaSymReader.Native.amd64.dll | |
497 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.DiaSymReader.Native.x86.dll | |
498 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Managed.Core.targets | |
499 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.VisualBasic.Core.targets | |
500 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\Microsoft.Win32.Primitives.dll | |
501 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.AppContext.dll | |
502 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Collections.Immutable.dll | |
503 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Console.dll | |
504 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.DiagnosticSource.dll | |
505 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.FileVersionInfo.dll | |
506 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Diagnostics.StackTrace.dll | |
507 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Globalization.Calendars.dll | |
508 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.Compression.dll | |
509 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.Compression.ZipFile.dll | |
510 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.FileSystem.dll | |
511 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.IO.FileSystem.Primitives.dll | |
512 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Net.Http.dll | |
513 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Net.Sockets.dll | |
514 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Reflection.Metadata.dll | |
515 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Runtime.InteropServices.RuntimeInformation.dll | |
516 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Algorithms.dll | |
517 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Encoding.dll | |
518 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.Primitives.dll | |
519 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Security.Cryptography.X509Certificates.dll | |
520 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Text.Encoding.CodePages.dll | |
521 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Threading.Tasks.Extensions.dll | |
522 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.ValueTuple.dll | |
523 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.ReaderWriter.dll | |
524 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XmlDocument.dll | |
525 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XPath.dll | |
526 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\System.Xml.XPath.XDocument.dll | |
527 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.exe | |
528 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.exe.config | |
529 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\vbc.rsp | |
530 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\VBCSCompiler.exe | |
531 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\roslyn\VBCSCompiler.exe.config | |
532 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Antlr3.Runtime.dll | |
533 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\MessagingToolkit.QRCode.dll | |
534 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll | |
535 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.Web.Infrastructure.dll | |
536 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Newtonsoft.Json.dll | |
537 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\QRCoder.dll | |
538 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Helpers.dll | |
539 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Mvc.dll | |
540 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Optimization.dll | |
541 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Razor.dll | |
542 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Deployment.dll | |
543 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.dll | |
544 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Razor.dll | |
545 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\WebGrease.dll | |
546 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Antlr3.Runtime.pdb | |
547 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Newtonsoft.Json.xml | |
548 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Helpers.xml | |
549 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Mvc.xml | |
550 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Optimization.xml | |
551 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.Razor.xml | |
552 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.xml | |
553 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Deployment.xml | |
554 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\System.Web.WebPages.Razor.xml | |
555 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml | |
556 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.AssemblyReference.cache | |
557 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.CoreCompileInputs.cache | |
558 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.csproj.CopyComplete | |
559 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.dll | |
560 | +C:\HemaxviSoft\Proyectos\SVN\softbanking\obj\Release\SoftLoteria.pdb |
@@ -82,7 +82,12 @@ | ||
82 | 82 | if (Session["ListaDetalle"] != null) |
83 | 83 | { |
84 | 84 | cargarGridCopiado(); |
85 | - ValidarTicket(); | |
85 | + string respuesta = ValidarTicket(); | |
86 | + if (respuesta != "") | |
87 | + { | |
88 | + Notificaion("Ticket no procesado!", respuesta, "warning"); | |
89 | + } | |
90 | + | |
86 | 91 | } |
87 | 92 | |
88 | 93 | } |
@@ -901,11 +906,11 @@ | ||
901 | 906 | if (Cb1.Checked) |
902 | 907 | { |
903 | 908 | if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) |
904 | - { | |
909 | + { | |
905 | 910 | respuesta += "\\n\\n En " + Cb1.Text + ":"; |
906 | 911 | respuesta += "\\n\\n Linea Ticket: " + item.Cells[0].Text.ToString() + " " + item.Cells[1].Text.ToString() + " " + item.Cells[2].Text.ToString() + " Disp.:" + |
907 | 912 | GetAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1"); |
908 | - | |
913 | + removeItemGrid(item.RowIndex); | |
909 | 914 | contador++; |
910 | 915 | } |
911 | 916 | } |
@@ -923,7 +928,7 @@ | ||
923 | 928 | } |
924 | 929 | if (Cb5.Checked) |
925 | 930 | { |
926 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
931 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "5")) | |
927 | 932 | { |
928 | 933 | |
929 | 934 | respuesta += "\\n\\n En " + Cb5.Text + ":"; |
@@ -934,7 +939,7 @@ | ||
934 | 939 | } |
935 | 940 | if (Cb12.Checked) |
936 | 941 | { |
937 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
942 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "12")) | |
938 | 943 | { |
939 | 944 | |
940 | 945 | respuesta += "\\n\\n En " + Cb12.Text + ":"; |
@@ -945,7 +950,7 @@ | ||
945 | 950 | } |
946 | 951 | if (Cb15.Checked) |
947 | 952 | { |
948 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
953 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "15")) | |
949 | 954 | { |
950 | 955 | |
951 | 956 | respuesta += "\\n\\n En " + Cb15.Text + ":"; |
@@ -956,7 +961,7 @@ | ||
956 | 961 | } |
957 | 962 | if (Cb32.Checked) |
958 | 963 | { |
959 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
964 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "32")) | |
960 | 965 | { |
961 | 966 | |
962 | 967 | respuesta += "\\n\\n En " + Cb32.Text + ":"; |
@@ -967,7 +972,7 @@ | ||
967 | 972 | } |
968 | 973 | if (Cb33.Checked) |
969 | 974 | { |
970 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
975 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "33")) | |
971 | 976 | { |
972 | 977 | |
973 | 978 | respuesta += "\\n\\n En " + Cb33.Text + ":"; |
@@ -978,7 +983,7 @@ | ||
978 | 983 | } |
979 | 984 | if (Cb37.Checked) |
980 | 985 | { |
981 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
986 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "37")) | |
982 | 987 | { |
983 | 988 | |
984 | 989 | respuesta += "\\n\\n En " + Cb37.Text + ":"; |
@@ -989,7 +994,7 @@ | ||
989 | 994 | } |
990 | 995 | if (Cb38.Checked) |
991 | 996 | { |
992 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
997 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "38")) | |
993 | 998 | { |
994 | 999 | |
995 | 1000 | respuesta += "\\n\\n En " + Cb38.Text + ":"; |
@@ -1000,7 +1005,7 @@ | ||
1000 | 1005 | } |
1001 | 1006 | if (Cb39.Checked) |
1002 | 1007 | { |
1003 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1008 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "39")) | |
1004 | 1009 | { |
1005 | 1010 | |
1006 | 1011 | respuesta += "\\n\\n En " + Cb39.Text + ":"; |
@@ -1011,7 +1016,7 @@ | ||
1011 | 1016 | } |
1012 | 1017 | if (Cb40.Checked) |
1013 | 1018 | { |
1014 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1019 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "40")) | |
1015 | 1020 | { |
1016 | 1021 | |
1017 | 1022 | respuesta += "\\n\\n En " + Cb40.Text + ":"; |
@@ -1022,7 +1027,7 @@ | ||
1022 | 1027 | } |
1023 | 1028 | if (Cb41.Checked) |
1024 | 1029 | { |
1025 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1030 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "41")) | |
1026 | 1031 | { |
1027 | 1032 | |
1028 | 1033 | respuesta += "\\n\\n En " + Cb41.Text + ":"; |
@@ -1033,7 +1038,7 @@ | ||
1033 | 1038 | } |
1034 | 1039 | if (Cb42.Checked) |
1035 | 1040 | { |
1036 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1041 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "42")) | |
1037 | 1042 | { |
1038 | 1043 | |
1039 | 1044 | respuesta += "\\n\\n En " + Cb42.Text + ":"; |
@@ -1044,7 +1049,7 @@ | ||
1044 | 1049 | } |
1045 | 1050 | if (Cb43.Checked) |
1046 | 1051 | { |
1047 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1052 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "43")) | |
1048 | 1053 | { |
1049 | 1054 | |
1050 | 1055 | respuesta += "\\n\\n En " + Cb43.Text + ":"; |
@@ -1055,7 +1060,7 @@ | ||
1055 | 1060 | } |
1056 | 1061 | if (Cb44.Checked) |
1057 | 1062 | { |
1058 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1063 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "44")) | |
1059 | 1064 | { |
1060 | 1065 | |
1061 | 1066 | respuesta += "\\n\\n En " + Cb44.Text + ":"; |
@@ -1066,7 +1071,7 @@ | ||
1066 | 1071 | } |
1067 | 1072 | if (Cb45.Checked) |
1068 | 1073 | { |
1069 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1074 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "45")) | |
1070 | 1075 | { |
1071 | 1076 | |
1072 | 1077 | respuesta += "\\n\\n En " + Cb45.Text + ":"; |
@@ -1077,7 +1082,7 @@ | ||
1077 | 1082 | } |
1078 | 1083 | if (Cb46.Checked) |
1079 | 1084 | { |
1080 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1085 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "46")) | |
1081 | 1086 | { |
1082 | 1087 | |
1083 | 1088 | respuesta += "\\n\\n En " + Cb46.Text + ":"; |
@@ -1088,7 +1093,7 @@ | ||
1088 | 1093 | } |
1089 | 1094 | if (Cb47.Checked) |
1090 | 1095 | { |
1091 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1096 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "47")) | |
1092 | 1097 | { |
1093 | 1098 | |
1094 | 1099 | respuesta += "\\n\\n En " + Cb47.Text + ":"; |
@@ -1099,7 +1104,7 @@ | ||
1099 | 1104 | } |
1100 | 1105 | if (Cb48.Checked) |
1101 | 1106 | { |
1102 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1107 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "48")) | |
1103 | 1108 | { |
1104 | 1109 | |
1105 | 1110 | respuesta += "\\n\\n En " + Cb48.Text + ":"; |
@@ -1110,7 +1115,7 @@ | ||
1110 | 1115 | } |
1111 | 1116 | if (Cb49.Checked) |
1112 | 1117 | { |
1113 | - if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "1")) | |
1118 | + if (!validateAvailableLimitsGridView(item.Cells[2].Text.ToString(), item.Cells[1].Text.ToString(), item.Cells[0].Text.ToString(), "49")) | |
1114 | 1119 | { |
1115 | 1120 | |
1116 | 1121 | respuesta += "\\n\\n En " + Cb49.Text + ":"; |
@@ -1713,12 +1718,15 @@ | ||
1713 | 1718 | |
1714 | 1719 | if (transactionDAL.AllowTransaction) |
1715 | 1720 | { |
1716 | - if (transactionDAL.ExistCombination) | |
1721 | + if (!transactionDAL.ExistCombination) | |
1717 | 1722 | { |
1718 | - if (transactionDAL.AvailableAmount >= getPlayTypeTotalAmountOnly(number.Replace("-", ""))) | |
1719 | - { | |
1720 | - result = true; | |
1721 | - } | |
1723 | + // transactionDAL.Amount = getPlayTypeTotalAmountOnly(number.Replace("-", "")); | |
1724 | + transactionDAL.ValidateLimitsForPlayTypes(loginDAL); | |
1725 | + result = transactionDAL.AllowTransaction; | |
1726 | + //if (transactionDAL.AvailableAmount >= getPlayTypeTotalAmountOnly(number.Replace("-", ""))) | |
1727 | + //{ | |
1728 | + // result = true; | |
1729 | + //} | |
1722 | 1730 | |
1723 | 1731 | } |
1724 | 1732 | else |
@@ -1990,7 +1998,28 @@ | ||
1990 | 1998 | } |
1991 | 1999 | } |
1992 | 2000 | |
2001 | + public void removeItemGrid(int index) | |
2002 | + { | |
2003 | + if (index >= 0) | |
2004 | + { | |
2005 | + DataTable dataTable = new DataTable(); | |
2006 | + dataTable.Columns.Add("Tipo"); | |
2007 | + dataTable.Columns.Add("Numeros"); | |
2008 | + dataTable.Columns.Add("Monto"); | |
2009 | + foreach (GridViewRow item in GvTicket.Rows) | |
2010 | + { | |
2011 | + dataTable.Rows.Add(item.Cells[0].Text, item.Cells[1].Text, item.Cells[2].Text); | |
2012 | + } | |
2013 | + dataTable.Rows.RemoveAt(index); | |
1993 | 2014 | |
2015 | + GvTicket.DataSource = dataTable; | |
2016 | + GvTicket.DataBind(); | |
2017 | + calcularTotal(); | |
2018 | + } | |
2019 | + | |
2020 | + } | |
2021 | + | |
2022 | + | |
1994 | 2023 | } |
1995 | 2024 | |
1996 | 2025 |