1
|
|
|
var __mmapiwsStateLendable = {}, __mmapiwsRunLendable = function (flashFonts, flashStoredId) { |
2
|
|
|
"use strict"; |
3
|
|
|
if (!__mmapiwsStateLendable.alreadyRan) { |
4
|
|
|
__mmapiwsStateLendable.alreadyRan = !0; |
5
|
|
|
var fontsToTry = ["Abadi MT Condensed Light", "Adobe Fangsong Std", "Adobe Hebrew", "Adobe Ming Std", "Agency FB", "Arab", "Arabic Typesetting", "Arial Black", "Batang", "Bauhaus 93", "Bell MT", "Bitstream Vera Serif", "Bodoni MT", "Bookman Old Style", "Braggadocio", "Broadway", "Calibri", "Californian FB", "Castellar", "Casual", "Centaur", "Century Gothic", "Chalkduster", "Colonna MT", "Copperplate Gothic Light", "DejaVu LGC Sans Mono", "Desdemona", "DFKai-SB", "Dotum", "Engravers MT", "Eras Bold ITC", "Eurostile", "FangSong", "Forte", "Franklin Gothic Heavy", "French Script MT", "Gabriola", "Gigi", "Gisha", "Goudy Old Style", "Gulim", "GungSeo", "Haettenschweiler", "Harrington", "Hiragino Sans GB", "Impact", "Informal Roman", "KacstOne", "Kino MT", "Kozuka Gothic Pr6N", "Lohit Gujarati", "Loma", "Lucida Bright", "Lucida Fax", "Magneto", "Malgun Gothic", "Matura MT Script Capitals", "Menlo", "MingLiU-ExtB", "MoolBoran", "MS PMincho", "MS Reference Sans Serif", "News Gothic MT", "Niagara Solid", "Nyala", "Palace Script MT", "Papyrus", "Perpetua", "Playbill", "PMingLiU", "Rachana", "Rockwell", "Sawasdee", "Script MT Bold", "Segoe Print", "Showcard Gothic", "SimHei", "Snap ITC", "TlwgMono", "Tw Cen MT Condensed Extra Bold", "Ubuntu", "Umpush", "Univers", "Utopia", "Vladimir Script", "Wide Latin"], pluginsToTry = ["4game", "AdblockPlugin", "AdobeExManCCDetect", "AdobeExManDetect", "Alawar NPAPI utils", "Aliedit Plug-In", "Alipay Security Control 3", "AliSSOLogin plugin", "AmazonMP3DownloaderPlugin", "AOL Media Playback Plugin", "AppUp", "ArchiCAD", "AVG SiteSafety plugin", "Babylon ToolBar", "Battlelog Game Launcher", "BitCometAgent", "Bitdefender QuickScan", "BlueStacks Install Detector", "CatalinaGroup Update", "Citrix ICA Client", "Citrix online plug-in", "Citrix Receiver Plug-in", "Coowon Update", "DealPlyLive Update", "Default Browser Helper", "DivX Browser Plug-In", "DivX Plus Web Player", "DivX VOD Helper Plug-in", "doubleTwist Web Plugin", "Downloaders plugin", "downloadUpdater", "eMusicPlugin DLM6", "ESN Launch Mozilla Plugin", "ESN Sonar API", "Exif Everywhere", "Facebook Plugin", "File Downloader Plug-in", "FileLab plugin", "FlyOrDie Games Plugin", "Folx 3 Browser Plugin", "FUZEShare", "GDL Object Web Plug-in 16.00", "GFACE Plugin", "Ginger", "Gnome Shell Integration", "Google Earth Plugin", "Google Earth Plug-in", "Google Gears 0.5.33.0", "Google Talk Effects Plugin", "Google Update", "Harmony Firefox Plugin", "Harmony Plug-In", "Heroes & Generals live", "HPDetect", "Html5 location provider", "IE Tab plugin", "iGetterScriptablePlugin", "iMesh plugin", "Kaspersky Password Manager", "LastPass", "LogMeIn Plugin 1.0.0.935", "LogMeIn Plugin 1.0.0.961", "Ma-Config.com plugin", "Microsoft Office 2013", "MinibarPlugin", "Native Client", "Nitro PDF Plug-In", "Nokia Suite Enabler Plugin", "Norton Identity Safe", "npAPI Plugin", "NPLastPass", "NPPlayerShell", "npTongbuAddin", "NyxLauncher", "Octoshape Streaming Services", "Online Storage plug-in", "Orbit Downloader", "Pando Web Plugin", "Parom.TV player plugin", "PDF integrado do WebKit", "PDF-XChange Viewer", "PhotoCenterPlugin1.1.2.2", "Picasa", "PlayOn Plug-in", "QQ2013 Firefox Plugin", "QQDownload Plugin", "QQMiniDL Plugin", "QQMusic", "RealDownloader Plugin", "Roblox Launcher Plugin", "RockMelt Update", "Safer Update", "SafeSearch", "Scripting.Dictionary", "SefClient Plugin", "Shell.UIHelper", "Silverlight Plug-In", "Simple Pass", "Skype Web Plugin", "SumatraPDF Browser Plugin", "Symantec PKI Client", "Tencent FTN plug-in", "Thunder DapCtrl NPAPI Plugin", "TorchHelper", "Unity Player", "Uplay PC", "VDownloader", "Veetle TV Core", "VLC Multimedia Plugin", "Web Components", "WebKit-integrierte PDF", "WEBZEN Browser Extension", "Wolfram Mathematica", "WordCaptureX", "WPI Detector 1.4", "Yandex Media Plugin", "Yandex PDF Viewer", "YouTube Plug-in", "zako"], murmurhash3 = function (key, seed) { |
6
|
|
|
var remainder, bytes, h1, h1b, c1, c2, k1, i; |
7
|
|
|
for (remainder = 3 & key.length, bytes = key.length - remainder, h1 = seed, c1 = 3432918353, c2 = 461845907, i = 0; bytes > i;)k1 = 255 & key.charCodeAt(i) | (255 & key.charCodeAt(++i)) << 8 | (255 & key.charCodeAt(++i)) << 16 | (255 & key.charCodeAt(++i)) << 24, ++i, k1 = (65535 & k1) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295, k1 = k1 << 15 | k1 >>> 17, k1 = (65535 & k1) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295, h1 ^= k1, h1 = h1 << 13 | h1 >>> 19, h1b = 5 * (65535 & h1) + ((5 * (h1 >>> 16) & 65535) << 16) & 4294967295, h1 = (65535 & h1b) + 27492 + (((h1b >>> 16) + 58964 & 65535) << 16); |
|
|
|
|
8
|
|
|
switch (k1 = 0, remainder) { |
|
|
|
|
9
|
|
|
case 3: |
10
|
|
|
k1 ^= (255 & key.charCodeAt(i + 2)) << 16; |
|
|
|
|
11
|
|
|
case 2: |
12
|
|
|
k1 ^= (255 & key.charCodeAt(i + 1)) << 8; |
|
|
|
|
13
|
|
|
case 1: |
14
|
|
|
k1 ^= 255 & key.charCodeAt(i), k1 = (65535 & k1) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295, k1 = k1 << 15 | k1 >>> 17, k1 = (65535 & k1) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295, h1 ^= k1 |
|
|
|
|
15
|
|
|
} |
16
|
|
|
return h1 ^= key.length, h1 ^= h1 >>> 16, h1 = 2246822507 * (65535 & h1) + ((2246822507 * (h1 >>> 16) & 65535) << 16) & 4294967295, h1 ^= h1 >>> 13, h1 = 3266489909 * (65535 & h1) + ((3266489909 * (h1 >>> 16) & 65535) << 16) & 4294967295, h1 ^= h1 >>> 16, h1 >>> 0 |
|
|
|
|
17
|
|
|
}, Detector = function () { |
18
|
|
|
var baseFonts = ["monospace", "sans-serif", "serif"], baseFontSizes = [], testString = "mmmmmmmmmmlli", testSize = "72px", body = document.body, span = document.createElement("span"); |
19
|
|
|
span.style.fontSize = testSize, span.style.visibility = "hidden", span.innerHTML = testString; |
|
|
|
|
20
|
|
|
for (var calculateFontSize = function (name) { |
21
|
|
|
var size = {}; |
22
|
|
|
return span.style.fontFamily = name, body.appendChild(span), size.height = span.offsetHeight, size.width = span.offsetWidth, body.removeChild(span), size |
|
|
|
|
23
|
|
|
}, i = 0; i < baseFonts.length; i++)baseFontSizes[i] = calculateFontSize(baseFonts[i]); |
|
|
|
|
24
|
|
|
this.detect = function (font) { |
25
|
|
|
for (var i = 0; i < baseFontSizes.length; i++) { |
26
|
|
|
var fontSize = calculateFontSize(font + "," + baseFonts[i]), baseFontSize = baseFontSizes[i]; |
27
|
|
|
if (fontSize.height !== baseFontSize.height || fontSize.width !== baseFontSize.width)return !0 |
|
|
|
|
28
|
|
|
} |
29
|
|
|
return !1 |
30
|
|
|
} |
31
|
|
|
}, getCanvas2dHash = function () { |
32
|
|
|
var canvas, context; |
33
|
|
|
try { |
34
|
|
|
canvas = document.createElement("canvas"), context = canvas.getContext("2d") |
|
|
|
|
35
|
|
|
} catch (e) { |
|
|
|
|
36
|
|
|
} |
37
|
|
|
if (context)return context.fillStyle = "red", context.fillRect(30, 10, 200, 100), context.strokeStyle = "#1a3bc1", context.lineWidth = 6, context.lineCap = "round", context.arc(50, 50, 20, 0, Math.PI, !1), context.stroke(), context.fillStyle = "#42e1a2", context.font = "15.4px 'Arial'", context.textBaseline = "alphabetic", context.fillText("PR flacks quiz gym: TV DJ box when? ☠", 15, 60), context.shadowOffsetX = 1, context.shadowOffsetY = 2, context.shadowColor = "white", context.fillStyle = "rgba(0, 0, 200, 0.5)", context.font = "60px 'Not a real font'", context.fillText("No骗", 40, 80), murmurhash3(canvas.toDataURL()) |
|
|
|
|
38
|
|
|
}, getFonts = function () { |
39
|
|
|
if (flashFonts)return flashFonts; |
|
|
|
|
40
|
|
|
for (var fonts = [], fontDetector = new Detector, i = 0; i < fontsToTry.length; i++) { |
41
|
|
|
var font = fontsToTry[i]; |
42
|
|
|
fontDetector.detect(font) && fonts.push(font) |
43
|
|
|
} |
44
|
|
|
return fonts |
45
|
|
|
}, getNavigatorProperties = function () { |
46
|
|
|
var nav = {}, order = []; |
47
|
|
|
for (var property in navigator)"object" != typeof navigator[property] && (nav[property] = navigator[property]), order.push(property); |
|
|
|
|
48
|
|
|
nav.enumerationOrder = order, nav.javaEnabled = navigator.javaEnabled(); |
|
|
|
|
49
|
|
|
try { |
50
|
|
|
nav.taintEnabled = navigator.taintEnabled() |
51
|
|
|
} catch (e) { |
|
|
|
|
52
|
|
|
} |
53
|
|
|
return nav |
54
|
|
|
}, getPluginsForOldIE = function () { |
55
|
|
|
for (var plugins = [], extensionsToTry = ["AcroPDF.PDF", "Adodb.Stream", "AgControl.AgControl", "DevalVRXCtrl.DevalVRXCtrl.1", "MacromediaFlashPaper.MacromediaFlashPaper", "Msxml2.DOMDocument", "Msxml2.XMLHTTP", "PDF.PdfCtrl", "QuickTime.QuickTime", "QuickTimeCheckObject.QuickTimeCheck.1", "RealPlayer", "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)", "RealVideo.RealVideo(tm) ActiveX Control (32-bit)", "rmocx.RealPlayer G2 Control", "Scripting.Dictionary", "Shell.UIHelper", "ShockwaveFlash.ShockwaveFlash", "SWCtl.SWCtl", "TDCCtl.TDCCtl", "WMPlayer.OCX"], i = 0; i < extensionsToTry.length; i++) { |
56
|
|
|
var plugin = extensionsToTry[i]; |
57
|
|
|
try { |
58
|
|
|
var obj = new ActiveXObject(plugin), p = {name: plugin}; |
|
|
|
|
59
|
|
|
try { |
60
|
|
|
p.version = obj.GetVariable("$version") |
61
|
|
|
} catch (e) { |
|
|
|
|
62
|
|
|
} |
63
|
|
|
plugins.push(p) |
64
|
|
|
} catch (e) { |
|
|
|
|
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
return plugins |
68
|
|
|
}, getPluginsForOtherBrowsers = function () { |
69
|
|
|
var plugin, i, name, plugins = [], seen = {}; |
70
|
|
|
for (i = 0; i < navigator.plugins.length; i++)plugin = navigator.plugins[i], seen[plugin.name] = 1, plugins.push(getPluginProperties(plugin)); |
|
|
|
|
71
|
|
|
for (i = 0; i < pluginsToTry.length; i++)name = pluginsToTry[i], seen[name] || (plugin = navigator.plugins[name], plugin && plugins.push(getPluginProperties(plugin))); |
|
|
|
|
72
|
|
|
return plugins |
73
|
|
|
}, getPluginProperties = function (plugin) { |
74
|
|
|
var p = {name: plugin.name, filename: plugin.filename.toLowerCase(), description: plugin.description}; |
75
|
|
|
"undefined" != typeof plugin.version && (p.version = plugin.version), p.mimeTypes = []; |
|
|
|
|
76
|
|
|
for (var j = 0; j < plugin.length; j++) { |
77
|
|
|
var mime = plugin[j]; |
78
|
|
|
p.mimeTypes.push({description: mime.description, suffixes: mime.suffixes, type: mime.type}) |
79
|
|
|
} |
80
|
|
|
return p |
81
|
|
|
}, getPlugins = function () { |
82
|
|
|
return window.ActiveXObject ? getPluginsForOldIE() : getPluginsForOtherBrowsers() |
83
|
|
|
}, getScreenProperties = function () { |
84
|
|
|
for (var screenProperties = ["availHeight", "availWidth", "colorDepth", "deviceXPI", "height", "width"], deviceScreen = {}, i = 0; i < screenProperties.length; i++) { |
85
|
|
|
var prop = screenProperties[i]; |
86
|
|
|
"undefined" != typeof screen[prop] && (deviceScreen[prop] = screen[prop]) |
|
|
|
|
87
|
|
|
} |
88
|
|
|
return deviceScreen |
89
|
|
|
}, getStoredIds = function () { |
90
|
|
|
var ids = {}; |
91
|
|
|
return ids.cookie = document.cookie.replace(/(?:(?:^|.*;\s*)__mmapiwsid\s*\=\s*([^;]*).*$)|^.*$/, "$1"), window.localStorage && (ids.localStorage = localStorage.getItem("__mmapiwsid")), flashStoredId && (ids.flash = flashStoredId), __mmapiwsStateLendable.indexedDbId && (ids.indexedDb = __mmapiwsStateLendable.indexedDbId), ids |
|
|
|
|
92
|
|
|
}, getSystemColors = function () { |
93
|
|
|
var div = document.createElement("div"), colors = {}, elements = ["ActiveBorder", "ActiveCaption", "AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow", "ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText", "InactiveBorder", "InactiveCaption", "InactiveCaptionText", "InfoBackground", "InfoText", "Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow", "ThreeDFace", "ThreeDHighlight", "ThreeDLightShadow", "ThreeDShadow", "Window", "WindowFrame", "WindowText"]; |
94
|
|
|
if (!window.getComputedStyle)return colors; |
|
|
|
|
95
|
|
|
for (var i = 0; i < elements.length; i++)document.body.appendChild(div), div.style.color = elements[i], colors[elements[i]] = window.getComputedStyle(div).getPropertyValue("color"), document.body.removeChild(div); |
|
|
|
|
96
|
|
|
return colors |
97
|
|
|
}, getWebglHash = function (gl, canvas) { |
98
|
|
|
var vShaderTemplate = "attribute vec2 attrVertex; varying vec2 varyinTexCoordinate; uniform vec2 uniformOffset; void main() { varyinTexCoordinate = attrVertex + uniformOffset; gl_Position = vec4(attrVertex, 0, 1); }", fShaderTemplate = "precision mediump float; varying vec2 varyinTexCoordinate; void main() { gl_FragColor = vec4(varyinTexCoordinate, 0, 1); }", vertexPosBuffer = gl.createBuffer(); |
99
|
|
|
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer); |
100
|
|
|
var vertices = new Float32Array([-.2, -.9, 0, .4, -.26, 0, 0, .732134444, 0]); |
101
|
|
|
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW), vertexPosBuffer.itemSize = 3, vertexPosBuffer.numItems = 3; |
|
|
|
|
102
|
|
|
var program = gl.createProgram(), vshader = gl.createShader(gl.VERTEX_SHADER); |
103
|
|
|
gl.shaderSource(vshader, vShaderTemplate), gl.compileShader(vshader); |
|
|
|
|
104
|
|
|
var fshader = gl.createShader(gl.FRAGMENT_SHADER); |
105
|
|
|
return gl.shaderSource(fshader, fShaderTemplate), gl.compileShader(fshader), gl.attachShader(program, vshader), gl.attachShader(program, fshader), gl.linkProgram(program), gl.useProgram(program), program.vertexPosAttrib = gl.getAttribLocation(program, "attrVertex"), program.offsetUniform = gl.getUniformLocation(program, "uniformOffset"), gl.enableVertexAttribArray(program.vertexPosArray), gl.vertexAttribPointer(program.vertexPosAttrib, vertexPosBuffer.itemSize, gl.FLOAT, !1, 0, 0), gl.uniform2f(program.offsetUniform, 1, 1), gl.drawArrays(gl.TRIANGLE_STRIP, 0, vertexPosBuffer.numItems), murmurhash3(canvas.toDataURL()) |
|
|
|
|
106
|
|
|
}, getWebgl = function () { |
107
|
|
|
var gl, canvas = document.createElement("canvas"), props = {}; |
108
|
|
|
try { |
109
|
|
|
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl") |
110
|
|
|
} catch (e) { |
|
|
|
|
111
|
|
|
} |
112
|
|
|
if (!gl)return props; |
|
|
|
|
113
|
|
|
try { |
114
|
|
|
props.extensions = gl.getSupportedExtensions() |
115
|
|
|
} catch (e) { |
|
|
|
|
116
|
|
|
} |
117
|
|
|
try { |
118
|
|
|
props.hash = getWebglHash(gl, canvas) |
119
|
|
|
} catch (e) { |
|
|
|
|
120
|
|
|
} |
121
|
|
|
return props |
122
|
|
|
}, setStoredIdForDb = function (value) { |
123
|
|
|
var db = __mmapiwsStateLendable.db; |
124
|
|
|
if (db) { |
125
|
|
|
var storeName = "StoredId", tx = db.transaction(storeName, "readwrite"), store = tx.objectStore(storeName); |
126
|
|
|
store.put({id: 0, value: value}) |
127
|
|
|
} |
128
|
|
|
}, setStoredIds = function (domain, value) { |
129
|
|
|
var key = "__mmapiwsid", date = new Date; |
130
|
|
|
date.setFullYear(date.getFullYear() + 2), domain || (domain = document.domain), document.cookie = key + "=" + value + "; expires=" + date.toGMTString() + "; domain=" + domain + "; path=/", window.localStorage && localStorage.setItem(key, value); |
|
|
|
|
131
|
|
|
var flash = document.getElementById("__mmapiwsFlash"); |
132
|
|
|
flash && "function" == typeof flash.setStoredId && flash.setStoredId(value), setStoredIdForDb(value) |
|
|
|
|
133
|
|
|
}, JSON = window.JSON || {}, jsonStringify = JSON.stringify || function (obj) { |
|
|
|
|
134
|
|
|
var json, t = typeof obj; |
135
|
|
|
if ("undefined" === t || null === obj)return "null"; |
|
|
|
|
136
|
|
|
if ("number" === t || "boolean" === t)return String(obj); |
|
|
|
|
137
|
|
|
if ("object" === t && obj && obj.constructor === Array) { |
138
|
|
|
json = []; |
139
|
|
|
for (var i = 0; i < obj.length; i++)json.push(jsonStringify(obj[i])); |
|
|
|
|
140
|
|
|
return "[" + String(json) + "]" |
141
|
|
|
} |
142
|
|
|
if ("object" === t) { |
143
|
|
|
var n; |
144
|
|
|
json = []; |
145
|
|
|
for (n in obj)obj.hasOwnProperty(n) && json.push('"' + n + '":' + jsonStringify(obj[n])); |
|
|
|
|
146
|
|
|
return "{" + String(json) + "}" |
147
|
|
|
} |
148
|
|
|
var str = String(obj); |
149
|
|
|
return str = str.replace(/[\\"']/g, "\\$&").replace(/\u0000/g, "\\0"), '"' + str + '"' |
|
|
|
|
150
|
|
|
}, createUri = function (version) { |
|
|
|
|
151
|
|
|
return Routing.generate('_alpha_device_fingerprint'); |
|
|
|
|
152
|
|
|
}, handleResponse = function (xhr, version, device) { |
153
|
|
|
var responseValues = xhr.responseText.split(/;/), domain = responseValues[0], id = responseValues[1], serverIpVersion = parseInt(responseValues[2], 10); |
154
|
|
|
"undefined" != typeof id && setStoredIds(domain, id), 6 === version && 6 === serverIpVersion && sendToServer(device, 4) |
|
|
|
|
155
|
|
|
}, sendToServer = function (device, version) { |
156
|
|
|
var xhr, stringified, uri = createUri(version); |
157
|
|
|
if (device.storedIds = getStoredIds(), stringified = jsonStringify(device), "Microsoft Internet Explorer" === navigator.appName && window.XDomainRequest)xhr = new XDomainRequest, xhr.onload = function () { |
|
|
|
|
158
|
|
|
handleResponse(xhr, version) |
159
|
|
|
}, xhr.onprogress = function () { |
160
|
|
|
}, xhr.ontimeout = function () { |
161
|
|
|
}, xhr.onerror = function () { |
162
|
|
|
}; else { |
163
|
|
|
try { |
164
|
|
|
xhr = new window.XMLHttpRequest |
165
|
|
|
} catch (e) { |
|
|
|
|
166
|
|
|
} |
167
|
|
|
if (!xhr)try { |
|
|
|
|
168
|
|
|
xhr = new window.ActiveXObject("Microsoft.XMLHTTP") |
169
|
|
|
} catch (e) { |
|
|
|
|
170
|
|
|
} |
171
|
|
|
if (!xhr)return; |
|
|
|
|
172
|
|
|
xhr.onreadystatechange = function () { |
173
|
|
|
4 === xhr.readyState && 200 === xhr.status && handleResponse(xhr, version, device) |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
try { |
177
|
|
|
xhr.open("POST", uri, !0), "function" == typeof xhr.setRequestHeader && xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"), xhr.send(stringified) |
|
|
|
|
178
|
|
|
} catch (e) { |
|
|
|
|
179
|
|
|
} |
180
|
|
|
}, runDevice = function () { |
181
|
|
|
var systemColors, date = new Date, userId = "undefined" != typeof survey_height_follow ? survey_height_follow : 1; |
|
|
|
|
182
|
|
|
try { |
183
|
|
|
systemColors = getSystemColors() |
184
|
|
|
} catch (e) { |
|
|
|
|
185
|
|
|
} |
186
|
|
|
var device = { |
187
|
|
|
canvas: {"2dHash": getCanvas2dHash(), webgl: getWebgl()}, |
188
|
|
|
deviceTime: date.getTime() / 1e3, |
189
|
|
|
documentUrl: document.URL, |
190
|
|
|
documentMode: document.documentMode, |
191
|
|
|
fonts: getFonts(), |
192
|
|
|
navigator: getNavigatorProperties(), |
193
|
|
|
plugins: getPlugins(), |
194
|
|
|
screen: getScreenProperties(), |
195
|
|
|
systemColors: systemColors, |
196
|
|
|
timezoneOffset: date.getTimezoneOffset(), |
197
|
|
|
userId: userId |
198
|
|
|
}; |
199
|
|
|
sendToServer(device, 6) |
200
|
|
|
}; |
201
|
|
|
runDevice() |
202
|
|
|
} |
203
|
|
|
}; |
204
|
|
|
!function () { |
205
|
|
|
"use strict"; |
206
|
|
|
if (!document.__mmapiwsStateTestingDevice) { |
207
|
|
|
var storeName = "StoredIdLendable", retrieveDbId = function (db) { |
208
|
|
|
var tx = db.transaction(storeName, "readonly"), store = tx.objectStore(storeName), req = store.get(0); |
209
|
|
|
req.onsuccess = function (evt) { |
210
|
|
|
var record = evt.target.result; |
211
|
|
|
record && (__mmapiwsStateLendable.indexedDbId = record.value) |
212
|
|
|
} |
213
|
|
|
}, openDb = function () { |
214
|
|
|
if (window.indexedDB) { |
215
|
|
|
var req = indexedDB.open("__mmapiwsDbLendable", 1); |
|
|
|
|
216
|
|
|
req.onsuccess = function () { |
|
|
|
|
217
|
|
|
__mmapiwsStateLendable.db = this.result, retrieveDbId(__mmapiwsStateLendable.db) |
|
|
|
|
218
|
|
|
}, req.onerror = function (evt) { |
219
|
|
|
console.error("openDb:", evt.target.errorCode) |
220
|
|
|
}, req.onupgradeneeded = function (evt) { |
221
|
|
|
evt.currentTarget.result.createObjectStore(storeName, {keyPath: "id"}) |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
}, maybeSetupFlash = function () { |
225
|
|
|
try{ |
226
|
|
|
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin || window.ActiveXObject && new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) { |
|
|
|
|
227
|
|
|
var flash = document.createElement("embed"); |
228
|
|
|
flash.src = document.location.protocol + "//device.maxmind.com/flash/Device.swf", flash.id = "__mmapiwsFlash", flash.setAttribute("allowscriptaccess", "always"), flash.style.height = 0, flash.style.width = 0, flash.style.overflow = "hidden", flash.style.position = "fixed", flash.style.right = "100%", document.body.appendChild(flash) |
|
|
|
|
229
|
|
|
} |
230
|
|
|
} catch(e){} |
|
|
|
|
231
|
|
|
}, ready = function () { |
232
|
|
|
openDb(), "undefined" != typeof document.body && document.body ? (maybeSetupFlash(), setTimeout(__mmapiwsRunLendable, 1e3)) : setTimeout(ready, 500) |
|
|
|
|
233
|
|
|
}; |
234
|
|
|
ready() |
235
|
|
|
} |
236
|
|
|
}(); |
Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.
Consider:
If you or someone else later decides to put another statement in, only the first statement will be executed.
In this case the statement
b = 42
will always be executed, while the logging statement will be executed conditionally.ensures that the proper code will be executed conditionally no matter how many statements are added or removed.