@fingerprintjs/fingerprintjs
Advanced tools
Comparing version 1.8.6 to 2.0.3
// Fingerprintjs2 - Copyright (c) 2018 Valentin Vasilyev (valentin.vasilyev@outlook.com) | ||
// Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. | ||
!function(e,t,n){"use strict";"function"==typeof window.define&&window.define.amd?window.define(n):"undefined"!=typeof module&&module.exports?module.exports=n():t.exports?t.exports=n():t.Fingerprint2=n()}(0,this,function(){"use strict";var t=function(e){if(!(this instanceof t))return new t(e);this.options=this.extend(e,{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[],excludeDoNotTrack:!0,excludePixelRatio:!0}),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map};return t.prototype={extend:function(e,t){if(null==e)return t;for(var n in e)null!=e[n]&&t[n]!==e[n]&&(t[n]=e[n]);return t},get:function(i){var a=this,n={data:[],addPreprocessedComponent:function(e){var t=e.value;"function"==typeof a.options.preprocessor&&(t=a.options.preprocessor(e.key,t)),n.data.push({key:e.key,value:t})}};n=this.userAgentKey(n),n=this.languageKey(n),n=this.colorDepthKey(n),n=this.deviceMemoryKey(n),n=this.pixelRatioKey(n),n=this.hardwareConcurrencyKey(n),n=this.screenResolutionKey(n),n=this.availableScreenResolutionKey(n),n=this.timezoneOffsetKey(n),n=this.sessionStorageKey(n),n=this.localStorageKey(n),n=this.indexedDbKey(n),n=this.addBehaviorKey(n),n=this.openDatabaseKey(n),n=this.cpuClassKey(n),n=this.platformKey(n),n=this.doNotTrackKey(n),n=this.pluginsKey(n),n=this.canvasKey(n),n=this.webglKey(n),n=this.webglVendorAndRendererKey(n),n=this.adBlockKey(n),n=this.hasLiedLanguagesKey(n),n=this.hasLiedResolutionKey(n),n=this.hasLiedOsKey(n),n=this.hasLiedBrowserKey(n),n=this.touchSupportKey(n),n=this.customEntropyFunction(n),this.fontsKey(n,function(e){a.audioKey(e,function(e){var n=[];a.each(e.data,function(e){var t=e.value;t&&"function"==typeof t.join?n.push(t.join(";")):n.push(t)});var t=a.x64hash128(n.join("~~~"),31);return i(t,e.data)})})},audioKey:function(n,i){if(this.options.excludeAudioFP)return i(n);var e=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(null==e)return n.addPreprocessedComponent({key:"audio_fp",value:null}),i(n);var t=new e(1,44100,44100),a=t.createOscillator();a.type="triangle",a.frequency.setValueAtTime(1e4,t.currentTime);var r=t.createDynamicsCompressor();this.each([["threshold",-50],["knee",40],["ratio",12],["reduction",-20],["attack",0],["release",.25]],function(e){void 0!==r[e[0]]&&"function"==typeof r[e[0]].setValueAtTime&&r[e[0]].setValueAtTime(e[1],t.currentTime)}),t.oncomplete=function(e){var t=e.renderedBuffer.getChannelData(0).slice(4500,5e3).reduce(function(e,t){return e+Math.abs(t)},0).toString();return a.disconnect(),r.disconnect(),n.addPreprocessedComponent({key:"audio_fp",value:t}),i(n)},a.connect(r),r.connect(t.destination),a.start(0),t.startRendering()},customEntropyFunction:function(e){return"function"==typeof this.options.customFunction&&e.addPreprocessedComponent({key:"custom",value:this.options.customFunction()}),e},userAgentKey:function(e){return this.options.excludeUserAgent||e.addPreprocessedComponent({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.addPreprocessedComponent({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.addPreprocessedComponent({key:"color_depth",value:window.screen.colorDepth||-1}),e},deviceMemoryKey:function(e){return this.options.excludeDeviceMemory||e.addPreprocessedComponent({key:"device_memory",value:this.getDeviceMemory()}),e},getDeviceMemory:function(){return navigator.deviceMemory||-1},pixelRatioKey:function(e){return this.options.excludePixelRatio||e.addPreprocessedComponent({key:"pixel_ratio",value:this.getPixelRatio()}),e},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return t=this.options.detectScreenOrientation&&window.screen.height>window.screen.width?[window.screen.height,window.screen.width]:[window.screen.width,window.screen.height],e.addPreprocessedComponent({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return window.screen.availWidth&&window.screen.availHeight&&(t=this.options.detectScreenOrientation?window.screen.availHeight>window.screen.availWidth?[window.screen.availHeight,window.screen.availWidth]:[window.screen.availWidth,window.screen.availHeight]:[window.screen.availHeight,window.screen.availWidth]),void 0!==t&&e.addPreprocessedComponent({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.addPreprocessedComponent({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.addPreprocessedComponent({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.addPreprocessedComponent({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.addPreprocessedComponent({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return!this.options.excludeAddBehavior&&document.body&&document.body.addBehavior&&e.addPreprocessedComponent({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.addPreprocessedComponent({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.addPreprocessedComponent({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.addPreprocessedComponent({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.addPreprocessedComponent({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.addPreprocessedComponent({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return!this.options.excludeWebGL&&this.isWebGlSupported()&&e.addPreprocessedComponent({key:"webgl",value:this.getWebglFp()}),e},webglVendorAndRendererKey:function(e){return!this.options.excludeWebGLVendorAndRenderer&&this.isWebGlSupported()&&e.addPreprocessedComponent({key:"webgl_vendor",value:this.getWebglVendorAndRenderer()}),e},adBlockKey:function(e){return this.options.excludeAdBlock||e.addPreprocessedComponent({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.addPreprocessedComponent({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.addPreprocessedComponent({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.addPreprocessedComponent({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.addPreprocessedComponent({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(t,n){return this.options.excludeFlashFonts?n(t):this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()?void 0===this.options.swfPath?n(t):void this.loadSwfAndDetectFonts(function(e){t.addPreprocessedComponent({key:"swf_fonts",value:e.join(";")}),n(t)}):n(t)},jsFontsKey:function(m,v){var C=this;return setTimeout(function(){var u=["monospace","sans-serif","serif"],c=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];C.options.extendedJsFonts&&(c=c.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"])),c=(c=c.concat(C.options.userDefinedFonts)).filter(function(e,t){return c.indexOf(e)===t});var e=document.getElementsByTagName("body")[0],a=document.createElement("div"),h=document.createElement("div"),i={},r={},g=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.fontStyle="normal",e.style.fontWeight="normal",e.style.letterSpacing="normal",e.style.lineBreak="auto",e.style.lineHeight="normal",e.style.textTransform="none",e.style.textAlign="left",e.style.textDecoration="none",e.style.textShadow="none",e.style.whiteSpace="normal",e.style.wordBreak="normal",e.style.wordSpacing="normal",e.innerHTML="mmmmmmmmmmlli",e},t=function(e){for(var t=!1,n=0;n<u.length;n++)if(t=e[n].offsetWidth!==i[u[n]]||e[n].offsetHeight!==r[u[n]])return t;return t},n=function(){for(var e=[],t=0,n=u.length;t<n;t++){var i=g();i.style.fontFamily=u[t],a.appendChild(i),e.push(i)}return e}();e.appendChild(a);for(var o=0,s=u.length;o<s;o++)i[u[o]]=n[o].offsetWidth,r[u[o]]=n[o].offsetHeight;var l=function(){for(var e,t,n,i={},a=0,r=c.length;a<r;a++){for(var o=[],s=0,l=u.length;s<l;s++){var d=(e=c[a],t=u[s],n=void 0,(n=g()).style.fontFamily="'"+e+"',"+t,n);h.appendChild(d),o.push(d)}i[c[a]]=o}return i}();e.appendChild(h);for(var d=[],p=0,f=c.length;p<f;p++)t(l[c[p]])&&d.push(c[p]);e.removeChild(h),e.removeChild(a),m.addPreprocessedComponent({key:"js_fonts",value:d}),v(m)},1)},pluginsKey:function(e){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||e.addPreprocessedComponent({key:"ie_plugins",value:this.getIEPlugins()}):e.addPreprocessedComponent({key:"regular_plugins",value:this.getRegularPlugins()})),e},getRegularPlugins:function(){var e=[];if(navigator.plugins)for(var t=0,n=navigator.plugins.length;t<n;t++)navigator.plugins[t]&&e.push(navigator.plugins[t]);return this.pluginsShouldBeSorted()&&(e=e.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),this.map(e,function(e){var t=this.map(e,function(e){return[e.type,e.suffixes].join("~")}).join(",");return[e.name,e.description,t].join("::")},this)},getIEPlugins:function(){var e=[];if(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window){e=this.map(["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)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new window.ActiveXObject(e),e}catch(e){return null}})}return navigator.plugins&&(e=e.concat(this.getRegularPlugins())),e},pluginsShouldBeSorted:function(){for(var e=!1,t=0,n=this.options.sortPluginsFor.length;t<n;t++){var i=this.options.sortPluginsFor[t];if(navigator.userAgent.match(i)){e=!0;break}}return e},touchSupportKey:function(e){return this.options.excludeTouchSupport||e.addPreprocessedComponent({key:"touch_support",value:this.getTouchSupport()}),e},hardwareConcurrencyKey:function(e){return this.options.excludeHardwareConcurrency||e.addPreprocessedComponent({key:"hardware_concurrency",value:this.getHardwareConcurrency()}),e},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasIndexedDB:function(){try{return!!window.indexedDB}catch(e){return!0}},getHardwareConcurrency:function(){return navigator.hardwareConcurrency?navigator.hardwareConcurrency:"unknown"},getNavigatorCpuClass:function(){return navigator.cpuClass?navigator.cpuClass:"unknown"},getNavigatorPlatform:function(){return navigator.platform?navigator.platform:"unknown"},getDoNotTrack:function(){return navigator.doNotTrack?navigator.doNotTrack:navigator.msDoNotTrack?navigator.msDoNotTrack:window.doNotTrack?window.doNotTrack:"unknown"},getTouchSupport:function(){var e=0,t=!1;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){}return[e,t,"ontouchstart"in window]},getCanvasFp:function(){var e=[],t=document.createElement("canvas");t.width=2e3,t.height=200,t.style.display="inline";var n=t.getContext("2d");return n.rect(0,0,10,10),n.rect(2,2,6,6),e.push("canvas winding:"+(!1===n.isPointInPath(5,5,"evenodd")?"yes":"no")),n.textBaseline="alphabetic",n.fillStyle="#f60",n.fillRect(125,1,62,20),n.fillStyle="#069",this.options.dontUseFakeFontInCanvas?n.font="11pt Arial":n.font="11pt no-real-font-123",n.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03",2,15),n.fillStyle="rgba(102, 204, 0, 0.2)",n.font="18pt Arial",n.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03",4,45),n.globalCompositeOperation="multiply",n.fillStyle="rgb(255,0,255)",n.beginPath(),n.arc(50,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(0,255,255)",n.beginPath(),n.arc(100,50,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,255,0)",n.beginPath(),n.arc(75,100,50,0,2*Math.PI,!0),n.closePath(),n.fill(),n.fillStyle="rgb(255,0,255)",n.arc(75,75,75,0,2*Math.PI,!0),n.arc(75,75,25,0,2*Math.PI,!0),n.fill("evenodd"),t.toDataURL&&e.push("canvas fp:"+t.toDataURL()),e.join("~")},getWebglFp:function(){var o,e=function(e){return o.clearColor(0,0,0,1),o.enable(o.DEPTH_TEST),o.depthFunc(o.LEQUAL),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),"["+e[0]+", "+e[1]+"]"};if(!(o=this.getWebglCanvas()))return null;var s=[],t=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,t);var n=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);o.bufferData(o.ARRAY_BUFFER,n,o.STATIC_DRAW),t.itemSize=3,t.numItems=3;var i=o.createProgram(),a=o.createShader(o.VERTEX_SHADER);o.shaderSource(a,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),o.compileShader(a);var r=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(r,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),o.compileShader(r),o.attachShader(i,a),o.attachShader(i,r),o.linkProgram(i),o.useProgram(i),i.vertexPosAttrib=o.getAttribLocation(i,"attrVertex"),i.offsetUniform=o.getUniformLocation(i,"uniformOffset"),o.enableVertexAttribArray(i.vertexPosArray),o.vertexAttribPointer(i.vertexPosAttrib,t.itemSize,o.FLOAT,!1,0,0),o.uniform2f(i.offsetUniform,1,1),o.drawArrays(o.TRIANGLE_STRIP,0,t.numItems);try{s.push(o.canvas.toDataURL())}catch(e){}s.push("extensions:"+(o.getSupportedExtensions()||[]).join(";")),s.push("webgl aliased line width range:"+e(o.getParameter(o.ALIASED_LINE_WIDTH_RANGE))),s.push("webgl aliased point size range:"+e(o.getParameter(o.ALIASED_POINT_SIZE_RANGE))),s.push("webgl alpha bits:"+o.getParameter(o.ALPHA_BITS)),s.push("webgl antialiasing:"+(o.getContextAttributes().antialias?"yes":"no")),s.push("webgl blue bits:"+o.getParameter(o.BLUE_BITS)),s.push("webgl depth bits:"+o.getParameter(o.DEPTH_BITS)),s.push("webgl green bits:"+o.getParameter(o.GREEN_BITS)),s.push("webgl max anisotropy:"+function(e){var t=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");if(t){var n=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT);return 0===n&&(n=2),n}return null}(o)),s.push("webgl max combined texture image units:"+o.getParameter(o.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),s.push("webgl max cube map texture size:"+o.getParameter(o.MAX_CUBE_MAP_TEXTURE_SIZE)),s.push("webgl max fragment uniform vectors:"+o.getParameter(o.MAX_FRAGMENT_UNIFORM_VECTORS)),s.push("webgl max render buffer size:"+o.getParameter(o.MAX_RENDERBUFFER_SIZE)),s.push("webgl max texture image units:"+o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS)),s.push("webgl max texture size:"+o.getParameter(o.MAX_TEXTURE_SIZE)),s.push("webgl max varying vectors:"+o.getParameter(o.MAX_VARYING_VECTORS)),s.push("webgl max vertex attribs:"+o.getParameter(o.MAX_VERTEX_ATTRIBS)),s.push("webgl max vertex texture image units:"+o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),s.push("webgl max vertex uniform vectors:"+o.getParameter(o.MAX_VERTEX_UNIFORM_VECTORS)),s.push("webgl max viewport dims:"+e(o.getParameter(o.MAX_VIEWPORT_DIMS))),s.push("webgl red bits:"+o.getParameter(o.RED_BITS)),s.push("webgl renderer:"+o.getParameter(o.RENDERER)),s.push("webgl shading language version:"+o.getParameter(o.SHADING_LANGUAGE_VERSION)),s.push("webgl stencil bits:"+o.getParameter(o.STENCIL_BITS)),s.push("webgl vendor:"+o.getParameter(o.VENDOR)),s.push("webgl version:"+o.getParameter(o.VERSION));try{var l=o.getExtension("WEBGL_debug_renderer_info");l&&(s.push("webgl unmasked vendor:"+o.getParameter(l.UNMASKED_VENDOR_WEBGL)),s.push("webgl unmasked renderer:"+o.getParameter(l.UNMASKED_RENDERER_WEBGL)))}catch(e){}if(!o.getShaderPrecisionFormat)return s.join("~");var d=this;return d.each(["FLOAT","INT"],function(r){d.each(["VERTEX","FRAGMENT"],function(a){d.each(["HIGH","MEDIUM","LOW"],function(i){d.each(["precision","rangeMin","rangeMax"],function(e){var t=o.getShaderPrecisionFormat(o[a+"_SHADER"],o[i+"_"+r])[e];"precision"!==e&&(e="precision "+e);var n=["webgl ",a.toLowerCase()," shader ",i.toLowerCase()," ",r.toLowerCase()," ",e,":",t];s.push(n.join(""))})})})}),s.join("~")},getWebglVendorAndRenderer:function(){try{var e=this.getWebglCanvas(),t=e.getExtension("WEBGL_debug_renderer_info");return e.getParameter(t.UNMASKED_VENDOR_WEBGL)+"~"+e.getParameter(t.UNMASKED_RENDERER_WEBGL)}catch(e){return null}},getAdBlock:function(){var e=document.createElement("div");e.innerHTML=" ";var t=!(e.className="adsbox");try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(e){t=!1}return t},getHasLiedLanguages:function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},getHasLiedResolution:function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight},getHasLiedOs:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.oscpu,i=navigator.platform.toLowerCase();if(e=0<=t.indexOf("windows phone")?"Windows Phone":0<=t.indexOf("win")?"Windows":0<=t.indexOf("android")?"Android":0<=t.indexOf("linux")?"Linux":0<=t.indexOf("iphone")||0<=t.indexOf("ipad")?"iOS":0<=t.indexOf("mac")?"Mac":"Other",("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==n){if(0<=(n=n.toLowerCase()).indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(0<=n.indexOf("linux")&&"Linux"!==e&&"Android"!==e)return!0;if(0<=n.indexOf("mac")&&"Mac"!==e&&"iOS"!==e)return!0;if((-1===n.indexOf("win")&&-1===n.indexOf("linux")&&-1===n.indexOf("mac"))!=("Other"===e))return!0}return 0<=i.indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e||((0<=i.indexOf("linux")||0<=i.indexOf("android")||0<=i.indexOf("pike"))&&"Linux"!==e&&"Android"!==e||((0<=i.indexOf("mac")||0<=i.indexOf("ipad")||0<=i.indexOf("ipod")||0<=i.indexOf("iphone"))&&"Mac"!==e&&"iOS"!==e||((-1===i.indexOf("win")&&-1===i.indexOf("linux")&&-1===i.indexOf("mac"))!=("Other"===e)||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e)))},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"===(e=0<=t.indexOf("firefox")?"Firefox":0<=t.indexOf("opera")||0<=t.indexOf("opr")?"Opera":0<=t.indexOf("chrome")?"Chrome":0<=t.indexOf("safari")?"Safari":0<=t.indexOf("trident")?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var i,a=eval.toString().length;if(37===a&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===a&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===a&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),i=!0}catch(e){i=!1}}return!(!i||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var e=this.getWebglCanvas();return!!window.WebGLRenderingContext&&!!e},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return void 0!==window.swfobject},hasMinFlashInstalled:function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(t){var e="___fp_swf_loaded";window[e]=function(e){t(e)};var n=this.options.swfContainerId;this.addFlashDivNode();var i={onReady:e};window.swfobject.embedSWF(this.options.swfPath,n,"1","1","9.0.0",!1,i,{allowScriptAccess:"always",menu:"false"},{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t},each:function(e,t,n){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,a=e.length;i<a;i++)if(t.call(n,e[i],i,e)==={})return}else for(var r in e)if(e.hasOwnProperty(r)&&t.call(n,e[r],r,e)==={})return},map:function(e,i,a){var r=[];return null==e?r:this.nativeMap&&e.map===this.nativeMap?e.map(i,a):(this.each(e,function(e,t,n){r[r.length]=i.call(a,e,t,n)}),r)},x64Add:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},x64Rotl:function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},x64LeftShift:function(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},x64Xor:function(e,t){return[e[0]^t[0],e[1]^t[1]]},x64Fmix:function(e){return e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),e=this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){t=t||0;for(var n=(e=e||"").length%16,i=e.length-n,a=[0,t],r=[0,t],o=[0,0],s=[0,0],l=[2277735313,289559509],d=[1291169091,658871167],u=0;u<i;u+=16)o=[255&e.charCodeAt(u+4)|(255&e.charCodeAt(u+5))<<8|(255&e.charCodeAt(u+6))<<16|(255&e.charCodeAt(u+7))<<24,255&e.charCodeAt(u)|(255&e.charCodeAt(u+1))<<8|(255&e.charCodeAt(u+2))<<16|(255&e.charCodeAt(u+3))<<24],s=[255&e.charCodeAt(u+12)|(255&e.charCodeAt(u+13))<<8|(255&e.charCodeAt(u+14))<<16|(255&e.charCodeAt(u+15))<<24,255&e.charCodeAt(u+8)|(255&e.charCodeAt(u+9))<<8|(255&e.charCodeAt(u+10))<<16|(255&e.charCodeAt(u+11))<<24],o=this.x64Multiply(o,l),o=this.x64Rotl(o,31),o=this.x64Multiply(o,d),a=this.x64Xor(a,o),a=this.x64Rotl(a,27),a=this.x64Add(a,r),a=this.x64Add(this.x64Multiply(a,[0,5]),[0,1390208809]),s=this.x64Multiply(s,d),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),r=this.x64Xor(r,s),r=this.x64Rotl(r,31),r=this.x64Add(r,a),r=this.x64Add(this.x64Multiply(r,[0,5]),[0,944331445]);switch(o=[0,0],s=[0,0],n){case 15:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+9)],8));case 9:s=this.x64Xor(s,[0,e.charCodeAt(u+8)]),s=this.x64Multiply(s,d),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),r=this.x64Xor(r,s);case 8:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+7)],56));case 7:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+6)],48));case 6:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+5)],40));case 5:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+4)],32));case 4:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+3)],24));case 3:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+2)],16));case 2:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+1)],8));case 1:o=this.x64Xor(o,[0,e.charCodeAt(u)]),o=this.x64Multiply(o,l),o=this.x64Rotl(o,31),o=this.x64Multiply(o,d),a=this.x64Xor(a,o)}return a=this.x64Xor(a,[0,e.length]),r=this.x64Xor(r,[0,e.length]),a=this.x64Add(a,r),r=this.x64Add(r,a),a=this.x64Fmix(a),r=this.x64Fmix(r),a=this.x64Add(a,r),r=this.x64Add(r,a),("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)+("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)}},t.VERSION="1.8.0",t}); | ||
!function(e,t,n){"use strict";"undefined"!=typeof window&&"function"==typeof window.define&&window.define.amd?window.define(n):"undefined"!=typeof module&&module.exports?module.exports=n():t.exports?t.exports=n():t.Fingerprint2=n()}(0,this,function(){"use strict";var d=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},g=function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]},f=function(e,t){return 32===(t%=64)?[e[1],e[0]]:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},h=function(e,t){return 0===(t%=64)?e:t<32?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},m=function(e,t){return[e[0]^t[0],e[1]^t[1]]},T=function(e){return e=m(e,[0,e[0]>>>1]),e=g(e,[4283543511,3981806797]),e=m(e,[0,e[0]>>>1]),e=g(e,[3301882366,444984403]),e=m(e,[0,e[0]>>>1])},l=function(e,t){t=t||0;for(var n=(e=e||"").length%16,a=e.length-n,r=[0,t],i=[0,t],o=[0,0],l=[0,0],s=[2277735313,289559509],c=[1291169091,658871167],u=0;u<a;u+=16)o=[255&e.charCodeAt(u+4)|(255&e.charCodeAt(u+5))<<8|(255&e.charCodeAt(u+6))<<16|(255&e.charCodeAt(u+7))<<24,255&e.charCodeAt(u)|(255&e.charCodeAt(u+1))<<8|(255&e.charCodeAt(u+2))<<16|(255&e.charCodeAt(u+3))<<24],l=[255&e.charCodeAt(u+12)|(255&e.charCodeAt(u+13))<<8|(255&e.charCodeAt(u+14))<<16|(255&e.charCodeAt(u+15))<<24,255&e.charCodeAt(u+8)|(255&e.charCodeAt(u+9))<<8|(255&e.charCodeAt(u+10))<<16|(255&e.charCodeAt(u+11))<<24],o=g(o,s),o=f(o,31),o=g(o,c),r=m(r,o),r=f(r,27),r=d(r,i),r=d(g(r,[0,5]),[0,1390208809]),l=g(l,c),l=f(l,33),l=g(l,s),i=m(i,l),i=f(i,31),i=d(i,r),i=d(g(i,[0,5]),[0,944331445]);switch(o=[0,0],l=[0,0],n){case 15:l=m(l,h([0,e.charCodeAt(u+14)],48));case 14:l=m(l,h([0,e.charCodeAt(u+13)],40));case 13:l=m(l,h([0,e.charCodeAt(u+12)],32));case 12:l=m(l,h([0,e.charCodeAt(u+11)],24));case 11:l=m(l,h([0,e.charCodeAt(u+10)],16));case 10:l=m(l,h([0,e.charCodeAt(u+9)],8));case 9:l=m(l,[0,e.charCodeAt(u+8)]),l=g(l,c),l=f(l,33),l=g(l,s),i=m(i,l);case 8:o=m(o,h([0,e.charCodeAt(u+7)],56));case 7:o=m(o,h([0,e.charCodeAt(u+6)],48));case 6:o=m(o,h([0,e.charCodeAt(u+5)],40));case 5:o=m(o,h([0,e.charCodeAt(u+4)],32));case 4:o=m(o,h([0,e.charCodeAt(u+3)],24));case 3:o=m(o,h([0,e.charCodeAt(u+2)],16));case 2:o=m(o,h([0,e.charCodeAt(u+1)],8));case 1:o=m(o,[0,e.charCodeAt(u)]),o=g(o,s),o=f(o,31),o=g(o,c),r=m(r,o)}return r=m(r,[0,e.length]),i=m(i,[0,e.length]),r=d(r,i),i=d(i,r),r=T(r),i=T(i),r=d(r,i),i=d(i,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)},e={preprocessor:null,audio:{timeout:1e3,excludeIOS11:!0},fonts:{swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",userDefinedFonts:[],extendedJsFonts:!1},screen:{detectScreenOrientation:!0},plugins:{sortPluginsFor:[/palemoon/i],excludeIE:!1},extraComponents:[],excludes:{enumerateDevices:!0,pixelRatio:!0,doNotTrack:!0,fontsFlash:!0},NOT_AVAILABLE:"not available",ERROR:"error",EXCLUDED:"excluded"},c=function(e,t){if(Array.prototype.forEach&&e.forEach===Array.prototype.forEach)e.forEach(t);else if(e.length===+e.length)for(var n=0,a=e.length;n<a;n++)t(e[n],n,e);else for(var r in e)e.hasOwnProperty(r)&&t(e[r],r,e)},s=function(e,a){var r=[];return null==e?r:Array.prototype.map&&e.map===Array.prototype.map?e.map(a):(c(e,function(e,t,n){r.push(a(e,t,n))}),r)},n=function(){return navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices},a=function(e){var t=[window.screen.width,window.screen.height];return e.screen.detectScreenOrientation&&t.sort().reverse(),t},r=function(e){if(window.screen.availWidth&&window.screen.availHeight){var t=[window.screen.availHeight,window.screen.availWidth];return e.screen.detectScreenOrientation&&t.sort().reverse(),t}return e.NOT_AVAILABLE},i=function(e){if(null==navigator.plugins)return e.NOT_AVAILABLE;for(var t=[],n=0,a=navigator.plugins.length;n<a;n++)navigator.plugins[n]&&t.push(navigator.plugins[n]);return u(e)&&(t=t.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),s(t,function(e){var t=s(e,function(e){return[e.type,e.suffixes]});return[e.name,e.description,t]})},o=function(t){var e=[];if(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window){e=s(["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)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"],function(e){try{return new window.ActiveXObject(e),e}catch(e){return t.ERROR}})}else e.push(t.NOT_AVAILABLE);return navigator.plugins&&(e=e.concat(i(t))),e},u=function(e){for(var t=!1,n=0,a=e.plugins.sortPluginsFor.length;n<a;n++){var r=e.plugins.sortPluginsFor[n];if(navigator.userAgent.match(r)){t=!0;break}}return t},p=function(t){try{return!!window.sessionStorage}catch(e){return t.ERROR}},v=function(t){try{return!!window.localStorage}catch(e){return t.ERROR}},A=function(t){try{return!!window.indexedDB}catch(e){return t.ERROR}},S=function(e){return navigator.hardwareConcurrency?navigator.hardwareConcurrency:e.NOT_AVAILABLE},C=function(e){return navigator.cpuClass||e.NOT_AVAILABLE},B=function(e){return navigator.platform?navigator.platform:e.NOT_AVAILABLE},w=function(e){return navigator.doNotTrack?navigator.doNotTrack:navigator.msDoNotTrack?navigator.msDoNotTrack:window.doNotTrack?window.doNotTrack:e.NOT_AVAILABLE},t=function(){var t,e=0;void 0!==navigator.maxTouchPoints?e=navigator.maxTouchPoints:void 0!==navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){t=!1}return[e,t,"ontouchstart"in window]},y=function(e){var t=[],n=document.createElement("canvas");n.width=2e3,n.height=200,n.style.display="inline";var a=n.getContext("2d");return a.rect(0,0,10,10),a.rect(2,2,6,6),t.push("canvas winding:"+(!1===a.isPointInPath(5,5,"evenodd")?"yes":"no")),a.textBaseline="alphabetic",a.fillStyle="#f60",a.fillRect(125,1,62,20),a.fillStyle="#069",e.dontUseFakeFontInCanvas?a.font="11pt Arial":a.font="11pt no-real-font-123",a.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03",2,15),a.fillStyle="rgba(102, 204, 0, 0.2)",a.font="18pt Arial",a.fillText("Cwm fjordbank glyphs vext quiz, \ud83d\ude03",4,45),a.globalCompositeOperation="multiply",a.fillStyle="rgb(255,0,255)",a.beginPath(),a.arc(50,50,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(0,255,255)",a.beginPath(),a.arc(100,50,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(255,255,0)",a.beginPath(),a.arc(75,100,50,0,2*Math.PI,!0),a.closePath(),a.fill(),a.fillStyle="rgb(255,0,255)",a.arc(75,75,75,0,2*Math.PI,!0),a.arc(75,75,25,0,2*Math.PI,!0),a.fill("evenodd"),n.toDataURL&&t.push("canvas fp:"+n.toDataURL()),t},E=function(){var o,e=function(e){return o.clearColor(0,0,0,1),o.enable(o.DEPTH_TEST),o.depthFunc(o.LEQUAL),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),"["+e[0]+", "+e[1]+"]"};if(!(o=F()))return null;var l=[],t=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,t);var n=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);o.bufferData(o.ARRAY_BUFFER,n,o.STATIC_DRAW),t.itemSize=3,t.numItems=3;var a=o.createProgram(),r=o.createShader(o.VERTEX_SHADER);o.shaderSource(r,"attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}"),o.compileShader(r);var i=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(i,"precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}"),o.compileShader(i),o.attachShader(a,r),o.attachShader(a,i),o.linkProgram(a),o.useProgram(a),a.vertexPosAttrib=o.getAttribLocation(a,"attrVertex"),a.offsetUniform=o.getUniformLocation(a,"uniformOffset"),o.enableVertexAttribArray(a.vertexPosArray),o.vertexAttribPointer(a.vertexPosAttrib,t.itemSize,o.FLOAT,!1,0,0),o.uniform2f(a.offsetUniform,1,1),o.drawArrays(o.TRIANGLE_STRIP,0,t.numItems);try{l.push(o.canvas.toDataURL())}catch(e){}l.push("extensions:"+(o.getSupportedExtensions()||[]).join(";")),l.push("webgl aliased line width range:"+e(o.getParameter(o.ALIASED_LINE_WIDTH_RANGE))),l.push("webgl aliased point size range:"+e(o.getParameter(o.ALIASED_POINT_SIZE_RANGE))),l.push("webgl alpha bits:"+o.getParameter(o.ALPHA_BITS)),l.push("webgl antialiasing:"+(o.getContextAttributes().antialias?"yes":"no")),l.push("webgl blue bits:"+o.getParameter(o.BLUE_BITS)),l.push("webgl depth bits:"+o.getParameter(o.DEPTH_BITS)),l.push("webgl green bits:"+o.getParameter(o.GREEN_BITS)),l.push("webgl max anisotropy:"+function(e){var t=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");if(t){var n=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT);return 0===n&&(n=2),n}return null}(o)),l.push("webgl max combined texture image units:"+o.getParameter(o.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),l.push("webgl max cube map texture size:"+o.getParameter(o.MAX_CUBE_MAP_TEXTURE_SIZE)),l.push("webgl max fragment uniform vectors:"+o.getParameter(o.MAX_FRAGMENT_UNIFORM_VECTORS)),l.push("webgl max render buffer size:"+o.getParameter(o.MAX_RENDERBUFFER_SIZE)),l.push("webgl max texture image units:"+o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS)),l.push("webgl max texture size:"+o.getParameter(o.MAX_TEXTURE_SIZE)),l.push("webgl max varying vectors:"+o.getParameter(o.MAX_VARYING_VECTORS)),l.push("webgl max vertex attribs:"+o.getParameter(o.MAX_VERTEX_ATTRIBS)),l.push("webgl max vertex texture image units:"+o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),l.push("webgl max vertex uniform vectors:"+o.getParameter(o.MAX_VERTEX_UNIFORM_VECTORS)),l.push("webgl max viewport dims:"+e(o.getParameter(o.MAX_VIEWPORT_DIMS))),l.push("webgl red bits:"+o.getParameter(o.RED_BITS)),l.push("webgl renderer:"+o.getParameter(o.RENDERER)),l.push("webgl shading language version:"+o.getParameter(o.SHADING_LANGUAGE_VERSION)),l.push("webgl stencil bits:"+o.getParameter(o.STENCIL_BITS)),l.push("webgl vendor:"+o.getParameter(o.VENDOR)),l.push("webgl version:"+o.getParameter(o.VERSION));try{var s=o.getExtension("WEBGL_debug_renderer_info");s&&(l.push("webgl unmasked vendor:"+o.getParameter(s.UNMASKED_VENDOR_WEBGL)),l.push("webgl unmasked renderer:"+o.getParameter(s.UNMASKED_RENDERER_WEBGL)))}catch(e){}return o.getShaderPrecisionFormat&&c(["FLOAT","INT"],function(i){c(["VERTEX","FRAGMENT"],function(r){c(["HIGH","MEDIUM","LOW"],function(a){c(["precision","rangeMin","rangeMax"],function(e){var t=o.getShaderPrecisionFormat(o[r+"_SHADER"],o[a+"_"+i])[e];"precision"!==e&&(e="precision "+e);var n=["webgl ",r.toLowerCase()," shader ",a.toLowerCase()," ",i.toLowerCase()," ",e,":",t].join("");l.push(n)})})})}),l},M=function(){try{var e=F(),t=e.getExtension("WEBGL_debug_renderer_info");return e.getParameter(t.UNMASKED_VENDOR_WEBGL)+"~"+e.getParameter(t.UNMASKED_RENDERER_WEBGL)}catch(e){return null}},x=function(){var e=document.createElement("div");e.innerHTML=" ";var t=!(e.className="adsbox");try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(e){t=!1}return t},O=function(){if(void 0!==navigator.languages)try{if(navigator.languages[0].substr(0,2)!==navigator.language.substr(0,2))return!0}catch(e){return!0}return!1},P=function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight},b=function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.oscpu,a=navigator.platform.toLowerCase();if(e=0<=t.indexOf("windows phone")?"Windows Phone":0<=t.indexOf("win")?"Windows":0<=t.indexOf("android")?"Android":0<=t.indexOf("linux")?"Linux":0<=t.indexOf("iphone")||0<=t.indexOf("ipad")?"iOS":0<=t.indexOf("mac")?"Mac":"Other",("ontouchstart"in window||0<navigator.maxTouchPoints||0<navigator.msMaxTouchPoints)&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if(void 0!==n){if(0<=(n=n.toLowerCase()).indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(0<=n.indexOf("linux")&&"Linux"!==e&&"Android"!==e)return!0;if(0<=n.indexOf("mac")&&"Mac"!==e&&"iOS"!==e)return!0;if((-1===n.indexOf("win")&&-1===n.indexOf("linux")&&-1===n.indexOf("mac"))!=("Other"===e))return!0}return 0<=a.indexOf("win")&&"Windows"!==e&&"Windows Phone"!==e||((0<=a.indexOf("linux")||0<=a.indexOf("android")||0<=a.indexOf("pike"))&&"Linux"!==e&&"Android"!==e||((0<=a.indexOf("mac")||0<=a.indexOf("ipad")||0<=a.indexOf("ipod")||0<=a.indexOf("iphone"))&&"Mac"!==e&&"iOS"!==e||((-1===a.indexOf("win")&&-1===a.indexOf("linux")&&-1===a.indexOf("mac"))!=("Other"===e)||void 0===navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e)))},L=function(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.productSub;if(("Chrome"===(e=0<=t.indexOf("firefox")?"Firefox":0<=t.indexOf("opera")||0<=t.indexOf("opr")?"Opera":0<=t.indexOf("chrome")?"Chrome":0<=t.indexOf("safari")?"Safari":0<=t.indexOf("trident")?"Internet Explorer":"Other")||"Safari"===e||"Opera"===e)&&"20030107"!==n)return!0;var a,r=eval.toString().length;if(37===r&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===r&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===r&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;try{throw"a"}catch(e){try{e.toSource(),a=!0}catch(e){a=!1}}return a&&"Firefox"!==e&&"Other"!==e},I=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},k=function(){if(!I())return!1;var e=F();return!!window.WebGLRenderingContext&&!!e},R=function(){return"Microsoft Internet Explorer"===navigator.appName||!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},D=function(){return void 0!==window.swfobject},N=function(){return window.swfobject.hasFlashPlayerVersion("9.0.0")},_=function(t,e){var n="___fp_swf_loaded";window[n]=function(e){t(e)};var a,r,i=e.fonts.swfContainerId;(r=document.createElement("div")).setAttribute("id",a.fonts.swfContainerId),document.body.appendChild(r);var o={onReady:n};window.swfobject.embedSWF(e.fonts.swfPath,i,"1","1","9.0.0",!1,o,{allowScriptAccess:"always",menu:"false"},{})},F=function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t},G=[{key:"userAgent",getData:function(e){e(navigator.userAgent)}},{key:"language",getData:function(e,t){e(navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||t.NOT_AVAILABLE)}},{key:"colorDepth",getData:function(e,t){e(window.screen.colorDepth||t.NOT_AVAILABLE)}},{key:"deviceMemory",getData:function(e,t){e(navigator.deviceMemory||t.NOT_AVAILABLE)}},{key:"pixelRatio",getData:function(e,t){e(window.devicePixelRatio||t.NOT_AVAILABLE)}},{key:"hardwareConcurrency",getData:function(e,t){e(S(t))}},{key:"screenResolution",getData:function(e,t){e(a(t))}},{key:"availableScreenResolution",getData:function(e,t){e(r(t))}},{key:"timezoneOffset",getData:function(e){e((new Date).getTimezoneOffset())}},{key:"timezone",getData:function(e,t){window.Intl&&window.Intl.DateTimeFormat?e((new window.Intl.DateTimeFormat).resolvedOptions().timeZone):e(t.NOT_AVAILABLE)}},{key:"sessionStorage",getData:function(e,t){e(p(t))}},{key:"localStorage",getData:function(e,t){e(v(t))}},{key:"indexedDb",getData:function(e,t){e(A(t))}},{key:"addBehavior",getData:function(e){e(!(!document.body||!document.body.addBehavior))}},{key:"openDatabase",getData:function(e){e(!!window.openDatabase)}},{key:"cpuClass",getData:function(e,t){e(C(t))}},{key:"platform",getData:function(e,t){e(B(t))}},{key:"doNotTrack",getData:function(e,t){e(w(t))}},{key:"plugins",getData:function(e,t){R()?t.plugins.excludeIE?e(t.EXCLUDED):e(o(t)):e(i(t))}},{key:"canvas",getData:function(e,t){I()?e(y(t)):e(t.NOT_AVAILABLE)}},{key:"webgl",getData:function(e,t){k()?e(E()):e(t.NOT_AVAILABLE)}},{key:"webglVendorAndRenderer",getData:function(e){k()?e(M()):e()}},{key:"adBlock",getData:function(e){e(x())}},{key:"hasLiedLanguages",getData:function(e){e(O())}},{key:"hasLiedResolution",getData:function(e){e(P())}},{key:"hasLiedOs",getData:function(e){e(b())}},{key:"hasLiedBrowser",getData:function(e){e(L())}},{key:"touchSupport",getData:function(e){e(t())}},{key:"fonts",getData:function(e,t){var u=["monospace","sans-serif","serif"],d=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"];t.fonts.extendedJsFonts&&(d=d.concat(["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"]));d=(d=d.concat(t.fonts.userDefinedFonts)).filter(function(e,t){return d.indexOf(e)===t});var n=document.getElementsByTagName("body")[0],r=document.createElement("div"),g=document.createElement("div"),a={},i={},f=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="72px",e.style.fontStyle="normal",e.style.fontWeight="normal",e.style.letterSpacing="normal",e.style.lineBreak="auto",e.style.lineHeight="normal",e.style.textTransform="none",e.style.textAlign="left",e.style.textDecoration="none",e.style.textShadow="none",e.style.whiteSpace="normal",e.style.wordBreak="normal",e.style.wordSpacing="normal",e.innerHTML="mmmmmmmmmmlli",e},o=function(e){for(var t=!1,n=0;n<u.length;n++)if(t=e[n].offsetWidth!==a[u[n]]||e[n].offsetHeight!==i[u[n]])return t;return t},l=function(){for(var e=[],t=0,n=u.length;t<n;t++){var a=f();a.style.fontFamily=u[t],r.appendChild(a),e.push(a)}return e}();n.appendChild(r);for(var s=0,c=u.length;s<c;s++)a[u[s]]=l[s].offsetWidth,i[u[s]]=l[s].offsetHeight;var h=function(){for(var e,t,n,a={},r=0,i=d.length;r<i;r++){for(var o=[],l=0,s=u.length;l<s;l++){var c=(e=d[r],t=u[l],n=void 0,(n=f()).style.fontFamily="'"+e+"',"+t,n);g.appendChild(c),o.push(c)}a[d[r]]=o}return a}();n.appendChild(g);for(var m=[],T=0,p=d.length;T<p;T++)o(h[d[T]])&&m.push(d[T]);n.removeChild(g),n.removeChild(r),e(m)},pauseBefore:!0},{key:"fontsFlash",getData:function(t,e){return D()?N()?e.fonts.swfPath?void _(function(e){t(e)},e):t("missing options.fonts.swfPath"):t("flash not installed"):t("swf object not loaded")},pauseBefore:!0},{key:"audio",getData:function(n,e){var t=e.audio;if(t.excludeIOS11&&navigator.userAgent.match(/OS 11.+Version\/11.+Safari/))return n(e.EXCLUDED);var a=window.OfflineAudioContext||window.webkitOfflineAudioContext;if(null==a)return n(e.NOT_AVAILABLE);var r=new a(1,44100,44100),i=r.createOscillator();i.type="triangle",i.frequency.setValueAtTime(1e4,r.currentTime);var o=r.createDynamicsCompressor();c([["threshold",-50],["knee",40],["ratio",12],["reduction",-20],["attack",0],["release",.25]],function(e){void 0!==o[e[0]]&&"function"==typeof o[e[0]].setValueAtTime&&o[e[0]].setValueAtTime(e[1],r.currentTime)}),i.connect(o),o.connect(r.destination),i.start(0),r.startRendering();var l=setTimeout(function(){return console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: "'+navigator.userAgent+'".'),r.oncomplete=function(){},r=null,n("audioTimeout")},t.timeout);r.oncomplete=function(e){var t;try{clearTimeout(l),t=e.renderedBuffer.getChannelData(0).slice(4500,5e3).reduce(function(e,t){return e+Math.abs(t)},0).toString(),i.disconnect(),o.disconnect()}catch(e){return void n(e)}n(t)}}},{key:"enumerateDevices",getData:function(t,e){if(!n())return t(e.NOT_AVAILABLE);navigator.mediaDevices.enumerateDevices().then(function(e){t(e.map(function(e){return"id="+e.deviceId+";gid="+e.groupId+";"+e.kind+";"+e.label}))}).catch(function(e){t(e)})}}],U=function(e){throw new Error("'new Fingerprint()' is deprecated, see https://github.com/Valve/fingerprintjs2#upgrade-guide-from-182-to-200")};return U.get=function(n,a){a?n||(n={}):(a=n,n={}),function(e,t){if(null==t)return;var n,a;for(a in t)null==(n=t[a])||Object.prototype.hasOwnProperty.call(e,a)||(e[a]=n)}(n,e),n.components=n.extraComponents.concat(G);var r={data:[],addPreprocessedComponent:function(e,t){"function"==typeof n.preprocessor&&(t=n.preprocessor(e,t)),r.data.push({key:e,value:t})}},i=-1,o=function(e){if((i+=1)>=n.components.length)a(r.data);else{var t=n.components[i];if(n.excludes[t.key])o(!1);else{if(!e&&t.pauseBefore)return i-=1,void setTimeout(function(){o(!0)},1);try{t.getData(function(e){r.addPreprocessedComponent(t.key,e),o(!1)},n)}catch(e){r.addPreprocessedComponent(t.key,String(e)),o(!1)}}}};o(!1)},U.getPromise=function(n){return new Promise(function(e,t){U.get(n,e)})},U.getV18=function(i,o){return null==o&&(o=i,i={}),U.get(i,function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n];if(a.value===(i.NOT_AVAILABLE||"not available"))t.push({key:a.key,value:"unknown"});else if("plugins"===a.key)t.push({key:"plugins",value:s(a.value,function(e){var t=s(e[2],function(e){return e.join?e.join("~"):e}).join(",");return[e[0],e[1],t].join("::")})});else if(-1!==["canvas","webgl"].indexOf(a.key))t.push({key:a.key,value:a.value.join("~")});else if(-1!==["sessionStorage","localStorage","indexedDb","addBehavior","openDatabase"].indexOf(a.key)){if(!a.value)continue;t.push({key:a.key,value:1})}else a.value?t.push(a.value.join?{key:a.key,value:a.value.join(";")}:a):t.push({key:a.key,value:a.value})}var r=l(s(t,function(e){return e.value}).join("~~~"),31);o(r,t)})},U.x64hash128=l,U.VERSION="2.0.0",U}); |
2496
fingerprint2.js
/* | ||
* Fingerprintjs2 1.8.0 - Modern & flexible browser fingerprint library v2 | ||
* Fingerprintjs2 2.0.0 - Modern & flexible browser fingerprint library v2 | ||
* https://github.com/Valve/fingerprintjs2 | ||
@@ -21,114 +21,335 @@ * Copyright (c) 2015 Valentin Vasilyev (valentin.vasilyev@outlook.com) | ||
'use strict' | ||
if (typeof window.define === 'function' && window.define.amd) { window.define(definition) } else if (typeof module !== 'undefined' && module.exports) { module.exports = definition() } else if (context.exports) { context.exports = definition() } else { context[name] = definition() } | ||
if (typeof window !== 'undefined' && typeof window.define === 'function' && window.define.amd) { window.define(definition) } else if (typeof module !== 'undefined' && module.exports) { module.exports = definition() } else if (context.exports) { context.exports = definition() } else { context[name] = definition() } | ||
})('Fingerprint2', this, function () { | ||
'use strict' | ||
/** | ||
* @constructor | ||
* @param {Object=} options | ||
*/ | ||
var Fingerprint2 = function (options) { | ||
if (!(this instanceof Fingerprint2)) { | ||
return new Fingerprint2(options) | ||
/// MurmurHash3 related functions | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// added together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
var x64Add = function (m, n) { | ||
m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] | ||
n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] | ||
var o = [0, 0, 0, 0] | ||
o[3] += m[3] + n[3] | ||
o[2] += o[3] >>> 16 | ||
o[3] &= 0xffff | ||
o[2] += m[2] + n[2] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[1] += m[1] + n[1] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[0] += m[0] + n[0] | ||
o[0] &= 0xffff | ||
return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] | ||
} | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// multiplied together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
var x64Multiply = function (m, n) { | ||
m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] | ||
n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] | ||
var o = [0, 0, 0, 0] | ||
o[3] += m[3] * n[3] | ||
o[2] += o[3] >>> 16 | ||
o[3] &= 0xffff | ||
o[2] += m[2] * n[3] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[2] += m[3] * n[2] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[1] += m[1] * n[3] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[1] += m[2] * n[2] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[1] += m[3] * n[1] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[0] += (m[0] * n[3]) + (m[1] * n[2]) + (m[2] * n[1]) + (m[3] * n[0]) | ||
o[0] &= 0xffff | ||
return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] | ||
} | ||
// | ||
// Given a 64bit int (as an array of two 32bit ints) and an int | ||
// representing a number of bit positions, returns the 64bit int (as an | ||
// array of two 32bit ints) rotated left by that number of positions. | ||
// | ||
var x64Rotl = function (m, n) { | ||
n %= 64 | ||
if (n === 32) { | ||
return [m[1], m[0]] | ||
} else if (n < 32) { | ||
return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))] | ||
} else { | ||
n -= 32 | ||
return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))] | ||
} | ||
} | ||
// | ||
// Given a 64bit int (as an array of two 32bit ints) and an int | ||
// representing a number of bit positions, returns the 64bit int (as an | ||
// array of two 32bit ints) shifted left by that number of positions. | ||
// | ||
var x64LeftShift = function (m, n) { | ||
n %= 64 | ||
if (n === 0) { | ||
return m | ||
} else if (n < 32) { | ||
return [(m[0] << n) | (m[1] >>> (32 - n)), m[1] << n] | ||
} else { | ||
return [m[1] << (n - 32), 0] | ||
} | ||
} | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// xored together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
var x64Xor = function (m, n) { | ||
return [m[0] ^ n[0], m[1] ^ n[1]] | ||
} | ||
// | ||
// Given a block, returns murmurHash3's final x64 mix of that block. | ||
// (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the | ||
// only place where we need to right shift 64bit ints.) | ||
// | ||
var x64Fmix = function (h) { | ||
h = x64Xor(h, [0, h[0] >>> 1]) | ||
h = x64Multiply(h, [0xff51afd7, 0xed558ccd]) | ||
h = x64Xor(h, [0, h[0] >>> 1]) | ||
h = x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]) | ||
h = x64Xor(h, [0, h[0] >>> 1]) | ||
return h | ||
} | ||
var defaultOptions = { | ||
// | ||
// Given a string and an optional seed as an int, returns a 128 bit | ||
// hash using the x64 flavor of MurmurHash3, as an unsigned hex. | ||
// | ||
var x64hash128 = function (key, seed) { | ||
key = key || '' | ||
seed = seed || 0 | ||
var remainder = key.length % 16 | ||
var bytes = key.length - remainder | ||
var h1 = [0, seed] | ||
var h2 = [0, seed] | ||
var k1 = [0, 0] | ||
var k2 = [0, 0] | ||
var c1 = [0x87c37b91, 0x114253d5] | ||
var c2 = [0x4cf5ad43, 0x2745937f] | ||
for (var i = 0; i < bytes; i = i + 16) { | ||
k1 = [((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24), ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24)] | ||
k2 = [((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24), ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24)] | ||
k1 = x64Multiply(k1, c1) | ||
k1 = x64Rotl(k1, 31) | ||
k1 = x64Multiply(k1, c2) | ||
h1 = x64Xor(h1, k1) | ||
h1 = x64Rotl(h1, 27) | ||
h1 = x64Add(h1, h2) | ||
h1 = x64Add(x64Multiply(h1, [0, 5]), [0, 0x52dce729]) | ||
k2 = x64Multiply(k2, c2) | ||
k2 = x64Rotl(k2, 33) | ||
k2 = x64Multiply(k2, c1) | ||
h2 = x64Xor(h2, k2) | ||
h2 = x64Rotl(h2, 31) | ||
h2 = x64Add(h2, h1) | ||
h2 = x64Add(x64Multiply(h2, [0, 5]), [0, 0x38495ab5]) | ||
} | ||
k1 = [0, 0] | ||
k2 = [0, 0] | ||
switch (remainder) { | ||
case 15: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 14)], 48)) | ||
// fallthrough | ||
case 14: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 13)], 40)) | ||
// fallthrough | ||
case 13: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 12)], 32)) | ||
// fallthrough | ||
case 12: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 11)], 24)) | ||
// fallthrough | ||
case 11: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 10)], 16)) | ||
// fallthrough | ||
case 10: | ||
k2 = x64Xor(k2, x64LeftShift([0, key.charCodeAt(i + 9)], 8)) | ||
// fallthrough | ||
case 9: | ||
k2 = x64Xor(k2, [0, key.charCodeAt(i + 8)]) | ||
k2 = x64Multiply(k2, c2) | ||
k2 = x64Rotl(k2, 33) | ||
k2 = x64Multiply(k2, c1) | ||
h2 = x64Xor(h2, k2) | ||
// fallthrough | ||
case 8: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 7)], 56)) | ||
// fallthrough | ||
case 7: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 6)], 48)) | ||
// fallthrough | ||
case 6: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 5)], 40)) | ||
// fallthrough | ||
case 5: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 4)], 32)) | ||
// fallthrough | ||
case 4: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 3)], 24)) | ||
// fallthrough | ||
case 3: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 2)], 16)) | ||
// fallthrough | ||
case 2: | ||
k1 = x64Xor(k1, x64LeftShift([0, key.charCodeAt(i + 1)], 8)) | ||
// fallthrough | ||
case 1: | ||
k1 = x64Xor(k1, [0, key.charCodeAt(i)]) | ||
k1 = x64Multiply(k1, c1) | ||
k1 = x64Rotl(k1, 31) | ||
k1 = x64Multiply(k1, c2) | ||
h1 = x64Xor(h1, k1) | ||
// fallthrough | ||
} | ||
h1 = x64Xor(h1, [0, key.length]) | ||
h2 = x64Xor(h2, [0, key.length]) | ||
h1 = x64Add(h1, h2) | ||
h2 = x64Add(h2, h1) | ||
h1 = x64Fmix(h1) | ||
h2 = x64Fmix(h2) | ||
h1 = x64Add(h1, h2) | ||
h2 = x64Add(h2, h1) | ||
return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8) | ||
} | ||
var defaultOptions = { | ||
preprocessor: null, | ||
audio: { | ||
timeout: 1000, | ||
// On iOS 11, audio context can only be used in response to user interaction. | ||
// We require users to explicitly enable audio fingerprinting on iOS 11. | ||
// See https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088 | ||
excludeIOS11: true | ||
}, | ||
fonts: { | ||
swfContainerId: 'fingerprintjs2', | ||
swfPath: 'flash/compiled/FontList.swf', | ||
detectScreenOrientation: true, | ||
userDefinedFonts: [], | ||
extendedJsFonts: false | ||
}, | ||
screen: { | ||
// To ensure consistent fingerprints when users rotate their mobile devices | ||
detectScreenOrientation: true | ||
}, | ||
plugins: { | ||
sortPluginsFor: [/palemoon/i], | ||
userDefinedFonts: [], | ||
excludeDoNotTrack: true, | ||
excludePixelRatio: true | ||
} | ||
this.options = this.extend(options, defaultOptions) | ||
this.nativeForEach = Array.prototype.forEach | ||
this.nativeMap = Array.prototype.map | ||
excludeIE: false | ||
}, | ||
extraComponents: [], | ||
excludes: { | ||
// Unreliable on Windows, see https://github.com/Valve/fingerprintjs2/issues/375 | ||
'enumerateDevices': true, | ||
// devicePixelRatio depends on browser zoom, and it's impossible to detect browser zoom | ||
'pixelRatio': true, | ||
// DNT depends on incognito mode for some browsers (Chrome) and it's impossible to detect incognito mode | ||
'doNotTrack': true, | ||
// uses js fonts already | ||
'fontsFlash': true | ||
}, | ||
NOT_AVAILABLE: 'not available', | ||
ERROR: 'error', | ||
EXCLUDED: 'excluded' | ||
} | ||
Fingerprint2.prototype = { | ||
extend: function (source, target) { | ||
if (source == null) { return target } | ||
for (var k in source) { | ||
if (source[k] != null && target[k] !== source[k]) { | ||
target[k] = source[k] | ||
} | ||
var each = function (obj, iterator) { | ||
if (Array.prototype.forEach && obj.forEach === Array.prototype.forEach) { | ||
obj.forEach(iterator) | ||
} else if (obj.length === +obj.length) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
iterator(obj[i], i, obj) | ||
} | ||
return target | ||
}, | ||
get: function (done) { | ||
var that = this | ||
var keys = { | ||
data: [], | ||
addPreprocessedComponent: function (pair) { | ||
var componentValue = pair.value | ||
if (typeof that.options.preprocessor === 'function') { | ||
componentValue = that.options.preprocessor(pair.key, componentValue) | ||
} | ||
keys.data.push({key: pair.key, value: componentValue}) | ||
} else { | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
iterator(obj[key], key, obj) | ||
} | ||
} | ||
keys = this.userAgentKey(keys) | ||
keys = this.languageKey(keys) | ||
keys = this.colorDepthKey(keys) | ||
keys = this.deviceMemoryKey(keys) | ||
keys = this.pixelRatioKey(keys) | ||
keys = this.hardwareConcurrencyKey(keys) | ||
keys = this.screenResolutionKey(keys) | ||
keys = this.availableScreenResolutionKey(keys) | ||
keys = this.timezoneOffsetKey(keys) | ||
keys = this.sessionStorageKey(keys) | ||
keys = this.localStorageKey(keys) | ||
keys = this.indexedDbKey(keys) | ||
keys = this.addBehaviorKey(keys) | ||
keys = this.openDatabaseKey(keys) | ||
keys = this.cpuClassKey(keys) | ||
keys = this.platformKey(keys) | ||
keys = this.doNotTrackKey(keys) | ||
keys = this.pluginsKey(keys) | ||
keys = this.canvasKey(keys) | ||
keys = this.webglKey(keys) | ||
keys = this.webglVendorAndRendererKey(keys) | ||
keys = this.adBlockKey(keys) | ||
keys = this.hasLiedLanguagesKey(keys) | ||
keys = this.hasLiedResolutionKey(keys) | ||
keys = this.hasLiedOsKey(keys) | ||
keys = this.hasLiedBrowserKey(keys) | ||
keys = this.touchSupportKey(keys) | ||
keys = this.customEntropyFunction(keys) | ||
this.fontsKey(keys, function (keysWithFont) { | ||
that.audioKey(keysWithFont, function (newKeys) { | ||
var values = [] | ||
that.each(newKeys.data, function (pair) { | ||
var value = pair.value | ||
if (value && typeof value.join === 'function') { | ||
values.push(value.join(';')) | ||
} else { | ||
values.push(value) | ||
} | ||
}) | ||
var murmur = that.x64hash128(values.join('~~~'), 31) | ||
return done(murmur, newKeys.data) | ||
}) | ||
}) | ||
}, | ||
// Inspired by and based on https://github.com/cozylife/audio-fingerprint | ||
audioKey: function (keys, done) { | ||
if (this.options.excludeAudioFP) { | ||
return done(keys) | ||
} | ||
} | ||
} | ||
var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext | ||
var map = function (obj, iterator) { | ||
var results = [] | ||
// Not using strict equality so that this acts as a | ||
// shortcut to checking for `null` and `undefined`. | ||
if (obj == null) { | ||
return results | ||
} | ||
if (Array.prototype.map && obj.map === Array.prototype.map) { return obj.map(iterator) } | ||
each(obj, function (value, index, list) { | ||
results.push(iterator(value, index, list)) | ||
}) | ||
return results | ||
} | ||
if (AudioContext == null) { | ||
keys.addPreprocessedComponent({key: 'audio_fp', value: null}) | ||
return done(keys) | ||
var extendSoft = function (target, source) { | ||
if (source == null) { return target } | ||
var value | ||
var key | ||
for (key in source) { | ||
value = source[key] | ||
if (value != null && !(Object.prototype.hasOwnProperty.call(target, key))) { | ||
target[key] = value | ||
} | ||
} | ||
return target | ||
} | ||
var context = new AudioContext(1, 44100, 44100) | ||
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices | ||
var enumerateDevicesKey = function (done, options) { | ||
if (!isEnumerateDevicesSupported()) { | ||
return done(options.NOT_AVAILABLE) | ||
} | ||
navigator.mediaDevices.enumerateDevices().then(function (devices) { | ||
done(devices.map(function (device) { | ||
return 'id=' + device.deviceId + ';gid=' + device.groupId + ';' + device.kind + ';' + device.label | ||
})) | ||
}) | ||
.catch(function (error) { | ||
done(error) | ||
}) | ||
} | ||
var oscillator = context.createOscillator() | ||
oscillator.type = 'triangle' | ||
oscillator.frequency.setValueAtTime(10000, context.currentTime) | ||
var isEnumerateDevicesSupported = function () { | ||
return (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) | ||
} | ||
// Inspired by and based on https://github.com/cozylife/audio-fingerprint | ||
var audioKey = function (done, options) { | ||
var audioOptions = options.audio | ||
if (audioOptions.excludeIOS11 && navigator.userAgent.match(/OS 11.+Version\/11.+Safari/)) { | ||
// See comment for excludeUserAgent and https://stackoverflow.com/questions/46363048/onaudioprocess-not-called-on-ios11#46534088 | ||
return done(options.EXCLUDED) | ||
} | ||
var compressor = context.createDynamicsCompressor() | ||
this.each([ | ||
var AudioContext = window.OfflineAudioContext || window.webkitOfflineAudioContext | ||
if (AudioContext == null) { | ||
return done(options.NOT_AVAILABLE) | ||
} | ||
var context = new AudioContext(1, 44100, 44100) | ||
var oscillator = context.createOscillator() | ||
oscillator.type = 'triangle' | ||
oscillator.frequency.setValueAtTime(10000, context.currentTime) | ||
var compressor = context.createDynamicsCompressor() | ||
each([ | ||
['threshold', -50], | ||
@@ -140,640 +361,559 @@ ['knee', 40], | ||
['release', 0.25] | ||
], function (item) { | ||
if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') { | ||
compressor[item[0]].setValueAtTime(item[1], context.currentTime) | ||
} | ||
}) | ||
], function (item) { | ||
if (compressor[item[0]] !== undefined && typeof compressor[item[0]].setValueAtTime === 'function') { | ||
compressor[item[0]].setValueAtTime(item[1], context.currentTime) | ||
} | ||
}) | ||
context.oncomplete = function (event) { | ||
var fingerprint = event.renderedBuffer.getChannelData(0) | ||
.slice(4500, 5000) | ||
.reduce(function (acc, val) { return acc + Math.abs(val) }, 0) | ||
.toString() | ||
oscillator.connect(compressor) | ||
compressor.connect(context.destination) | ||
oscillator.start(0) | ||
context.startRendering() | ||
var audioTimeoutId = setTimeout(function () { | ||
console.warn('Audio fingerprint timed out. Please report bug at https://github.com/Valve/fingerprintjs2 with your user agent: "' + navigator.userAgent + '".') | ||
context.oncomplete = function () {} | ||
context = null | ||
return done('audioTimeout') | ||
}, audioOptions.timeout) | ||
context.oncomplete = function (event) { | ||
var fingerprint | ||
try { | ||
clearTimeout(audioTimeoutId) | ||
fingerprint = event.renderedBuffer.getChannelData(0) | ||
.slice(4500, 5000) | ||
.reduce(function (acc, val) { return acc + Math.abs(val) }, 0) | ||
.toString() | ||
oscillator.disconnect() | ||
compressor.disconnect() | ||
keys.addPreprocessedComponent({key: 'audio_fp', value: fingerprint}) | ||
return done(keys) | ||
} catch (error) { | ||
done(error) | ||
return | ||
} | ||
oscillator.connect(compressor) | ||
compressor.connect(context.destination) | ||
oscillator.start(0) | ||
context.startRendering() | ||
}, | ||
customEntropyFunction: function (keys) { | ||
if (typeof this.options.customFunction === 'function') { | ||
keys.addPreprocessedComponent({key: 'custom', value: this.options.customFunction()}) | ||
done(fingerprint) | ||
} | ||
} | ||
var UserAgent = function (done) { | ||
done(navigator.userAgent) | ||
} | ||
var languageKey = function (done, options) { | ||
done(navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || options.NOT_AVAILABLE) | ||
} | ||
var colorDepthKey = function (done, options) { | ||
done(window.screen.colorDepth || options.NOT_AVAILABLE) | ||
} | ||
var deviceMemoryKey = function (done, options) { | ||
done(navigator.deviceMemory || options.NOT_AVAILABLE) | ||
} | ||
var pixelRatioKey = function (done, options) { | ||
done(window.devicePixelRatio || options.NOT_AVAILABLE) | ||
} | ||
var screenResolutionKey = function (done, options) { | ||
done(getScreenResolution(options)) | ||
} | ||
var getScreenResolution = function (options) { | ||
var resolution = [window.screen.width, window.screen.height] | ||
if (options.screen.detectScreenOrientation) { | ||
resolution.sort().reverse() | ||
} | ||
return resolution | ||
} | ||
var availableScreenResolutionKey = function (done, options) { | ||
done(getAvailableScreenResolution(options)) | ||
} | ||
var getAvailableScreenResolution = function (options) { | ||
if (window.screen.availWidth && window.screen.availHeight) { | ||
var available = [window.screen.availHeight, window.screen.availWidth] | ||
if (options.screen.detectScreenOrientation) { | ||
available.sort().reverse() | ||
} | ||
return keys | ||
}, | ||
userAgentKey: function (keys) { | ||
if (!this.options.excludeUserAgent) { | ||
keys.addPreprocessedComponent({key: 'user_agent', value: this.getUserAgent()}) | ||
} | ||
return keys | ||
}, | ||
// for tests | ||
getUserAgent: function () { | ||
return navigator.userAgent | ||
}, | ||
languageKey: function (keys) { | ||
if (!this.options.excludeLanguage) { | ||
// IE 9,10 on Windows 10 does not have the `navigator.language` property any longer | ||
keys.addPreprocessedComponent({key: 'language', value: navigator.language || navigator.userLanguage || navigator.browserLanguage || navigator.systemLanguage || ''}) | ||
} | ||
return keys | ||
}, | ||
colorDepthKey: function (keys) { | ||
if (!this.options.excludeColorDepth) { | ||
keys.addPreprocessedComponent({key: 'color_depth', value: window.screen.colorDepth || -1}) | ||
} | ||
return keys | ||
}, | ||
deviceMemoryKey: function (keys) { | ||
if (!this.options.excludeDeviceMemory) { | ||
keys.addPreprocessedComponent({key: 'device_memory', value: this.getDeviceMemory()}) | ||
} | ||
return keys | ||
}, | ||
getDeviceMemory: function () { | ||
return navigator.deviceMemory || -1 | ||
}, | ||
pixelRatioKey: function (keys) { | ||
if (!this.options.excludePixelRatio) { | ||
keys.addPreprocessedComponent({key: 'pixel_ratio', value: this.getPixelRatio()}) | ||
} | ||
return keys | ||
}, | ||
getPixelRatio: function () { | ||
return window.devicePixelRatio || '' | ||
}, | ||
screenResolutionKey: function (keys) { | ||
if (!this.options.excludeScreenResolution) { | ||
return this.getScreenResolution(keys) | ||
} | ||
return keys | ||
}, | ||
getScreenResolution: function (keys) { | ||
var resolution | ||
if (this.options.detectScreenOrientation) { | ||
resolution = (window.screen.height > window.screen.width) ? [window.screen.height, window.screen.width] : [window.screen.width, window.screen.height] | ||
} else { | ||
resolution = [window.screen.width, window.screen.height] | ||
} | ||
keys.addPreprocessedComponent({key: 'resolution', value: resolution}) | ||
return keys | ||
}, | ||
availableScreenResolutionKey: function (keys) { | ||
if (!this.options.excludeAvailableScreenResolution) { | ||
return this.getAvailableScreenResolution(keys) | ||
} | ||
return keys | ||
}, | ||
getAvailableScreenResolution: function (keys) { | ||
var available | ||
if (window.screen.availWidth && window.screen.availHeight) { | ||
if (this.options.detectScreenOrientation) { | ||
available = (window.screen.availHeight > window.screen.availWidth) ? [window.screen.availHeight, window.screen.availWidth] : [window.screen.availWidth, window.screen.availHeight] | ||
} else { | ||
available = [window.screen.availHeight, window.screen.availWidth] | ||
} | ||
} | ||
if (typeof available !== 'undefined') { // headless browsers | ||
keys.addPreprocessedComponent({key: 'available_resolution', value: available}) | ||
} | ||
return keys | ||
}, | ||
timezoneOffsetKey: function (keys) { | ||
if (!this.options.excludeTimezoneOffset) { | ||
keys.addPreprocessedComponent({key: 'timezone_offset', value: new Date().getTimezoneOffset()}) | ||
} | ||
return keys | ||
}, | ||
sessionStorageKey: function (keys) { | ||
if (!this.options.excludeSessionStorage && this.hasSessionStorage()) { | ||
keys.addPreprocessedComponent({key: 'session_storage', value: 1}) | ||
} | ||
return keys | ||
}, | ||
localStorageKey: function (keys) { | ||
if (!this.options.excludeSessionStorage && this.hasLocalStorage()) { | ||
keys.addPreprocessedComponent({key: 'local_storage', value: 1}) | ||
} | ||
return keys | ||
}, | ||
indexedDbKey: function (keys) { | ||
if (!this.options.excludeIndexedDB && this.hasIndexedDB()) { | ||
keys.addPreprocessedComponent({key: 'indexed_db', value: 1}) | ||
} | ||
return keys | ||
}, | ||
addBehaviorKey: function (keys) { | ||
return available | ||
} | ||
// headless browsers | ||
return options.NOT_AVAILABLE | ||
} | ||
var timezoneOffset = function (done) { | ||
done(new Date().getTimezoneOffset()) | ||
} | ||
var timezone = function (done, options) { | ||
if (window.Intl && window.Intl.DateTimeFormat) { | ||
done(new window.Intl.DateTimeFormat().resolvedOptions().timeZone) | ||
return | ||
} | ||
done(options.NOT_AVAILABLE) | ||
} | ||
var sessionStorageKey = function (done, options) { | ||
done(hasSessionStorage(options)) | ||
} | ||
var localStorageKey = function (done, options) { | ||
done(hasLocalStorage(options)) | ||
} | ||
var indexedDbKey = function (done, options) { | ||
done(hasIndexedDB(options)) | ||
} | ||
var addBehaviorKey = function (done) { | ||
// body might not be defined at this point or removed programmatically | ||
if (!this.options.excludeAddBehavior && document.body && document.body.addBehavior) { | ||
keys.addPreprocessedComponent({key: 'add_behavior', value: 1}) | ||
} | ||
return keys | ||
}, | ||
openDatabaseKey: function (keys) { | ||
if (!this.options.excludeOpenDatabase && window.openDatabase) { | ||
keys.addPreprocessedComponent({key: 'open_database', value: 1}) | ||
} | ||
return keys | ||
}, | ||
cpuClassKey: function (keys) { | ||
if (!this.options.excludeCpuClass) { | ||
keys.addPreprocessedComponent({key: 'cpu_class', value: this.getNavigatorCpuClass()}) | ||
} | ||
return keys | ||
}, | ||
platformKey: function (keys) { | ||
if (!this.options.excludePlatform) { | ||
keys.addPreprocessedComponent({key: 'navigator_platform', value: this.getNavigatorPlatform()}) | ||
} | ||
return keys | ||
}, | ||
doNotTrackKey: function (keys) { | ||
if (!this.options.excludeDoNotTrack) { | ||
keys.addPreprocessedComponent({key: 'do_not_track', value: this.getDoNotTrack()}) | ||
} | ||
return keys | ||
}, | ||
canvasKey: function (keys) { | ||
if (!this.options.excludeCanvas && this.isCanvasSupported()) { | ||
keys.addPreprocessedComponent({key: 'canvas', value: this.getCanvasFp()}) | ||
} | ||
return keys | ||
}, | ||
webglKey: function (keys) { | ||
if (!this.options.excludeWebGL && this.isWebGlSupported()) { | ||
keys.addPreprocessedComponent({key: 'webgl', value: this.getWebglFp()}) | ||
} | ||
return keys | ||
}, | ||
webglVendorAndRendererKey: function (keys) { | ||
if (!this.options.excludeWebGLVendorAndRenderer && this.isWebGlSupported()) { | ||
keys.addPreprocessedComponent({key: 'webgl_vendor', value: this.getWebglVendorAndRenderer()}) | ||
} | ||
return keys | ||
}, | ||
adBlockKey: function (keys) { | ||
if (!this.options.excludeAdBlock) { | ||
keys.addPreprocessedComponent({key: 'adblock', value: this.getAdBlock()}) | ||
} | ||
return keys | ||
}, | ||
hasLiedLanguagesKey: function (keys) { | ||
if (!this.options.excludeHasLiedLanguages) { | ||
keys.addPreprocessedComponent({key: 'has_lied_languages', value: this.getHasLiedLanguages()}) | ||
} | ||
return keys | ||
}, | ||
hasLiedResolutionKey: function (keys) { | ||
if (!this.options.excludeHasLiedResolution) { | ||
keys.addPreprocessedComponent({key: 'has_lied_resolution', value: this.getHasLiedResolution()}) | ||
} | ||
return keys | ||
}, | ||
hasLiedOsKey: function (keys) { | ||
if (!this.options.excludeHasLiedOs) { | ||
keys.addPreprocessedComponent({key: 'has_lied_os', value: this.getHasLiedOs()}) | ||
} | ||
return keys | ||
}, | ||
hasLiedBrowserKey: function (keys) { | ||
if (!this.options.excludeHasLiedBrowser) { | ||
keys.addPreprocessedComponent({key: 'has_lied_browser', value: this.getHasLiedBrowser()}) | ||
} | ||
return keys | ||
}, | ||
fontsKey: function (keys, done) { | ||
if (this.options.excludeJsFonts) { | ||
return this.flashFontsKey(keys, done) | ||
} | ||
return this.jsFontsKey(keys, done) | ||
}, | ||
// flash fonts (will increase fingerprinting time 20X to ~ 130-150ms) | ||
flashFontsKey: function (keys, done) { | ||
if (this.options.excludeFlashFonts) { | ||
return done(keys) | ||
} | ||
// we do flash if swfobject is loaded | ||
if (!this.hasSwfObjectLoaded()) { | ||
return done(keys) | ||
} | ||
if (!this.hasMinFlashInstalled()) { | ||
return done(keys) | ||
} | ||
if (typeof this.options.swfPath === 'undefined') { | ||
return done(keys) | ||
} | ||
this.loadSwfAndDetectFonts(function (fonts) { | ||
keys.addPreprocessedComponent({key: 'swf_fonts', value: fonts.join(';')}) | ||
done(keys) | ||
}) | ||
}, | ||
// kudos to http://www.lalit.org/lab/javascript-css-font-detect/ | ||
jsFontsKey: function (keys, done) { | ||
var that = this | ||
// doing js fonts detection in a pseudo-async fashion | ||
return setTimeout(function () { | ||
// a font will be compared against all the three default fonts. | ||
// and if it doesn't match all 3 then that font is not available. | ||
var baseFonts = ['monospace', 'sans-serif', 'serif'] | ||
done(!!(document.body && document.body.addBehavior)) | ||
} | ||
var openDatabaseKey = function (done) { | ||
done(!!window.openDatabase) | ||
} | ||
var cpuClassKey = function (done, options) { | ||
done(getNavigatorCpuClass(options)) | ||
} | ||
var platformKey = function (done, options) { | ||
done(getNavigatorPlatform(options)) | ||
} | ||
var doNotTrackKey = function (done, options) { | ||
done(getDoNotTrack(options)) | ||
} | ||
var canvasKey = function (done, options) { | ||
if (isCanvasSupported()) { | ||
done(getCanvasFp(options)) | ||
return | ||
} | ||
done(options.NOT_AVAILABLE) | ||
} | ||
var webglKey = function (done, options) { | ||
if (isWebGlSupported()) { | ||
done(getWebglFp()) | ||
return | ||
} | ||
done(options.NOT_AVAILABLE) | ||
} | ||
var webglVendorAndRendererKey = function (done) { | ||
if (isWebGlSupported()) { | ||
done(getWebglVendorAndRenderer()) | ||
return | ||
} | ||
done() | ||
} | ||
var adBlockKey = function (done) { | ||
done(getAdBlock()) | ||
} | ||
var hasLiedLanguagesKey = function (done) { | ||
done(getHasLiedLanguages()) | ||
} | ||
var hasLiedResolutionKey = function (done) { | ||
done(getHasLiedResolution()) | ||
} | ||
var hasLiedOsKey = function (done) { | ||
done(getHasLiedOs()) | ||
} | ||
var hasLiedBrowserKey = function (done) { | ||
done(getHasLiedBrowser()) | ||
} | ||
// flash fonts (will increase fingerprinting time 20X to ~ 130-150ms) | ||
var flashFontsKey = function (done, options) { | ||
// we do flash if swfobject is loaded | ||
if (!hasSwfObjectLoaded()) { | ||
return done('swf object not loaded') | ||
} | ||
if (!hasMinFlashInstalled()) { | ||
return done('flash not installed') | ||
} | ||
if (!options.fonts.swfPath) { | ||
return done('missing options.fonts.swfPath') | ||
} | ||
loadSwfAndDetectFonts(function (fonts) { | ||
done(fonts) | ||
}, options) | ||
} | ||
// kudos to http://www.lalit.org/lab/javascript-css-font-detect/ | ||
var jsFontsKey = function (done, options) { | ||
// a font will be compared against all the three default fonts. | ||
// and if it doesn't match all 3 then that font is not available. | ||
var baseFonts = ['monospace', 'sans-serif', 'serif'] | ||
var fontList = [ | ||
'Andale Mono', 'Arial', 'Arial Black', 'Arial Hebrew', 'Arial MT', 'Arial Narrow', 'Arial Rounded MT Bold', 'Arial Unicode MS', | ||
'Bitstream Vera Sans Mono', 'Book Antiqua', 'Bookman Old Style', | ||
'Calibri', 'Cambria', 'Cambria Math', 'Century', 'Century Gothic', 'Century Schoolbook', 'Comic Sans', 'Comic Sans MS', 'Consolas', 'Courier', 'Courier New', | ||
'Geneva', 'Georgia', | ||
'Helvetica', 'Helvetica Neue', | ||
'Impact', | ||
'Lucida Bright', 'Lucida Calligraphy', 'Lucida Console', 'Lucida Fax', 'LUCIDA GRANDE', 'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter', 'Lucida Sans Unicode', | ||
'Microsoft Sans Serif', 'Monaco', 'Monotype Corsiva', 'MS Gothic', 'MS Outlook', 'MS PGothic', 'MS Reference Sans Serif', 'MS Sans Serif', 'MS Serif', 'MYRIAD', 'MYRIAD PRO', | ||
'Palatino', 'Palatino Linotype', | ||
'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Light', 'Segoe UI Semibold', 'Segoe UI Symbol', | ||
'Tahoma', 'Times', 'Times New Roman', 'Times New Roman PS', 'Trebuchet MS', | ||
'Verdana', 'Wingdings', 'Wingdings 2', 'Wingdings 3' | ||
] | ||
var extendedFontList = [ | ||
'Abadi MT Condensed Light', 'Academy Engraved LET', 'ADOBE CASLON PRO', 'Adobe Garamond', 'ADOBE GARAMOND PRO', 'Agency FB', 'Aharoni', 'Albertus Extra Bold', 'Albertus Medium', 'Algerian', 'Amazone BT', 'American Typewriter', | ||
'American Typewriter Condensed', 'AmerType Md BT', 'Andalus', 'Angsana New', 'AngsanaUPC', 'Antique Olive', 'Aparajita', 'Apple Chancery', 'Apple Color Emoji', 'Apple SD Gothic Neo', 'Arabic Typesetting', 'ARCHER', | ||
'ARNO PRO', 'Arrus BT', 'Aurora Cn BT', 'AvantGarde Bk BT', 'AvantGarde Md BT', 'AVENIR', 'Ayuthaya', 'Bandy', 'Bangla Sangam MN', 'Bank Gothic', 'BankGothic Md BT', 'Baskerville', | ||
'Baskerville Old Face', 'Batang', 'BatangChe', 'Bauer Bodoni', 'Bauhaus 93', 'Bazooka', 'Bell MT', 'Bembo', 'Benguiat Bk BT', 'Berlin Sans FB', 'Berlin Sans FB Demi', 'Bernard MT Condensed', 'BernhardFashion BT', 'BernhardMod BT', 'Big Caslon', 'BinnerD', | ||
'Blackadder ITC', 'BlairMdITC TT', 'Bodoni 72', 'Bodoni 72 Oldstyle', 'Bodoni 72 Smallcaps', 'Bodoni MT', 'Bodoni MT Black', 'Bodoni MT Condensed', 'Bodoni MT Poster Compressed', | ||
'Bookshelf Symbol 7', 'Boulder', 'Bradley Hand', 'Bradley Hand ITC', 'Bremen Bd BT', 'Britannic Bold', 'Broadway', 'Browallia New', 'BrowalliaUPC', 'Brush Script MT', 'Californian FB', 'Calisto MT', 'Calligrapher', 'Candara', | ||
'CaslonOpnface BT', 'Castellar', 'Centaur', 'Cezanne', 'CG Omega', 'CG Times', 'Chalkboard', 'Chalkboard SE', 'Chalkduster', 'Charlesworth', 'Charter Bd BT', 'Charter BT', 'Chaucer', | ||
'ChelthmITC Bk BT', 'Chiller', 'Clarendon', 'Clarendon Condensed', 'CloisterBlack BT', 'Cochin', 'Colonna MT', 'Constantia', 'Cooper Black', 'Copperplate', 'Copperplate Gothic', 'Copperplate Gothic Bold', | ||
'Copperplate Gothic Light', 'CopperplGoth Bd BT', 'Corbel', 'Cordia New', 'CordiaUPC', 'Cornerstone', 'Coronet', 'Cuckoo', 'Curlz MT', 'DaunPenh', 'Dauphin', 'David', 'DB LCD Temp', 'DELICIOUS', 'Denmark', | ||
'DFKai-SB', 'Didot', 'DilleniaUPC', 'DIN', 'DokChampa', 'Dotum', 'DotumChe', 'Ebrima', 'Edwardian Script ITC', 'Elephant', 'English 111 Vivace BT', 'Engravers MT', 'EngraversGothic BT', 'Eras Bold ITC', 'Eras Demi ITC', 'Eras Light ITC', 'Eras Medium ITC', | ||
'EucrosiaUPC', 'Euphemia', 'Euphemia UCAS', 'EUROSTILE', 'Exotc350 Bd BT', 'FangSong', 'Felix Titling', 'Fixedsys', 'FONTIN', 'Footlight MT Light', 'Forte', | ||
'FrankRuehl', 'Fransiscan', 'Freefrm721 Blk BT', 'FreesiaUPC', 'Freestyle Script', 'French Script MT', 'FrnkGothITC Bk BT', 'Fruitger', 'FRUTIGER', | ||
'Futura', 'Futura Bk BT', 'Futura Lt BT', 'Futura Md BT', 'Futura ZBlk BT', 'FuturaBlack BT', 'Gabriola', 'Galliard BT', 'Gautami', 'Geeza Pro', 'Geometr231 BT', 'Geometr231 Hv BT', 'Geometr231 Lt BT', 'GeoSlab 703 Lt BT', | ||
'GeoSlab 703 XBd BT', 'Gigi', 'Gill Sans', 'Gill Sans MT', 'Gill Sans MT Condensed', 'Gill Sans MT Ext Condensed Bold', 'Gill Sans Ultra Bold', 'Gill Sans Ultra Bold Condensed', 'Gisha', 'Gloucester MT Extra Condensed', 'GOTHAM', 'GOTHAM BOLD', | ||
'Goudy Old Style', 'Goudy Stout', 'GoudyHandtooled BT', 'GoudyOLSt BT', 'Gujarati Sangam MN', 'Gulim', 'GulimChe', 'Gungsuh', 'GungsuhChe', 'Gurmukhi MN', 'Haettenschweiler', 'Harlow Solid Italic', 'Harrington', 'Heather', 'Heiti SC', 'Heiti TC', 'HELV', | ||
'Herald', 'High Tower Text', 'Hiragino Kaku Gothic ProN', 'Hiragino Mincho ProN', 'Hoefler Text', 'Humanst 521 Cn BT', 'Humanst521 BT', 'Humanst521 Lt BT', 'Imprint MT Shadow', 'Incised901 Bd BT', 'Incised901 BT', | ||
'Incised901 Lt BT', 'INCONSOLATA', 'Informal Roman', 'Informal011 BT', 'INTERSTATE', 'IrisUPC', 'Iskoola Pota', 'JasmineUPC', 'Jazz LET', 'Jenson', 'Jester', 'Jokerman', 'Juice ITC', 'Kabel Bk BT', 'Kabel Ult BT', 'Kailasa', 'KaiTi', 'Kalinga', 'Kannada Sangam MN', | ||
'Kartika', 'Kaufmann Bd BT', 'Kaufmann BT', 'Khmer UI', 'KodchiangUPC', 'Kokila', 'Korinna BT', 'Kristen ITC', 'Krungthep', 'Kunstler Script', 'Lao UI', 'Latha', 'Leelawadee', 'Letter Gothic', 'Levenim MT', 'LilyUPC', 'Lithograph', 'Lithograph Light', 'Long Island', | ||
'Lydian BT', 'Magneto', 'Maiandra GD', 'Malayalam Sangam MN', 'Malgun Gothic', | ||
'Mangal', 'Marigold', 'Marion', 'Marker Felt', 'Market', 'Marlett', 'Matisse ITC', 'Matura MT Script Capitals', 'Meiryo', 'Meiryo UI', 'Microsoft Himalaya', 'Microsoft JhengHei', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Tai Le', | ||
'Microsoft Uighur', 'Microsoft YaHei', 'Microsoft Yi Baiti', 'MingLiU', 'MingLiU_HKSCS', 'MingLiU_HKSCS-ExtB', 'MingLiU-ExtB', 'Minion', 'Minion Pro', 'Miriam', 'Miriam Fixed', 'Mistral', 'Modern', 'Modern No. 20', 'Mona Lisa Solid ITC TT', 'Mongolian Baiti', | ||
'MONO', 'MoolBoran', 'Mrs Eaves', 'MS LineDraw', 'MS Mincho', 'MS PMincho', 'MS Reference Specialty', 'MS UI Gothic', 'MT Extra', 'MUSEO', 'MV Boli', | ||
'Nadeem', 'Narkisim', 'NEVIS', 'News Gothic', 'News GothicMT', 'NewsGoth BT', 'Niagara Engraved', 'Niagara Solid', 'Noteworthy', 'NSimSun', 'Nyala', 'OCR A Extended', 'Old Century', 'Old English Text MT', 'Onyx', 'Onyx BT', 'OPTIMA', 'Oriya Sangam MN', | ||
'OSAKA', 'OzHandicraft BT', 'Palace Script MT', 'Papyrus', 'Parchment', 'Party LET', 'Pegasus', 'Perpetua', 'Perpetua Titling MT', 'PetitaBold', 'Pickwick', 'Plantagenet Cherokee', 'Playbill', 'PMingLiU', 'PMingLiU-ExtB', | ||
'Poor Richard', 'Poster', 'PosterBodoni BT', 'PRINCETOWN LET', 'Pristina', 'PTBarnum BT', 'Pythagoras', 'Raavi', 'Rage Italic', 'Ravie', 'Ribbon131 Bd BT', 'Rockwell', 'Rockwell Condensed', 'Rockwell Extra Bold', 'Rod', 'Roman', 'Sakkal Majalla', | ||
'Santa Fe LET', 'Savoye LET', 'Sceptre', 'Script', 'Script MT Bold', 'SCRIPTINA', 'Serifa', 'Serifa BT', 'Serifa Th BT', 'ShelleyVolante BT', 'Sherwood', | ||
'Shonar Bangla', 'Showcard Gothic', 'Shruti', 'Signboard', 'SILKSCREEN', 'SimHei', 'Simplified Arabic', 'Simplified Arabic Fixed', 'SimSun', 'SimSun-ExtB', 'Sinhala Sangam MN', 'Sketch Rockwell', 'Skia', 'Small Fonts', 'Snap ITC', 'Snell Roundhand', 'Socket', | ||
'Souvenir Lt BT', 'Staccato222 BT', 'Steamer', 'Stencil', 'Storybook', 'Styllo', 'Subway', 'Swis721 BlkEx BT', 'Swiss911 XCm BT', 'Sylfaen', 'Synchro LET', 'System', 'Tamil Sangam MN', 'Technical', 'Teletype', 'Telugu Sangam MN', 'Tempus Sans ITC', | ||
'Terminal', 'Thonburi', 'Traditional Arabic', 'Trajan', 'TRAJAN PRO', 'Tristan', 'Tubular', 'Tunga', 'Tw Cen MT', 'Tw Cen MT Condensed', 'Tw Cen MT Condensed Extra Bold', | ||
'TypoUpright BT', 'Unicorn', 'Univers', 'Univers CE 55 Medium', 'Univers Condensed', 'Utsaah', 'Vagabond', 'Vani', 'Vijaya', 'Viner Hand ITC', 'VisualUI', 'Vivaldi', 'Vladimir Script', 'Vrinda', 'Westminster', 'WHITNEY', 'Wide Latin', | ||
'ZapfEllipt BT', 'ZapfHumnst BT', 'ZapfHumnst Dm BT', 'Zapfino', 'Zurich BlkEx BT', 'Zurich Ex BT', 'ZWAdobeF'] | ||
var fontList = [ | ||
'Andale Mono', 'Arial', 'Arial Black', 'Arial Hebrew', 'Arial MT', 'Arial Narrow', 'Arial Rounded MT Bold', 'Arial Unicode MS', | ||
'Bitstream Vera Sans Mono', 'Book Antiqua', 'Bookman Old Style', | ||
'Calibri', 'Cambria', 'Cambria Math', 'Century', 'Century Gothic', 'Century Schoolbook', 'Comic Sans', 'Comic Sans MS', 'Consolas', 'Courier', 'Courier New', | ||
'Geneva', 'Georgia', | ||
'Helvetica', 'Helvetica Neue', | ||
'Impact', | ||
'Lucida Bright', 'Lucida Calligraphy', 'Lucida Console', 'Lucida Fax', 'LUCIDA GRANDE', 'Lucida Handwriting', 'Lucida Sans', 'Lucida Sans Typewriter', 'Lucida Sans Unicode', | ||
'Microsoft Sans Serif', 'Monaco', 'Monotype Corsiva', 'MS Gothic', 'MS Outlook', 'MS PGothic', 'MS Reference Sans Serif', 'MS Sans Serif', 'MS Serif', 'MYRIAD', 'MYRIAD PRO', | ||
'Palatino', 'Palatino Linotype', | ||
'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Light', 'Segoe UI Semibold', 'Segoe UI Symbol', | ||
'Tahoma', 'Times', 'Times New Roman', 'Times New Roman PS', 'Trebuchet MS', | ||
'Verdana', 'Wingdings', 'Wingdings 2', 'Wingdings 3' | ||
] | ||
if (that.options.extendedJsFonts) { | ||
fontList = fontList.concat(extendedFontList) | ||
} | ||
if (options.fonts.extendedJsFonts) { | ||
var extendedFontList = [ | ||
'Abadi MT Condensed Light', 'Academy Engraved LET', 'ADOBE CASLON PRO', 'Adobe Garamond', 'ADOBE GARAMOND PRO', 'Agency FB', 'Aharoni', 'Albertus Extra Bold', 'Albertus Medium', 'Algerian', 'Amazone BT', 'American Typewriter', | ||
'American Typewriter Condensed', 'AmerType Md BT', 'Andalus', 'Angsana New', 'AngsanaUPC', 'Antique Olive', 'Aparajita', 'Apple Chancery', 'Apple Color Emoji', 'Apple SD Gothic Neo', 'Arabic Typesetting', 'ARCHER', | ||
'ARNO PRO', 'Arrus BT', 'Aurora Cn BT', 'AvantGarde Bk BT', 'AvantGarde Md BT', 'AVENIR', 'Ayuthaya', 'Bandy', 'Bangla Sangam MN', 'Bank Gothic', 'BankGothic Md BT', 'Baskerville', | ||
'Baskerville Old Face', 'Batang', 'BatangChe', 'Bauer Bodoni', 'Bauhaus 93', 'Bazooka', 'Bell MT', 'Bembo', 'Benguiat Bk BT', 'Berlin Sans FB', 'Berlin Sans FB Demi', 'Bernard MT Condensed', 'BernhardFashion BT', 'BernhardMod BT', 'Big Caslon', 'BinnerD', | ||
'Blackadder ITC', 'BlairMdITC TT', 'Bodoni 72', 'Bodoni 72 Oldstyle', 'Bodoni 72 Smallcaps', 'Bodoni MT', 'Bodoni MT Black', 'Bodoni MT Condensed', 'Bodoni MT Poster Compressed', | ||
'Bookshelf Symbol 7', 'Boulder', 'Bradley Hand', 'Bradley Hand ITC', 'Bremen Bd BT', 'Britannic Bold', 'Broadway', 'Browallia New', 'BrowalliaUPC', 'Brush Script MT', 'Californian FB', 'Calisto MT', 'Calligrapher', 'Candara', | ||
'CaslonOpnface BT', 'Castellar', 'Centaur', 'Cezanne', 'CG Omega', 'CG Times', 'Chalkboard', 'Chalkboard SE', 'Chalkduster', 'Charlesworth', 'Charter Bd BT', 'Charter BT', 'Chaucer', | ||
'ChelthmITC Bk BT', 'Chiller', 'Clarendon', 'Clarendon Condensed', 'CloisterBlack BT', 'Cochin', 'Colonna MT', 'Constantia', 'Cooper Black', 'Copperplate', 'Copperplate Gothic', 'Copperplate Gothic Bold', | ||
'Copperplate Gothic Light', 'CopperplGoth Bd BT', 'Corbel', 'Cordia New', 'CordiaUPC', 'Cornerstone', 'Coronet', 'Cuckoo', 'Curlz MT', 'DaunPenh', 'Dauphin', 'David', 'DB LCD Temp', 'DELICIOUS', 'Denmark', | ||
'DFKai-SB', 'Didot', 'DilleniaUPC', 'DIN', 'DokChampa', 'Dotum', 'DotumChe', 'Ebrima', 'Edwardian Script ITC', 'Elephant', 'English 111 Vivace BT', 'Engravers MT', 'EngraversGothic BT', 'Eras Bold ITC', 'Eras Demi ITC', 'Eras Light ITC', 'Eras Medium ITC', | ||
'EucrosiaUPC', 'Euphemia', 'Euphemia UCAS', 'EUROSTILE', 'Exotc350 Bd BT', 'FangSong', 'Felix Titling', 'Fixedsys', 'FONTIN', 'Footlight MT Light', 'Forte', | ||
'FrankRuehl', 'Fransiscan', 'Freefrm721 Blk BT', 'FreesiaUPC', 'Freestyle Script', 'French Script MT', 'FrnkGothITC Bk BT', 'Fruitger', 'FRUTIGER', | ||
'Futura', 'Futura Bk BT', 'Futura Lt BT', 'Futura Md BT', 'Futura ZBlk BT', 'FuturaBlack BT', 'Gabriola', 'Galliard BT', 'Gautami', 'Geeza Pro', 'Geometr231 BT', 'Geometr231 Hv BT', 'Geometr231 Lt BT', 'GeoSlab 703 Lt BT', | ||
'GeoSlab 703 XBd BT', 'Gigi', 'Gill Sans', 'Gill Sans MT', 'Gill Sans MT Condensed', 'Gill Sans MT Ext Condensed Bold', 'Gill Sans Ultra Bold', 'Gill Sans Ultra Bold Condensed', 'Gisha', 'Gloucester MT Extra Condensed', 'GOTHAM', 'GOTHAM BOLD', | ||
'Goudy Old Style', 'Goudy Stout', 'GoudyHandtooled BT', 'GoudyOLSt BT', 'Gujarati Sangam MN', 'Gulim', 'GulimChe', 'Gungsuh', 'GungsuhChe', 'Gurmukhi MN', 'Haettenschweiler', 'Harlow Solid Italic', 'Harrington', 'Heather', 'Heiti SC', 'Heiti TC', 'HELV', | ||
'Herald', 'High Tower Text', 'Hiragino Kaku Gothic ProN', 'Hiragino Mincho ProN', 'Hoefler Text', 'Humanst 521 Cn BT', 'Humanst521 BT', 'Humanst521 Lt BT', 'Imprint MT Shadow', 'Incised901 Bd BT', 'Incised901 BT', | ||
'Incised901 Lt BT', 'INCONSOLATA', 'Informal Roman', 'Informal011 BT', 'INTERSTATE', 'IrisUPC', 'Iskoola Pota', 'JasmineUPC', 'Jazz LET', 'Jenson', 'Jester', 'Jokerman', 'Juice ITC', 'Kabel Bk BT', 'Kabel Ult BT', 'Kailasa', 'KaiTi', 'Kalinga', 'Kannada Sangam MN', | ||
'Kartika', 'Kaufmann Bd BT', 'Kaufmann BT', 'Khmer UI', 'KodchiangUPC', 'Kokila', 'Korinna BT', 'Kristen ITC', 'Krungthep', 'Kunstler Script', 'Lao UI', 'Latha', 'Leelawadee', 'Letter Gothic', 'Levenim MT', 'LilyUPC', 'Lithograph', 'Lithograph Light', 'Long Island', | ||
'Lydian BT', 'Magneto', 'Maiandra GD', 'Malayalam Sangam MN', 'Malgun Gothic', | ||
'Mangal', 'Marigold', 'Marion', 'Marker Felt', 'Market', 'Marlett', 'Matisse ITC', 'Matura MT Script Capitals', 'Meiryo', 'Meiryo UI', 'Microsoft Himalaya', 'Microsoft JhengHei', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Tai Le', | ||
'Microsoft Uighur', 'Microsoft YaHei', 'Microsoft Yi Baiti', 'MingLiU', 'MingLiU_HKSCS', 'MingLiU_HKSCS-ExtB', 'MingLiU-ExtB', 'Minion', 'Minion Pro', 'Miriam', 'Miriam Fixed', 'Mistral', 'Modern', 'Modern No. 20', 'Mona Lisa Solid ITC TT', 'Mongolian Baiti', | ||
'MONO', 'MoolBoran', 'Mrs Eaves', 'MS LineDraw', 'MS Mincho', 'MS PMincho', 'MS Reference Specialty', 'MS UI Gothic', 'MT Extra', 'MUSEO', 'MV Boli', | ||
'Nadeem', 'Narkisim', 'NEVIS', 'News Gothic', 'News GothicMT', 'NewsGoth BT', 'Niagara Engraved', 'Niagara Solid', 'Noteworthy', 'NSimSun', 'Nyala', 'OCR A Extended', 'Old Century', 'Old English Text MT', 'Onyx', 'Onyx BT', 'OPTIMA', 'Oriya Sangam MN', | ||
'OSAKA', 'OzHandicraft BT', 'Palace Script MT', 'Papyrus', 'Parchment', 'Party LET', 'Pegasus', 'Perpetua', 'Perpetua Titling MT', 'PetitaBold', 'Pickwick', 'Plantagenet Cherokee', 'Playbill', 'PMingLiU', 'PMingLiU-ExtB', | ||
'Poor Richard', 'Poster', 'PosterBodoni BT', 'PRINCETOWN LET', 'Pristina', 'PTBarnum BT', 'Pythagoras', 'Raavi', 'Rage Italic', 'Ravie', 'Ribbon131 Bd BT', 'Rockwell', 'Rockwell Condensed', 'Rockwell Extra Bold', 'Rod', 'Roman', 'Sakkal Majalla', | ||
'Santa Fe LET', 'Savoye LET', 'Sceptre', 'Script', 'Script MT Bold', 'SCRIPTINA', 'Serifa', 'Serifa BT', 'Serifa Th BT', 'ShelleyVolante BT', 'Sherwood', | ||
'Shonar Bangla', 'Showcard Gothic', 'Shruti', 'Signboard', 'SILKSCREEN', 'SimHei', 'Simplified Arabic', 'Simplified Arabic Fixed', 'SimSun', 'SimSun-ExtB', 'Sinhala Sangam MN', 'Sketch Rockwell', 'Skia', 'Small Fonts', 'Snap ITC', 'Snell Roundhand', 'Socket', | ||
'Souvenir Lt BT', 'Staccato222 BT', 'Steamer', 'Stencil', 'Storybook', 'Styllo', 'Subway', 'Swis721 BlkEx BT', 'Swiss911 XCm BT', 'Sylfaen', 'Synchro LET', 'System', 'Tamil Sangam MN', 'Technical', 'Teletype', 'Telugu Sangam MN', 'Tempus Sans ITC', | ||
'Terminal', 'Thonburi', 'Traditional Arabic', 'Trajan', 'TRAJAN PRO', 'Tristan', 'Tubular', 'Tunga', 'Tw Cen MT', 'Tw Cen MT Condensed', 'Tw Cen MT Condensed Extra Bold', | ||
'TypoUpright BT', 'Unicorn', 'Univers', 'Univers CE 55 Medium', 'Univers Condensed', 'Utsaah', 'Vagabond', 'Vani', 'Vijaya', 'Viner Hand ITC', 'VisualUI', 'Vivaldi', 'Vladimir Script', 'Vrinda', 'Westminster', 'WHITNEY', 'Wide Latin', | ||
'ZapfEllipt BT', 'ZapfHumnst BT', 'ZapfHumnst Dm BT', 'Zapfino', 'Zurich BlkEx BT', 'Zurich Ex BT', 'ZWAdobeF'] | ||
fontList = fontList.concat(extendedFontList) | ||
} | ||
fontList = fontList.concat(that.options.userDefinedFonts) | ||
fontList = fontList.concat(options.fonts.userDefinedFonts) | ||
// remove duplicate fonts | ||
fontList = fontList.filter(function (font, position) { | ||
return fontList.indexOf(font) === position | ||
}) | ||
// remove duplicate fonts | ||
fontList = fontList.filter(function (font, position) { | ||
return fontList.indexOf(font) === position | ||
}) | ||
// we use m or w because these two characters take up the maximum width. | ||
// And we use a LLi so that the same matching fonts can get separated | ||
var testString = 'mmmmmmmmmmlli' | ||
// we use m or w because these two characters take up the maximum width. | ||
// And we use a LLi so that the same matching fonts can get separated | ||
var testString = 'mmmmmmmmmmlli' | ||
// we test using 72px font size, we may use any size. I guess larger the better. | ||
var testSize = '72px' | ||
// we test using 72px font size, we may use any size. I guess larger the better. | ||
var testSize = '72px' | ||
var h = document.getElementsByTagName('body')[0] | ||
var h = document.getElementsByTagName('body')[0] | ||
// div to load spans for the base fonts | ||
var baseFontsDiv = document.createElement('div') | ||
// div to load spans for the base fonts | ||
var baseFontsDiv = document.createElement('div') | ||
// div to load spans for the fonts to detect | ||
var fontsDiv = document.createElement('div') | ||
// div to load spans for the fonts to detect | ||
var fontsDiv = document.createElement('div') | ||
var defaultWidth = {} | ||
var defaultHeight = {} | ||
var defaultWidth = {} | ||
var defaultHeight = {} | ||
// creates a span where the fonts will be loaded | ||
var createSpan = function () { | ||
var s = document.createElement('span') | ||
/* | ||
* We need this css as in some weird browser this | ||
* span elements shows up for a microSec which creates a | ||
* bad user experience | ||
*/ | ||
s.style.position = 'absolute' | ||
s.style.left = '-9999px' | ||
s.style.fontSize = testSize | ||
// creates a span where the fonts will be loaded | ||
var createSpan = function () { | ||
var s = document.createElement('span') | ||
/* | ||
* We need this css as in some weird browser this | ||
* span elements shows up for a microSec which creates a | ||
* bad user experience | ||
*/ | ||
s.style.position = 'absolute' | ||
s.style.left = '-9999px' | ||
s.style.fontSize = testSize | ||
// css font reset to reset external styles | ||
s.style.fontStyle = 'normal' | ||
s.style.fontWeight = 'normal' | ||
s.style.letterSpacing = 'normal' | ||
s.style.lineBreak = 'auto' | ||
s.style.lineHeight = 'normal' | ||
s.style.textTransform = 'none' | ||
s.style.textAlign = 'left' | ||
s.style.textDecoration = 'none' | ||
s.style.textShadow = 'none' | ||
s.style.whiteSpace = 'normal' | ||
s.style.wordBreak = 'normal' | ||
s.style.wordSpacing = 'normal' | ||
// css font reset to reset external styles | ||
s.style.fontStyle = 'normal' | ||
s.style.fontWeight = 'normal' | ||
s.style.letterSpacing = 'normal' | ||
s.style.lineBreak = 'auto' | ||
s.style.lineHeight = 'normal' | ||
s.style.textTransform = 'none' | ||
s.style.textAlign = 'left' | ||
s.style.textDecoration = 'none' | ||
s.style.textShadow = 'none' | ||
s.style.whiteSpace = 'normal' | ||
s.style.wordBreak = 'normal' | ||
s.style.wordSpacing = 'normal' | ||
s.innerHTML = testString | ||
return s | ||
} | ||
s.innerHTML = testString | ||
return s | ||
} | ||
// creates a span and load the font to detect and a base font for fallback | ||
var createSpanWithFonts = function (fontToDetect, baseFont) { | ||
var s = createSpan() | ||
s.style.fontFamily = "'" + fontToDetect + "'," + baseFont | ||
return s | ||
} | ||
// creates a span and load the font to detect and a base font for fallback | ||
var createSpanWithFonts = function (fontToDetect, baseFont) { | ||
var s = createSpan() | ||
s.style.fontFamily = "'" + fontToDetect + "'," + baseFont | ||
return s | ||
} | ||
// creates spans for the base fonts and adds them to baseFontsDiv | ||
var initializeBaseFontsSpans = function () { | ||
var spans = [] | ||
for (var index = 0, length = baseFonts.length; index < length; index++) { | ||
var s = createSpan() | ||
s.style.fontFamily = baseFonts[index] | ||
baseFontsDiv.appendChild(s) | ||
spans.push(s) | ||
} | ||
return spans | ||
} | ||
// creates spans for the base fonts and adds them to baseFontsDiv | ||
var initializeBaseFontsSpans = function () { | ||
var spans = [] | ||
for (var index = 0, length = baseFonts.length; index < length; index++) { | ||
var s = createSpan() | ||
s.style.fontFamily = baseFonts[index] | ||
baseFontsDiv.appendChild(s) | ||
spans.push(s) | ||
} | ||
return spans | ||
} | ||
// creates spans for the fonts to detect and adds them to fontsDiv | ||
var initializeFontsSpans = function () { | ||
var spans = {} | ||
for (var i = 0, l = fontList.length; i < l; i++) { | ||
var fontSpans = [] | ||
for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) { | ||
var s = createSpanWithFonts(fontList[i], baseFonts[j]) | ||
fontsDiv.appendChild(s) | ||
fontSpans.push(s) | ||
} | ||
spans[fontList[i]] = fontSpans // Stores {fontName : [spans for that font]} | ||
} | ||
return spans | ||
// creates spans for the fonts to detect and adds them to fontsDiv | ||
var initializeFontsSpans = function () { | ||
var spans = {} | ||
for (var i = 0, l = fontList.length; i < l; i++) { | ||
var fontSpans = [] | ||
for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) { | ||
var s = createSpanWithFonts(fontList[i], baseFonts[j]) | ||
fontsDiv.appendChild(s) | ||
fontSpans.push(s) | ||
} | ||
spans[fontList[i]] = fontSpans // Stores {fontName : [spans for that font]} | ||
} | ||
return spans | ||
} | ||
// checks if a font is available | ||
var isFontAvailable = function (fontSpans) { | ||
var detected = false | ||
for (var i = 0; i < baseFonts.length; i++) { | ||
detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]]) | ||
if (detected) { | ||
return detected | ||
} | ||
} | ||
// checks if a font is available | ||
var isFontAvailable = function (fontSpans) { | ||
var detected = false | ||
for (var i = 0; i < baseFonts.length; i++) { | ||
detected = (fontSpans[i].offsetWidth !== defaultWidth[baseFonts[i]] || fontSpans[i].offsetHeight !== defaultHeight[baseFonts[i]]) | ||
if (detected) { | ||
return detected | ||
} | ||
} | ||
return detected | ||
} | ||
// create spans for base fonts | ||
var baseFontsSpans = initializeBaseFontsSpans() | ||
// create spans for base fonts | ||
var baseFontsSpans = initializeBaseFontsSpans() | ||
// add the spans to the DOM | ||
h.appendChild(baseFontsDiv) | ||
// add the spans to the DOM | ||
h.appendChild(baseFontsDiv) | ||
// get the default width for the three base fonts | ||
for (var index = 0, length = baseFonts.length; index < length; index++) { | ||
defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth // width for the default font | ||
defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight // height for the default font | ||
} | ||
// get the default width for the three base fonts | ||
for (var index = 0, length = baseFonts.length; index < length; index++) { | ||
defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth // width for the default font | ||
defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight // height for the default font | ||
} | ||
// create spans for fonts to detect | ||
var fontsSpans = initializeFontsSpans() | ||
// create spans for fonts to detect | ||
var fontsSpans = initializeFontsSpans() | ||
// add all the spans to the DOM | ||
h.appendChild(fontsDiv) | ||
// add all the spans to the DOM | ||
h.appendChild(fontsDiv) | ||
// check available fonts | ||
var available = [] | ||
for (var i = 0, l = fontList.length; i < l; i++) { | ||
if (isFontAvailable(fontsSpans[fontList[i]])) { | ||
available.push(fontList[i]) | ||
} | ||
} | ||
// check available fonts | ||
var available = [] | ||
for (var i = 0, l = fontList.length; i < l; i++) { | ||
if (isFontAvailable(fontsSpans[fontList[i]])) { | ||
available.push(fontList[i]) | ||
} | ||
} | ||
// remove spans from DOM | ||
h.removeChild(fontsDiv) | ||
h.removeChild(baseFontsDiv) | ||
// remove spans from DOM | ||
h.removeChild(fontsDiv) | ||
h.removeChild(baseFontsDiv) | ||
done(available) | ||
} | ||
var pluginsComponent = function (done, options) { | ||
if (isIE()) { | ||
if (!options.plugins.excludeIE) { | ||
done(getIEPlugins(options)) | ||
} else { | ||
done(options.EXCLUDED) | ||
} | ||
} else { | ||
done(getRegularPlugins(options)) | ||
} | ||
} | ||
var getRegularPlugins = function (options) { | ||
if (navigator.plugins == null) { | ||
return options.NOT_AVAILABLE | ||
} | ||
keys.addPreprocessedComponent({key: 'js_fonts', value: available}) | ||
done(keys) | ||
}, 1) | ||
}, | ||
pluginsKey: function (keys) { | ||
if (!this.options.excludePlugins) { | ||
if (this.isIE()) { | ||
if (!this.options.excludeIEPlugins) { | ||
keys.addPreprocessedComponent({key: 'ie_plugins', value: this.getIEPlugins()}) | ||
} | ||
} else { | ||
keys.addPreprocessedComponent({key: 'regular_plugins', value: this.getRegularPlugins()}) | ||
} | ||
} | ||
return keys | ||
}, | ||
getRegularPlugins: function () { | ||
var plugins = [] | ||
if (navigator.plugins) { | ||
// plugins isn't defined in Node envs. | ||
for (var i = 0, l = navigator.plugins.length; i < l; i++) { | ||
if (navigator.plugins[i]) { plugins.push(navigator.plugins[i]) } | ||
} | ||
} | ||
var plugins = [] | ||
// plugins isn't defined in Node envs. | ||
for (var i = 0, l = navigator.plugins.length; i < l; i++) { | ||
if (navigator.plugins[i]) { plugins.push(navigator.plugins[i]) } | ||
} | ||
// sorting plugins only for those user agents, that we know randomize the plugins | ||
// every time we try to enumerate them | ||
if (this.pluginsShouldBeSorted()) { | ||
plugins = plugins.sort(function (a, b) { | ||
if (a.name > b.name) { return 1 } | ||
if (a.name < b.name) { return -1 } | ||
return 0 | ||
}) | ||
} | ||
return this.map(plugins, function (p) { | ||
var mimeTypes = this.map(p, function (mt) { | ||
return [mt.type, mt.suffixes].join('~') | ||
}).join(',') | ||
return [p.name, p.description, mimeTypes].join('::') | ||
}, this) | ||
}, | ||
getIEPlugins: function () { | ||
var result = [] | ||
if ((Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(window, 'ActiveXObject')) || ('ActiveXObject' in window)) { | ||
var names = [ | ||
'AcroPDF.PDF', // Adobe PDF reader 7+ | ||
'Adodb.Stream', | ||
'AgControl.AgControl', // Silverlight | ||
'DevalVRXCtrl.DevalVRXCtrl.1', | ||
'MacromediaFlashPaper.MacromediaFlashPaper', | ||
'Msxml2.DOMDocument', | ||
'Msxml2.XMLHTTP', | ||
'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr | ||
'QuickTime.QuickTime', // QuickTime | ||
'QuickTimeCheckObject.QuickTimeCheck.1', | ||
'RealPlayer', | ||
'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)', | ||
'RealVideo.RealVideo(tm) ActiveX Control (32-bit)', | ||
'Scripting.Dictionary', | ||
'SWCtl.SWCtl', // ShockWave player | ||
'Shell.UIHelper', | ||
'ShockwaveFlash.ShockwaveFlash', // flash plugin | ||
'Skype.Detection', | ||
'TDCCtl.TDCCtl', | ||
'WMPlayer.OCX', // Windows media player | ||
'rmocx.RealPlayer G2 Control', | ||
'rmocx.RealPlayer G2 Control.1' | ||
] | ||
if (pluginsShouldBeSorted(options)) { | ||
plugins = plugins.sort(function (a, b) { | ||
if (a.name > b.name) { return 1 } | ||
if (a.name < b.name) { return -1 } | ||
return 0 | ||
}) | ||
} | ||
return map(plugins, function (p) { | ||
var mimeTypes = map(p, function (mt) { | ||
return [mt.type, mt.suffixes] | ||
}) | ||
return [p.name, p.description, mimeTypes] | ||
}) | ||
} | ||
var getIEPlugins = function (options) { | ||
var result = [] | ||
if ((Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(window, 'ActiveXObject')) || ('ActiveXObject' in window)) { | ||
var names = [ | ||
'AcroPDF.PDF', // Adobe PDF reader 7+ | ||
'Adodb.Stream', | ||
'AgControl.AgControl', // Silverlight | ||
'DevalVRXCtrl.DevalVRXCtrl.1', | ||
'MacromediaFlashPaper.MacromediaFlashPaper', | ||
'Msxml2.DOMDocument', | ||
'Msxml2.XMLHTTP', | ||
'PDF.PdfCtrl', // Adobe PDF reader 6 and earlier, brrr | ||
'QuickTime.QuickTime', // QuickTime | ||
'QuickTimeCheckObject.QuickTimeCheck.1', | ||
'RealPlayer', | ||
'RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)', | ||
'RealVideo.RealVideo(tm) ActiveX Control (32-bit)', | ||
'Scripting.Dictionary', | ||
'SWCtl.SWCtl', // ShockWave player | ||
'Shell.UIHelper', | ||
'ShockwaveFlash.ShockwaveFlash', // flash plugin | ||
'Skype.Detection', | ||
'TDCCtl.TDCCtl', | ||
'WMPlayer.OCX', // Windows media player | ||
'rmocx.RealPlayer G2 Control', | ||
'rmocx.RealPlayer G2 Control.1' | ||
] | ||
// starting to detect plugins in IE | ||
result = this.map(names, function (name) { | ||
try { | ||
result = map(names, function (name) { | ||
try { | ||
// eslint-disable-next-line no-new | ||
new window.ActiveXObject(name) | ||
return name | ||
} catch (e) { | ||
return null | ||
} | ||
}) | ||
} | ||
if (navigator.plugins) { | ||
result = result.concat(this.getRegularPlugins()) | ||
} | ||
return result | ||
}, | ||
pluginsShouldBeSorted: function () { | ||
var should = false | ||
for (var i = 0, l = this.options.sortPluginsFor.length; i < l; i++) { | ||
var re = this.options.sortPluginsFor[i] | ||
if (navigator.userAgent.match(re)) { | ||
should = true | ||
break | ||
new window.ActiveXObject(name) | ||
return name | ||
} catch (e) { | ||
return options.ERROR | ||
} | ||
}) | ||
} else { | ||
result.push(options.NOT_AVAILABLE) | ||
} | ||
if (navigator.plugins) { | ||
result = result.concat(getRegularPlugins(options)) | ||
} | ||
return result | ||
} | ||
var pluginsShouldBeSorted = function (options) { | ||
var should = false | ||
for (var i = 0, l = options.plugins.sortPluginsFor.length; i < l; i++) { | ||
var re = options.plugins.sortPluginsFor[i] | ||
if (navigator.userAgent.match(re)) { | ||
should = true | ||
break | ||
} | ||
return should | ||
}, | ||
touchSupportKey: function (keys) { | ||
if (!this.options.excludeTouchSupport) { | ||
keys.addPreprocessedComponent({key: 'touch_support', value: this.getTouchSupport()}) | ||
} | ||
return keys | ||
}, | ||
hardwareConcurrencyKey: function (keys) { | ||
if (!this.options.excludeHardwareConcurrency) { | ||
keys.addPreprocessedComponent({key: 'hardware_concurrency', value: this.getHardwareConcurrency()}) | ||
} | ||
return keys | ||
}, | ||
hasSessionStorage: function () { | ||
try { | ||
return !!window.sessionStorage | ||
} catch (e) { | ||
return true // SecurityError when referencing it means it exists | ||
} | ||
}, | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=781447 | ||
hasLocalStorage: function () { | ||
try { | ||
return !!window.localStorage | ||
} catch (e) { | ||
return true // SecurityError when referencing it means it exists | ||
} | ||
}, | ||
hasIndexedDB: function () { | ||
try { | ||
return !!window.indexedDB | ||
} catch (e) { | ||
return true // SecurityError when referencing it means it exists | ||
} | ||
}, | ||
getHardwareConcurrency: function () { | ||
if (navigator.hardwareConcurrency) { | ||
return navigator.hardwareConcurrency | ||
} | ||
return 'unknown' | ||
}, | ||
getNavigatorCpuClass: function () { | ||
if (navigator.cpuClass) { | ||
return navigator.cpuClass | ||
} else { | ||
return 'unknown' | ||
} | ||
}, | ||
getNavigatorPlatform: function () { | ||
if (navigator.platform) { | ||
return navigator.platform | ||
} else { | ||
return 'unknown' | ||
} | ||
}, | ||
getDoNotTrack: function () { | ||
if (navigator.doNotTrack) { | ||
return navigator.doNotTrack | ||
} else if (navigator.msDoNotTrack) { | ||
return navigator.msDoNotTrack | ||
} else if (window.doNotTrack) { | ||
return window.doNotTrack | ||
} else { | ||
return 'unknown' | ||
} | ||
}, | ||
// This is a crude and primitive touch screen detection. | ||
// It's not possible to currently reliably detect the availability of a touch screen | ||
// with a JS, without actually subscribing to a touch event. | ||
// http://www.stucox.com/blog/you-cant-detect-a-touchscreen/ | ||
// https://github.com/Modernizr/Modernizr/issues/548 | ||
// method returns an array of 3 values: | ||
// maxTouchPoints, the success or failure of creating a TouchEvent, | ||
// and the availability of the 'ontouchstart' property | ||
getTouchSupport: function () { | ||
var maxTouchPoints = 0 | ||
var touchEvent = false | ||
if (typeof navigator.maxTouchPoints !== 'undefined') { | ||
maxTouchPoints = navigator.maxTouchPoints | ||
} else if (typeof navigator.msMaxTouchPoints !== 'undefined') { | ||
maxTouchPoints = navigator.msMaxTouchPoints | ||
} | ||
try { | ||
document.createEvent('TouchEvent') | ||
touchEvent = true | ||
} catch (_) { /* squelch */ } | ||
var touchStart = 'ontouchstart' in window | ||
return [maxTouchPoints, touchEvent, touchStart] | ||
}, | ||
// https://www.browserleaks.com/canvas#how-does-it-work | ||
getCanvasFp: function () { | ||
var result = [] | ||
} | ||
return should | ||
} | ||
var touchSupportKey = function (done) { | ||
done(getTouchSupport()) | ||
} | ||
var hardwareConcurrencyKey = function (done, options) { | ||
done(getHardwareConcurrency(options)) | ||
} | ||
var hasSessionStorage = function (options) { | ||
try { | ||
return !!window.sessionStorage | ||
} catch (e) { | ||
return options.ERROR // SecurityError when referencing it means it exists | ||
} | ||
} | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=781447 | ||
var hasLocalStorage = function (options) { | ||
try { | ||
return !!window.localStorage | ||
} catch (e) { | ||
return options.ERROR // SecurityError when referencing it means it exists | ||
} | ||
} | ||
var hasIndexedDB = function (options) { | ||
try { | ||
return !!window.indexedDB | ||
} catch (e) { | ||
return options.ERROR // SecurityError when referencing it means it exists | ||
} | ||
} | ||
var getHardwareConcurrency = function (options) { | ||
if (navigator.hardwareConcurrency) { | ||
return navigator.hardwareConcurrency | ||
} | ||
return options.NOT_AVAILABLE | ||
} | ||
var getNavigatorCpuClass = function (options) { | ||
return navigator.cpuClass || options.NOT_AVAILABLE | ||
} | ||
var getNavigatorPlatform = function (options) { | ||
if (navigator.platform) { | ||
return navigator.platform | ||
} else { | ||
return options.NOT_AVAILABLE | ||
} | ||
} | ||
var getDoNotTrack = function (options) { | ||
if (navigator.doNotTrack) { | ||
return navigator.doNotTrack | ||
} else if (navigator.msDoNotTrack) { | ||
return navigator.msDoNotTrack | ||
} else if (window.doNotTrack) { | ||
return window.doNotTrack | ||
} else { | ||
return options.NOT_AVAILABLE | ||
} | ||
} | ||
// This is a crude and primitive touch screen detection. | ||
// It's not possible to currently reliably detect the availability of a touch screen | ||
// with a JS, without actually subscribing to a touch event. | ||
// http://www.stucox.com/blog/you-cant-detect-a-touchscreen/ | ||
// https://github.com/Modernizr/Modernizr/issues/548 | ||
// method returns an array of 3 values: | ||
// maxTouchPoints, the success or failure of creating a TouchEvent, | ||
// and the availability of the 'ontouchstart' property | ||
var getTouchSupport = function () { | ||
var maxTouchPoints = 0 | ||
var touchEvent | ||
if (typeof navigator.maxTouchPoints !== 'undefined') { | ||
maxTouchPoints = navigator.maxTouchPoints | ||
} else if (typeof navigator.msMaxTouchPoints !== 'undefined') { | ||
maxTouchPoints = navigator.msMaxTouchPoints | ||
} | ||
try { | ||
document.createEvent('TouchEvent') | ||
touchEvent = true | ||
} catch (_) { | ||
touchEvent = false | ||
} | ||
var touchStart = 'ontouchstart' in window | ||
return [maxTouchPoints, touchEvent, touchStart] | ||
} | ||
// https://www.browserleaks.com/canvas#how-does-it-work | ||
var getCanvasFp = function (options) { | ||
var result = [] | ||
// Very simple now, need to make it more complex (geo shapes etc) | ||
var canvas = document.createElement('canvas') | ||
canvas.width = 2000 | ||
canvas.height = 200 | ||
canvas.style.display = 'inline' | ||
var ctx = canvas.getContext('2d') | ||
var canvas = document.createElement('canvas') | ||
canvas.width = 2000 | ||
canvas.height = 200 | ||
canvas.style.display = 'inline' | ||
var ctx = canvas.getContext('2d') | ||
// detect browser support of canvas winding | ||
// http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/ | ||
// https://github.com/Modernizr/Modernizr/blob/master/feature-detects/canvas/winding.js | ||
ctx.rect(0, 0, 10, 10) | ||
ctx.rect(2, 2, 6, 6) | ||
result.push('canvas winding:' + ((ctx.isPointInPath(5, 5, 'evenodd') === false) ? 'yes' : 'no')) | ||
ctx.rect(0, 0, 10, 10) | ||
ctx.rect(2, 2, 6, 6) | ||
result.push('canvas winding:' + ((ctx.isPointInPath(5, 5, 'evenodd') === false) ? 'yes' : 'no')) | ||
ctx.textBaseline = 'alphabetic' | ||
ctx.fillStyle = '#f60' | ||
ctx.fillRect(125, 1, 62, 20) | ||
ctx.fillStyle = '#069' | ||
ctx.textBaseline = 'alphabetic' | ||
ctx.fillStyle = '#f60' | ||
ctx.fillRect(125, 1, 62, 20) | ||
ctx.fillStyle = '#069' | ||
// https://github.com/Valve/fingerprintjs2/issues/66 | ||
if (this.options.dontUseFakeFontInCanvas) { | ||
ctx.font = '11pt Arial' | ||
} else { | ||
ctx.font = '11pt no-real-font-123' | ||
} | ||
ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 2, 15) | ||
ctx.fillStyle = 'rgba(102, 204, 0, 0.2)' | ||
ctx.font = '18pt Arial' | ||
ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 4, 45) | ||
if (options.dontUseFakeFontInCanvas) { | ||
ctx.font = '11pt Arial' | ||
} else { | ||
ctx.font = '11pt no-real-font-123' | ||
} | ||
ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 2, 15) | ||
ctx.fillStyle = 'rgba(102, 204, 0, 0.2)' | ||
ctx.font = '18pt Arial' | ||
ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03', 4, 45) | ||
@@ -783,53 +923,53 @@ // canvas blending | ||
// http://jsfiddle.net/NDYV8/16/ | ||
ctx.globalCompositeOperation = 'multiply' | ||
ctx.fillStyle = 'rgb(255,0,255)' | ||
ctx.beginPath() | ||
ctx.arc(50, 50, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(0,255,255)' | ||
ctx.beginPath() | ||
ctx.arc(100, 50, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(255,255,0)' | ||
ctx.beginPath() | ||
ctx.arc(75, 100, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(255,0,255)' | ||
ctx.globalCompositeOperation = 'multiply' | ||
ctx.fillStyle = 'rgb(255,0,255)' | ||
ctx.beginPath() | ||
ctx.arc(50, 50, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(0,255,255)' | ||
ctx.beginPath() | ||
ctx.arc(100, 50, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(255,255,0)' | ||
ctx.beginPath() | ||
ctx.arc(75, 100, 50, 0, Math.PI * 2, true) | ||
ctx.closePath() | ||
ctx.fill() | ||
ctx.fillStyle = 'rgb(255,0,255)' | ||
// canvas winding | ||
// http://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/ | ||
// http://jsfiddle.net/NDYV8/19/ | ||
ctx.arc(75, 75, 75, 0, Math.PI * 2, true) | ||
ctx.arc(75, 75, 25, 0, Math.PI * 2, true) | ||
ctx.fill('evenodd') | ||
ctx.arc(75, 75, 75, 0, Math.PI * 2, true) | ||
ctx.arc(75, 75, 25, 0, Math.PI * 2, true) | ||
ctx.fill('evenodd') | ||
if (canvas.toDataURL) { result.push('canvas fp:' + canvas.toDataURL()) } | ||
return result.join('~') | ||
}, | ||
getWebglFp: function () { | ||
var gl | ||
var fa2s = function (fa) { | ||
gl.clearColor(0.0, 0.0, 0.0, 1.0) | ||
gl.enable(gl.DEPTH_TEST) | ||
gl.depthFunc(gl.LEQUAL) | ||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) | ||
return '[' + fa[0] + ', ' + fa[1] + ']' | ||
} | ||
var maxAnisotropy = function (gl) { | ||
var ext = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') | ||
if (ext) { | ||
var anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) | ||
if (anisotropy === 0) { | ||
anisotropy = 2 | ||
} | ||
return anisotropy | ||
} else { | ||
return null | ||
if (canvas.toDataURL) { result.push('canvas fp:' + canvas.toDataURL()) } | ||
return result | ||
} | ||
var getWebglFp = function () { | ||
var gl | ||
var fa2s = function (fa) { | ||
gl.clearColor(0.0, 0.0, 0.0, 1.0) | ||
gl.enable(gl.DEPTH_TEST) | ||
gl.depthFunc(gl.LEQUAL) | ||
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) | ||
return '[' + fa[0] + ', ' + fa[1] + ']' | ||
} | ||
var maxAnisotropy = function (gl) { | ||
var ext = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') | ||
if (ext) { | ||
var anisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) | ||
if (anisotropy === 0) { | ||
anisotropy = 2 | ||
} | ||
return anisotropy | ||
} else { | ||
return null | ||
} | ||
gl = this.getWebglCanvas() | ||
if (!gl) { return null } | ||
} | ||
gl = getWebglCanvas() | ||
if (!gl) { return null } | ||
// WebGL fingerprinting is a combination of techniques, found in MaxMind antifraud script & Augur fingerprinting. | ||
@@ -839,561 +979,437 @@ // First it draws a gradient object with shaders and convers the image to the Base64 string. | ||
// Since iOS supports webgl starting from version 8.1 and 8.1 runs on several graphics chips, the results may be different across ios devices, but we need to verify it. | ||
var result = [] | ||
var vShaderTemplate = 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}' | ||
var fShaderTemplate = 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}' | ||
var vertexPosBuffer = gl.createBuffer() | ||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer) | ||
var vertices = new Float32Array([-0.2, -0.9, 0, 0.4, -0.26, 0, 0, 0.732134444, 0]) | ||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW) | ||
vertexPosBuffer.itemSize = 3 | ||
vertexPosBuffer.numItems = 3 | ||
var program = gl.createProgram() | ||
var vshader = gl.createShader(gl.VERTEX_SHADER) | ||
gl.shaderSource(vshader, vShaderTemplate) | ||
gl.compileShader(vshader) | ||
var fshader = gl.createShader(gl.FRAGMENT_SHADER) | ||
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) | ||
try { | ||
result.push(gl.canvas.toDataURL()) | ||
} catch (e) { | ||
var result = [] | ||
var vShaderTemplate = 'attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}' | ||
var fShaderTemplate = 'precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}' | ||
var vertexPosBuffer = gl.createBuffer() | ||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexPosBuffer) | ||
var vertices = new Float32Array([-0.2, -0.9, 0, 0.4, -0.26, 0, 0, 0.732134444, 0]) | ||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW) | ||
vertexPosBuffer.itemSize = 3 | ||
vertexPosBuffer.numItems = 3 | ||
var program = gl.createProgram() | ||
var vshader = gl.createShader(gl.VERTEX_SHADER) | ||
gl.shaderSource(vshader, vShaderTemplate) | ||
gl.compileShader(vshader) | ||
var fshader = gl.createShader(gl.FRAGMENT_SHADER) | ||
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) | ||
try { | ||
result.push(gl.canvas.toDataURL()) | ||
} catch (e) { | ||
/* .toDataURL may be absent or broken (blocked by extension) */ | ||
} | ||
result.push('extensions:' + (gl.getSupportedExtensions() || []).join(';')) | ||
result.push('webgl aliased line width range:' + fa2s(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE))) | ||
result.push('webgl aliased point size range:' + fa2s(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE))) | ||
result.push('webgl alpha bits:' + gl.getParameter(gl.ALPHA_BITS)) | ||
result.push('webgl antialiasing:' + (gl.getContextAttributes().antialias ? 'yes' : 'no')) | ||
result.push('webgl blue bits:' + gl.getParameter(gl.BLUE_BITS)) | ||
result.push('webgl depth bits:' + gl.getParameter(gl.DEPTH_BITS)) | ||
result.push('webgl green bits:' + gl.getParameter(gl.GREEN_BITS)) | ||
result.push('webgl max anisotropy:' + maxAnisotropy(gl)) | ||
result.push('webgl max combined texture image units:' + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max cube map texture size:' + gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) | ||
result.push('webgl max fragment uniform vectors:' + gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS)) | ||
result.push('webgl max render buffer size:' + gl.getParameter(gl.MAX_RENDERBUFFER_SIZE)) | ||
result.push('webgl max texture image units:' + gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max texture size:' + gl.getParameter(gl.MAX_TEXTURE_SIZE)) | ||
result.push('webgl max varying vectors:' + gl.getParameter(gl.MAX_VARYING_VECTORS)) | ||
result.push('webgl max vertex attribs:' + gl.getParameter(gl.MAX_VERTEX_ATTRIBS)) | ||
result.push('webgl max vertex texture image units:' + gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max vertex uniform vectors:' + gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS)) | ||
result.push('webgl max viewport dims:' + fa2s(gl.getParameter(gl.MAX_VIEWPORT_DIMS))) | ||
result.push('webgl red bits:' + gl.getParameter(gl.RED_BITS)) | ||
result.push('webgl renderer:' + gl.getParameter(gl.RENDERER)) | ||
result.push('webgl shading language version:' + gl.getParameter(gl.SHADING_LANGUAGE_VERSION)) | ||
result.push('webgl stencil bits:' + gl.getParameter(gl.STENCIL_BITS)) | ||
result.push('webgl vendor:' + gl.getParameter(gl.VENDOR)) | ||
result.push('webgl version:' + gl.getParameter(gl.VERSION)) | ||
} | ||
result.push('extensions:' + (gl.getSupportedExtensions() || []).join(';')) | ||
result.push('webgl aliased line width range:' + fa2s(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE))) | ||
result.push('webgl aliased point size range:' + fa2s(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE))) | ||
result.push('webgl alpha bits:' + gl.getParameter(gl.ALPHA_BITS)) | ||
result.push('webgl antialiasing:' + (gl.getContextAttributes().antialias ? 'yes' : 'no')) | ||
result.push('webgl blue bits:' + gl.getParameter(gl.BLUE_BITS)) | ||
result.push('webgl depth bits:' + gl.getParameter(gl.DEPTH_BITS)) | ||
result.push('webgl green bits:' + gl.getParameter(gl.GREEN_BITS)) | ||
result.push('webgl max anisotropy:' + maxAnisotropy(gl)) | ||
result.push('webgl max combined texture image units:' + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max cube map texture size:' + gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE)) | ||
result.push('webgl max fragment uniform vectors:' + gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS)) | ||
result.push('webgl max render buffer size:' + gl.getParameter(gl.MAX_RENDERBUFFER_SIZE)) | ||
result.push('webgl max texture image units:' + gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max texture size:' + gl.getParameter(gl.MAX_TEXTURE_SIZE)) | ||
result.push('webgl max varying vectors:' + gl.getParameter(gl.MAX_VARYING_VECTORS)) | ||
result.push('webgl max vertex attribs:' + gl.getParameter(gl.MAX_VERTEX_ATTRIBS)) | ||
result.push('webgl max vertex texture image units:' + gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS)) | ||
result.push('webgl max vertex uniform vectors:' + gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS)) | ||
result.push('webgl max viewport dims:' + fa2s(gl.getParameter(gl.MAX_VIEWPORT_DIMS))) | ||
result.push('webgl red bits:' + gl.getParameter(gl.RED_BITS)) | ||
result.push('webgl renderer:' + gl.getParameter(gl.RENDERER)) | ||
result.push('webgl shading language version:' + gl.getParameter(gl.SHADING_LANGUAGE_VERSION)) | ||
result.push('webgl stencil bits:' + gl.getParameter(gl.STENCIL_BITS)) | ||
result.push('webgl vendor:' + gl.getParameter(gl.VENDOR)) | ||
result.push('webgl version:' + gl.getParameter(gl.VERSION)) | ||
try { | ||
try { | ||
// Add the unmasked vendor and unmasked renderer if the debug_renderer_info extension is available | ||
var extensionDebugRendererInfo = gl.getExtension('WEBGL_debug_renderer_info') | ||
if (extensionDebugRendererInfo) { | ||
result.push('webgl unmasked vendor:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL)) | ||
result.push('webgl unmasked renderer:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL)) | ||
} | ||
} catch (e) { /* squelch */ } | ||
if (!gl.getShaderPrecisionFormat) { | ||
return result.join('~') | ||
var extensionDebugRendererInfo = gl.getExtension('WEBGL_debug_renderer_info') | ||
if (extensionDebugRendererInfo) { | ||
result.push('webgl unmasked vendor:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL)) | ||
result.push('webgl unmasked renderer:' + gl.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL)) | ||
} | ||
} catch (e) { /* squelch */ } | ||
var that = this | ||
if (!gl.getShaderPrecisionFormat) { | ||
return result | ||
} | ||
that.each(['FLOAT', 'INT'], function (numType) { | ||
that.each(['VERTEX', 'FRAGMENT'], function (shader) { | ||
that.each(['HIGH', 'MEDIUM', 'LOW'], function (numSize) { | ||
that.each(['precision', 'rangeMin', 'rangeMax'], function (key) { | ||
var format = gl.getShaderPrecisionFormat(gl[shader + '_SHADER'], gl[numSize + '_' + numType])[key] | ||
if (key !== 'precision') { | ||
key = 'precision ' + key | ||
} | ||
var line = ['webgl ', shader.toLowerCase(), ' shader ', numSize.toLowerCase(), ' ', numType.toLowerCase(), ' ', key, ':', format] | ||
result.push(line.join('')) | ||
}) | ||
each(['FLOAT', 'INT'], function (numType) { | ||
each(['VERTEX', 'FRAGMENT'], function (shader) { | ||
each(['HIGH', 'MEDIUM', 'LOW'], function (numSize) { | ||
each(['precision', 'rangeMin', 'rangeMax'], function (key) { | ||
var format = gl.getShaderPrecisionFormat(gl[shader + '_SHADER'], gl[numSize + '_' + numType])[key] | ||
if (key !== 'precision') { | ||
key = 'precision ' + key | ||
} | ||
var line = ['webgl ', shader.toLowerCase(), ' shader ', numSize.toLowerCase(), ' ', numType.toLowerCase(), ' ', key, ':', format].join('') | ||
result.push(line) | ||
}) | ||
}) | ||
}) | ||
return result.join('~') | ||
}, | ||
getWebglVendorAndRenderer: function () { | ||
}) | ||
return result | ||
} | ||
var getWebglVendorAndRenderer = function () { | ||
/* This a subset of the WebGL fingerprint with a lot of entropy, while being reasonably browser-independent */ | ||
try { | ||
var glContext = this.getWebglCanvas() | ||
var extensionDebugRendererInfo = glContext.getExtension('WEBGL_debug_renderer_info') | ||
return glContext.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL) + '~' + glContext.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL) | ||
} catch (e) { | ||
return null | ||
} | ||
}, | ||
getAdBlock: function () { | ||
var ads = document.createElement('div') | ||
ads.innerHTML = ' ' | ||
ads.className = 'adsbox' | ||
var result = false | ||
try { | ||
try { | ||
var glContext = getWebglCanvas() | ||
var extensionDebugRendererInfo = glContext.getExtension('WEBGL_debug_renderer_info') | ||
return glContext.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL) + '~' + glContext.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL) | ||
} catch (e) { | ||
return null | ||
} | ||
} | ||
var getAdBlock = function () { | ||
var ads = document.createElement('div') | ||
ads.innerHTML = ' ' | ||
ads.className = 'adsbox' | ||
var result = false | ||
try { | ||
// body may not exist, that's why we need try/catch | ||
document.body.appendChild(ads) | ||
result = document.getElementsByClassName('adsbox')[0].offsetHeight === 0 | ||
document.body.removeChild(ads) | ||
} catch (e) { | ||
result = false | ||
} | ||
return result | ||
}, | ||
getHasLiedLanguages: function () { | ||
document.body.appendChild(ads) | ||
result = document.getElementsByClassName('adsbox')[0].offsetHeight === 0 | ||
document.body.removeChild(ads) | ||
} catch (e) { | ||
result = false | ||
} | ||
return result | ||
} | ||
var getHasLiedLanguages = function () { | ||
// We check if navigator.language is equal to the first language of navigator.languages | ||
if (typeof navigator.languages !== 'undefined') { | ||
try { | ||
var firstLanguages = navigator.languages[0].substr(0, 2) | ||
if (firstLanguages !== navigator.language.substr(0, 2)) { | ||
return true | ||
} | ||
} catch (err) { | ||
if (typeof navigator.languages !== 'undefined') { | ||
try { | ||
var firstLanguages = navigator.languages[0].substr(0, 2) | ||
if (firstLanguages !== navigator.language.substr(0, 2)) { | ||
return true | ||
} | ||
} | ||
return false | ||
}, | ||
getHasLiedResolution: function () { | ||
if (window.screen.width < window.screen.availWidth) { | ||
} catch (err) { | ||
return true | ||
} | ||
if (window.screen.height < window.screen.availHeight) { | ||
return true | ||
} | ||
return false | ||
}, | ||
getHasLiedOs: function () { | ||
var userAgent = navigator.userAgent.toLowerCase() | ||
var oscpu = navigator.oscpu | ||
var platform = navigator.platform.toLowerCase() | ||
var os | ||
} | ||
return false | ||
} | ||
var getHasLiedResolution = function () { | ||
return window.screen.width < window.screen.availWidth || window.screen.height < window.screen.availHeight | ||
} | ||
var getHasLiedOs = function () { | ||
var userAgent = navigator.userAgent.toLowerCase() | ||
var oscpu = navigator.oscpu | ||
var platform = navigator.platform.toLowerCase() | ||
var os | ||
// We extract the OS from the user agent (respect the order of the if else if statement) | ||
if (userAgent.indexOf('windows phone') >= 0) { | ||
os = 'Windows Phone' | ||
} else if (userAgent.indexOf('win') >= 0) { | ||
os = 'Windows' | ||
} else if (userAgent.indexOf('android') >= 0) { | ||
os = 'Android' | ||
} else if (userAgent.indexOf('linux') >= 0) { | ||
os = 'Linux' | ||
} else if (userAgent.indexOf('iphone') >= 0 || userAgent.indexOf('ipad') >= 0) { | ||
os = 'iOS' | ||
} else if (userAgent.indexOf('mac') >= 0) { | ||
os = 'Mac' | ||
} else { | ||
os = 'Other' | ||
} | ||
if (userAgent.indexOf('windows phone') >= 0) { | ||
os = 'Windows Phone' | ||
} else if (userAgent.indexOf('win') >= 0) { | ||
os = 'Windows' | ||
} else if (userAgent.indexOf('android') >= 0) { | ||
os = 'Android' | ||
} else if (userAgent.indexOf('linux') >= 0) { | ||
os = 'Linux' | ||
} else if (userAgent.indexOf('iphone') >= 0 || userAgent.indexOf('ipad') >= 0) { | ||
os = 'iOS' | ||
} else if (userAgent.indexOf('mac') >= 0) { | ||
os = 'Mac' | ||
} else { | ||
os = 'Other' | ||
} | ||
// We detect if the person uses a mobile device | ||
var mobileDevice | ||
if (('ontouchstart' in window) || | ||
(navigator.maxTouchPoints > 0) || | ||
(navigator.msMaxTouchPoints > 0)) { | ||
mobileDevice = true | ||
} else { | ||
mobileDevice = false | ||
} | ||
var mobileDevice = (('ontouchstart' in window) || | ||
(navigator.maxTouchPoints > 0) || | ||
(navigator.msMaxTouchPoints > 0)) | ||
if (mobileDevice && os !== 'Windows Phone' && os !== 'Android' && os !== 'iOS' && os !== 'Other') { | ||
return true | ||
} | ||
if (mobileDevice && os !== 'Windows Phone' && os !== 'Android' && os !== 'iOS' && os !== 'Other') { | ||
return true | ||
} | ||
// We compare oscpu with the OS extracted from the UA | ||
if (typeof oscpu !== 'undefined') { | ||
oscpu = oscpu.toLowerCase() | ||
if (oscpu.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') { | ||
return true | ||
} else if (oscpu.indexOf('linux') >= 0 && os !== 'Linux' && os !== 'Android') { | ||
return true | ||
} else if (oscpu.indexOf('mac') >= 0 && os !== 'Mac' && os !== 'iOS') { | ||
return true | ||
} else if ((oscpu.indexOf('win') === -1 && oscpu.indexOf('linux') === -1 && oscpu.indexOf('mac') === -1) !== (os === 'Other')) { | ||
return true | ||
} | ||
} | ||
// We compare platform with the OS extracted from the UA | ||
if (platform.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') { | ||
if (typeof oscpu !== 'undefined') { | ||
oscpu = oscpu.toLowerCase() | ||
if (oscpu.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') { | ||
return true | ||
} else if ((platform.indexOf('linux') >= 0 || platform.indexOf('android') >= 0 || platform.indexOf('pike') >= 0) && os !== 'Linux' && os !== 'Android') { | ||
} else if (oscpu.indexOf('linux') >= 0 && os !== 'Linux' && os !== 'Android') { | ||
return true | ||
} else if ((platform.indexOf('mac') >= 0 || platform.indexOf('ipad') >= 0 || platform.indexOf('ipod') >= 0 || platform.indexOf('iphone') >= 0) && os !== 'Mac' && os !== 'iOS') { | ||
} else if (oscpu.indexOf('mac') >= 0 && os !== 'Mac' && os !== 'iOS') { | ||
return true | ||
} else if ((platform.indexOf('win') === -1 && platform.indexOf('linux') === -1 && platform.indexOf('mac') === -1) !== (os === 'Other')) { | ||
} else if ((oscpu.indexOf('win') === -1 && oscpu.indexOf('linux') === -1 && oscpu.indexOf('mac') === -1) !== (os === 'Other')) { | ||
return true | ||
} | ||
} | ||
if (typeof navigator.plugins === 'undefined' && os !== 'Windows' && os !== 'Windows Phone') { | ||
// We are are in the case where the person uses ie, therefore we can infer that it's windows | ||
return true | ||
} | ||
// We compare platform with the OS extracted from the UA | ||
if (platform.indexOf('win') >= 0 && os !== 'Windows' && os !== 'Windows Phone') { | ||
return true | ||
} else if ((platform.indexOf('linux') >= 0 || platform.indexOf('android') >= 0 || platform.indexOf('pike') >= 0) && os !== 'Linux' && os !== 'Android') { | ||
return true | ||
} else if ((platform.indexOf('mac') >= 0 || platform.indexOf('ipad') >= 0 || platform.indexOf('ipod') >= 0 || platform.indexOf('iphone') >= 0) && os !== 'Mac' && os !== 'iOS') { | ||
return true | ||
} else if ((platform.indexOf('win') === -1 && platform.indexOf('linux') === -1 && platform.indexOf('mac') === -1) !== (os === 'Other')) { | ||
return true | ||
} | ||
return false | ||
}, | ||
getHasLiedBrowser: function () { | ||
var userAgent = navigator.userAgent.toLowerCase() | ||
var productSub = navigator.productSub | ||
return typeof navigator.plugins === 'undefined' && os !== 'Windows' && os !== 'Windows Phone' | ||
} | ||
var getHasLiedBrowser = function () { | ||
var userAgent = navigator.userAgent.toLowerCase() | ||
var productSub = navigator.productSub | ||
// we extract the browser from the user agent (respect the order of the tests) | ||
var browser | ||
if (userAgent.indexOf('firefox') >= 0) { | ||
browser = 'Firefox' | ||
} else if (userAgent.indexOf('opera') >= 0 || userAgent.indexOf('opr') >= 0) { | ||
browser = 'Opera' | ||
} else if (userAgent.indexOf('chrome') >= 0) { | ||
browser = 'Chrome' | ||
} else if (userAgent.indexOf('safari') >= 0) { | ||
browser = 'Safari' | ||
} else if (userAgent.indexOf('trident') >= 0) { | ||
browser = 'Internet Explorer' | ||
} else { | ||
browser = 'Other' | ||
} | ||
var browser | ||
if (userAgent.indexOf('firefox') >= 0) { | ||
browser = 'Firefox' | ||
} else if (userAgent.indexOf('opera') >= 0 || userAgent.indexOf('opr') >= 0) { | ||
browser = 'Opera' | ||
} else if (userAgent.indexOf('chrome') >= 0) { | ||
browser = 'Chrome' | ||
} else if (userAgent.indexOf('safari') >= 0) { | ||
browser = 'Safari' | ||
} else if (userAgent.indexOf('trident') >= 0) { | ||
browser = 'Internet Explorer' | ||
} else { | ||
browser = 'Other' | ||
} | ||
if ((browser === 'Chrome' || browser === 'Safari' || browser === 'Opera') && productSub !== '20030107') { | ||
return true | ||
} | ||
if ((browser === 'Chrome' || browser === 'Safari' || browser === 'Opera') && productSub !== '20030107') { | ||
return true | ||
} | ||
// eslint-disable-next-line no-eval | ||
var tempRes = eval.toString().length | ||
if (tempRes === 37 && browser !== 'Safari' && browser !== 'Firefox' && browser !== 'Other') { | ||
return true | ||
} else if (tempRes === 39 && browser !== 'Internet Explorer' && browser !== 'Other') { | ||
return true | ||
} else if (tempRes === 33 && browser !== 'Chrome' && browser !== 'Opera' && browser !== 'Other') { | ||
return true | ||
} | ||
var tempRes = eval.toString().length | ||
if (tempRes === 37 && browser !== 'Safari' && browser !== 'Firefox' && browser !== 'Other') { | ||
return true | ||
} else if (tempRes === 39 && browser !== 'Internet Explorer' && browser !== 'Other') { | ||
return true | ||
} else if (tempRes === 33 && browser !== 'Chrome' && browser !== 'Opera' && browser !== 'Other') { | ||
return true | ||
} | ||
// We create an error to see how it is handled | ||
var errFirefox | ||
var errFirefox | ||
try { | ||
// eslint-disable-next-line no-throw-literal | ||
throw 'a' | ||
} catch (err) { | ||
try { | ||
// eslint-disable-next-line no-throw-literal | ||
throw 'a' | ||
} catch (err) { | ||
try { | ||
err.toSource() | ||
errFirefox = true | ||
} catch (errOfErr) { | ||
errFirefox = false | ||
} | ||
err.toSource() | ||
errFirefox = true | ||
} catch (errOfErr) { | ||
errFirefox = false | ||
} | ||
if (errFirefox && browser !== 'Firefox' && browser !== 'Other') { | ||
return true | ||
} | ||
} | ||
return errFirefox && browser !== 'Firefox' && browser !== 'Other' | ||
} | ||
var isCanvasSupported = function () { | ||
var elem = document.createElement('canvas') | ||
return !!(elem.getContext && elem.getContext('2d')) | ||
} | ||
var isWebGlSupported = function () { | ||
// code taken from Modernizr | ||
if (!isCanvasSupported()) { | ||
return false | ||
}, | ||
isCanvasSupported: function () { | ||
var elem = document.createElement('canvas') | ||
return !!(elem.getContext && elem.getContext('2d')) | ||
}, | ||
isWebGlSupported: function () { | ||
// code taken from Modernizr | ||
if (!this.isCanvasSupported()) { | ||
return false | ||
} | ||
var glContext = getWebglCanvas() | ||
return !!window.WebGLRenderingContext && !!glContext | ||
} | ||
var isIE = function () { | ||
if (navigator.appName === 'Microsoft Internet Explorer') { | ||
return true | ||
} else if (navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)) { // IE 11 | ||
return true | ||
} | ||
return false | ||
} | ||
var hasSwfObjectLoaded = function () { | ||
return typeof window.swfobject !== 'undefined' | ||
} | ||
var hasMinFlashInstalled = function () { | ||
return window.swfobject.hasFlashPlayerVersion('9.0.0') | ||
} | ||
var addFlashDivNode = function (options) { | ||
var node = document.createElement('div') | ||
node.setAttribute('id', options.fonts.swfContainerId) | ||
document.body.appendChild(node) | ||
} | ||
var loadSwfAndDetectFonts = function (done, options) { | ||
var hiddenCallback = '___fp_swf_loaded' | ||
window[hiddenCallback] = function (fonts) { | ||
done(fonts) | ||
} | ||
var id = options.fonts.swfContainerId | ||
addFlashDivNode() | ||
var flashvars = { onReady: hiddenCallback } | ||
var flashparams = { allowScriptAccess: 'always', menu: 'false' } | ||
window.swfobject.embedSWF(options.fonts.swfPath, id, '1', '1', '9.0.0', false, flashvars, flashparams, {}) | ||
} | ||
var getWebglCanvas = function () { | ||
var canvas = document.createElement('canvas') | ||
var gl = null | ||
try { | ||
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl') | ||
} catch (e) { /* squelch */ } | ||
if (!gl) { gl = null } | ||
return gl | ||
} | ||
var components = [ | ||
{key: 'userAgent', getData: UserAgent}, | ||
{key: 'language', getData: languageKey}, | ||
{key: 'colorDepth', getData: colorDepthKey}, | ||
{key: 'deviceMemory', getData: deviceMemoryKey}, | ||
{key: 'pixelRatio', getData: pixelRatioKey}, | ||
{key: 'hardwareConcurrency', getData: hardwareConcurrencyKey}, | ||
{key: 'screenResolution', getData: screenResolutionKey}, | ||
{key: 'availableScreenResolution', getData: availableScreenResolutionKey}, | ||
{key: 'timezoneOffset', getData: timezoneOffset}, | ||
{key: 'timezone', getData: timezone}, | ||
{key: 'sessionStorage', getData: sessionStorageKey}, | ||
{key: 'localStorage', getData: localStorageKey}, | ||
{key: 'indexedDb', getData: indexedDbKey}, | ||
{key: 'addBehavior', getData: addBehaviorKey}, | ||
{key: 'openDatabase', getData: openDatabaseKey}, | ||
{key: 'cpuClass', getData: cpuClassKey}, | ||
{key: 'platform', getData: platformKey}, | ||
{key: 'doNotTrack', getData: doNotTrackKey}, | ||
{key: 'plugins', getData: pluginsComponent}, | ||
{key: 'canvas', getData: canvasKey}, | ||
{key: 'webgl', getData: webglKey}, | ||
{key: 'webglVendorAndRenderer', getData: webglVendorAndRendererKey}, | ||
{key: 'adBlock', getData: adBlockKey}, | ||
{key: 'hasLiedLanguages', getData: hasLiedLanguagesKey}, | ||
{key: 'hasLiedResolution', getData: hasLiedResolutionKey}, | ||
{key: 'hasLiedOs', getData: hasLiedOsKey}, | ||
{key: 'hasLiedBrowser', getData: hasLiedBrowserKey}, | ||
{key: 'touchSupport', getData: touchSupportKey}, | ||
{key: 'fonts', getData: jsFontsKey, pauseBefore: true}, | ||
{key: 'fontsFlash', getData: flashFontsKey, pauseBefore: true}, | ||
{key: 'audio', getData: audioKey}, | ||
{key: 'enumerateDevices', getData: enumerateDevicesKey} | ||
] | ||
var Fingerprint2 = function (options) { | ||
throw new Error("'new Fingerprint()' is deprecated, see https://github.com/Valve/fingerprintjs2#upgrade-guide-from-182-to-200") | ||
} | ||
Fingerprint2.get = function (options, callback) { | ||
if (!callback) { | ||
callback = options | ||
options = {} | ||
} else if (!options) { | ||
options = {} | ||
} | ||
extendSoft(options, defaultOptions) | ||
options.components = options.extraComponents.concat(components) | ||
var keys = { | ||
data: [], | ||
addPreprocessedComponent: function (key, value) { | ||
if (typeof options.preprocessor === 'function') { | ||
value = options.preprocessor(key, value) | ||
} | ||
keys.data.push({key: key, value: value}) | ||
} | ||
} | ||
var glContext = this.getWebglCanvas() | ||
return !!window.WebGLRenderingContext && !!glContext | ||
}, | ||
isIE: function () { | ||
if (navigator.appName === 'Microsoft Internet Explorer') { | ||
return true | ||
} else if (navigator.appName === 'Netscape' && /Trident/.test(navigator.userAgent)) { // IE 11 | ||
return true | ||
var i = -1 | ||
var chainComponents = function (alreadyWaited) { | ||
i += 1 | ||
if (i >= options.components.length) { // on finish | ||
callback(keys.data) | ||
return | ||
} | ||
return false | ||
}, | ||
hasSwfObjectLoaded: function () { | ||
return typeof window.swfobject !== 'undefined' | ||
}, | ||
hasMinFlashInstalled: function () { | ||
return window.swfobject.hasFlashPlayerVersion('9.0.0') | ||
}, | ||
addFlashDivNode: function () { | ||
var node = document.createElement('div') | ||
node.setAttribute('id', this.options.swfContainerId) | ||
document.body.appendChild(node) | ||
}, | ||
loadSwfAndDetectFonts: function (done) { | ||
var hiddenCallback = '___fp_swf_loaded' | ||
window[hiddenCallback] = function (fonts) { | ||
done(fonts) | ||
var component = options.components[i] | ||
if (options.excludes[component.key]) { | ||
chainComponents(false) // skip | ||
return | ||
} | ||
var id = this.options.swfContainerId | ||
this.addFlashDivNode() | ||
var flashvars = { onReady: hiddenCallback } | ||
var flashparams = { allowScriptAccess: 'always', menu: 'false' } | ||
window.swfobject.embedSWF(this.options.swfPath, id, '1', '1', '9.0.0', false, flashvars, flashparams, {}) | ||
}, | ||
getWebglCanvas: function () { | ||
var canvas = document.createElement('canvas') | ||
var gl = null | ||
try { | ||
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl') | ||
} catch (e) { /* squelch */ } | ||
if (!gl) { gl = null } | ||
return gl | ||
}, | ||
/** | ||
* @template T | ||
* @param {T=} context | ||
*/ | ||
each: function (obj, iterator, context) { | ||
if (obj === null) { | ||
if (!alreadyWaited && component.pauseBefore) { | ||
i -= 1 | ||
setTimeout(function () { | ||
chainComponents(true) | ||
}, 1) | ||
return | ||
} | ||
if (this.nativeForEach && obj.forEach === this.nativeForEach) { | ||
obj.forEach(iterator, context) | ||
} else if (obj.length === +obj.length) { | ||
for (var i = 0, l = obj.length; i < l; i++) { | ||
if (iterator.call(context, obj[i], i, obj) === {}) { return } | ||
} | ||
} else { | ||
for (var key in obj) { | ||
if (obj.hasOwnProperty(key)) { | ||
if (iterator.call(context, obj[key], key, obj) === {}) { return } | ||
} | ||
} | ||
try { | ||
component.getData(function (value) { | ||
keys.addPreprocessedComponent(component.key, value) | ||
chainComponents(false) | ||
}, options) | ||
} catch (error) { | ||
// main body error | ||
keys.addPreprocessedComponent(component.key, String(error)) | ||
chainComponents(false) | ||
} | ||
}, | ||
} | ||
/** | ||
* @template T,V | ||
* @param {T=} context | ||
* @param {function(this:T, ?, (string|number), T=):V} iterator | ||
* @return {V} | ||
*/ | ||
map: function (obj, iterator, context) { | ||
var results = [] | ||
// Not using strict equality so that this acts as a | ||
// shortcut to checking for `null` and `undefined`. | ||
if (obj == null) { return results } | ||
if (this.nativeMap && obj.map === this.nativeMap) { return obj.map(iterator, context) } | ||
this.each(obj, function (value, index, list) { | ||
results[results.length] = iterator.call(context, value, index, list) | ||
}) | ||
return results | ||
}, | ||
chainComponents(false) | ||
} | ||
/// MurmurHash3 related functions | ||
Fingerprint2.getPromise = function (options) { | ||
return new Promise(function (resolve, reject) { | ||
Fingerprint2.get(options, resolve) | ||
}) | ||
} | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// added together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
x64Add: function (m, n) { | ||
m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] | ||
n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] | ||
var o = [0, 0, 0, 0] | ||
o[3] += m[3] + n[3] | ||
o[2] += o[3] >>> 16 | ||
o[3] &= 0xffff | ||
o[2] += m[2] + n[2] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[1] += m[1] + n[1] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[0] += m[0] + n[0] | ||
o[0] &= 0xffff | ||
return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] | ||
}, | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// multiplied together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
x64Multiply: function (m, n) { | ||
m = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff] | ||
n = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff] | ||
var o = [0, 0, 0, 0] | ||
o[3] += m[3] * n[3] | ||
o[2] += o[3] >>> 16 | ||
o[3] &= 0xffff | ||
o[2] += m[2] * n[3] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[2] += m[3] * n[2] | ||
o[1] += o[2] >>> 16 | ||
o[2] &= 0xffff | ||
o[1] += m[1] * n[3] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[1] += m[2] * n[2] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[1] += m[3] * n[1] | ||
o[0] += o[1] >>> 16 | ||
o[1] &= 0xffff | ||
o[0] += (m[0] * n[3]) + (m[1] * n[2]) + (m[2] * n[1]) + (m[3] * n[0]) | ||
o[0] &= 0xffff | ||
return [(o[0] << 16) | o[1], (o[2] << 16) | o[3]] | ||
}, | ||
// | ||
// Given a 64bit int (as an array of two 32bit ints) and an int | ||
// representing a number of bit positions, returns the 64bit int (as an | ||
// array of two 32bit ints) rotated left by that number of positions. | ||
// | ||
x64Rotl: function (m, n) { | ||
n %= 64 | ||
if (n === 32) { | ||
return [m[1], m[0]] | ||
} else if (n < 32) { | ||
return [(m[0] << n) | (m[1] >>> (32 - n)), (m[1] << n) | (m[0] >>> (32 - n))] | ||
} else { | ||
n -= 32 | ||
return [(m[1] << n) | (m[0] >>> (32 - n)), (m[0] << n) | (m[1] >>> (32 - n))] | ||
Fingerprint2.getV18 = function (options, callback) { | ||
if (callback == null) { | ||
callback = options | ||
options = {} | ||
} | ||
return Fingerprint2.get(options, function (components) { | ||
var newComponents = [] | ||
for (var i = 0; i < components.length; i++) { | ||
var component = components[i] | ||
if (component.value === (options.NOT_AVAILABLE || 'not available')) { | ||
newComponents.push({key: component.key, value: 'unknown'}) | ||
} else if (component.key === 'plugins') { | ||
newComponents.push({key: 'plugins', | ||
value: map(component.value, function (p) { | ||
var mimeTypes = map(p[2], function (mt) { | ||
if (mt.join) { return mt.join('~') } | ||
return mt | ||
}).join(',') | ||
return [p[0], p[1], mimeTypes].join('::') | ||
})}) | ||
} else if (['canvas', 'webgl'].indexOf(component.key) !== -1) { | ||
newComponents.push({key: component.key, value: component.value.join('~')}) | ||
} else if (['sessionStorage', 'localStorage', 'indexedDb', 'addBehavior', 'openDatabase'].indexOf(component.key) !== -1) { | ||
if (component.value) { | ||
newComponents.push({key: component.key, value: 1}) | ||
} else { | ||
// skip | ||
continue | ||
} | ||
} else { | ||
if (component.value) { | ||
newComponents.push(component.value.join ? {key: component.key, value: component.value.join(';')} : component) | ||
} else { | ||
newComponents.push({key: component.key, value: component.value}) | ||
} | ||
} | ||
} | ||
}, | ||
// | ||
// Given a 64bit int (as an array of two 32bit ints) and an int | ||
// representing a number of bit positions, returns the 64bit int (as an | ||
// array of two 32bit ints) shifted left by that number of positions. | ||
// | ||
x64LeftShift: function (m, n) { | ||
n %= 64 | ||
if (n === 0) { | ||
return m | ||
} else if (n < 32) { | ||
return [(m[0] << n) | (m[1] >>> (32 - n)), m[1] << n] | ||
} else { | ||
return [m[1] << (n - 32), 0] | ||
} | ||
}, | ||
// | ||
// Given two 64bit ints (as an array of two 32bit ints) returns the two | ||
// xored together as a 64bit int (as an array of two 32bit ints). | ||
// | ||
x64Xor: function (m, n) { | ||
return [m[0] ^ n[0], m[1] ^ n[1]] | ||
}, | ||
// | ||
// Given a block, returns murmurHash3's final x64 mix of that block. | ||
// (`[0, h[0] >>> 1]` is a 33 bit unsigned right shift. This is the | ||
// only place where we need to right shift 64bit ints.) | ||
// | ||
x64Fmix: function (h) { | ||
h = this.x64Xor(h, [0, h[0] >>> 1]) | ||
h = this.x64Multiply(h, [0xff51afd7, 0xed558ccd]) | ||
h = this.x64Xor(h, [0, h[0] >>> 1]) | ||
h = this.x64Multiply(h, [0xc4ceb9fe, 0x1a85ec53]) | ||
h = this.x64Xor(h, [0, h[0] >>> 1]) | ||
return h | ||
}, | ||
var murmur = x64hash128(map(newComponents, function (component) { return component.value }).join('~~~'), 31) | ||
callback(murmur, newComponents) | ||
}) | ||
} | ||
// | ||
// Given a string and an optional seed as an int, returns a 128 bit | ||
// hash using the x64 flavor of MurmurHash3, as an unsigned hex. | ||
// | ||
x64hash128: function (key, seed) { | ||
key = key || '' | ||
seed = seed || 0 | ||
var remainder = key.length % 16 | ||
var bytes = key.length - remainder | ||
var h1 = [0, seed] | ||
var h2 = [0, seed] | ||
var k1 = [0, 0] | ||
var k2 = [0, 0] | ||
var c1 = [0x87c37b91, 0x114253d5] | ||
var c2 = [0x4cf5ad43, 0x2745937f] | ||
for (var i = 0; i < bytes; i = i + 16) { | ||
k1 = [((key.charCodeAt(i + 4) & 0xff)) | ((key.charCodeAt(i + 5) & 0xff) << 8) | ((key.charCodeAt(i + 6) & 0xff) << 16) | ((key.charCodeAt(i + 7) & 0xff) << 24), ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(i + 1) & 0xff) << 8) | ((key.charCodeAt(i + 2) & 0xff) << 16) | ((key.charCodeAt(i + 3) & 0xff) << 24)] | ||
k2 = [((key.charCodeAt(i + 12) & 0xff)) | ((key.charCodeAt(i + 13) & 0xff) << 8) | ((key.charCodeAt(i + 14) & 0xff) << 16) | ((key.charCodeAt(i + 15) & 0xff) << 24), ((key.charCodeAt(i + 8) & 0xff)) | ((key.charCodeAt(i + 9) & 0xff) << 8) | ((key.charCodeAt(i + 10) & 0xff) << 16) | ((key.charCodeAt(i + 11) & 0xff) << 24)] | ||
k1 = this.x64Multiply(k1, c1) | ||
k1 = this.x64Rotl(k1, 31) | ||
k1 = this.x64Multiply(k1, c2) | ||
h1 = this.x64Xor(h1, k1) | ||
h1 = this.x64Rotl(h1, 27) | ||
h1 = this.x64Add(h1, h2) | ||
h1 = this.x64Add(this.x64Multiply(h1, [0, 5]), [0, 0x52dce729]) | ||
k2 = this.x64Multiply(k2, c2) | ||
k2 = this.x64Rotl(k2, 33) | ||
k2 = this.x64Multiply(k2, c1) | ||
h2 = this.x64Xor(h2, k2) | ||
h2 = this.x64Rotl(h2, 31) | ||
h2 = this.x64Add(h2, h1) | ||
h2 = this.x64Add(this.x64Multiply(h2, [0, 5]), [0, 0x38495ab5]) | ||
} | ||
k1 = [0, 0] | ||
k2 = [0, 0] | ||
switch (remainder) { | ||
case 15: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 14)], 48)) | ||
// fallthrough | ||
case 14: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 13)], 40)) | ||
// fallthrough | ||
case 13: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 12)], 32)) | ||
// fallthrough | ||
case 12: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 11)], 24)) | ||
// fallthrough | ||
case 11: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 10)], 16)) | ||
// fallthrough | ||
case 10: | ||
k2 = this.x64Xor(k2, this.x64LeftShift([0, key.charCodeAt(i + 9)], 8)) | ||
// fallthrough | ||
case 9: | ||
k2 = this.x64Xor(k2, [0, key.charCodeAt(i + 8)]) | ||
k2 = this.x64Multiply(k2, c2) | ||
k2 = this.x64Rotl(k2, 33) | ||
k2 = this.x64Multiply(k2, c1) | ||
h2 = this.x64Xor(h2, k2) | ||
// fallthrough | ||
case 8: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 7)], 56)) | ||
// fallthrough | ||
case 7: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 6)], 48)) | ||
// fallthrough | ||
case 6: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 5)], 40)) | ||
// fallthrough | ||
case 5: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 4)], 32)) | ||
// fallthrough | ||
case 4: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 3)], 24)) | ||
// fallthrough | ||
case 3: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 2)], 16)) | ||
// fallthrough | ||
case 2: | ||
k1 = this.x64Xor(k1, this.x64LeftShift([0, key.charCodeAt(i + 1)], 8)) | ||
// fallthrough | ||
case 1: | ||
k1 = this.x64Xor(k1, [0, key.charCodeAt(i)]) | ||
k1 = this.x64Multiply(k1, c1) | ||
k1 = this.x64Rotl(k1, 31) | ||
k1 = this.x64Multiply(k1, c2) | ||
h1 = this.x64Xor(h1, k1) | ||
// fallthrough | ||
} | ||
h1 = this.x64Xor(h1, [0, key.length]) | ||
h2 = this.x64Xor(h2, [0, key.length]) | ||
h1 = this.x64Add(h1, h2) | ||
h2 = this.x64Add(h2, h1) | ||
h1 = this.x64Fmix(h1) | ||
h2 = this.x64Fmix(h2) | ||
h1 = this.x64Add(h1, h2) | ||
h2 = this.x64Add(h2, h1) | ||
return ('00000000' + (h1[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h1[1] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[0] >>> 0).toString(16)).slice(-8) + ('00000000' + (h2[1] >>> 0).toString(16)).slice(-8) | ||
} | ||
} | ||
Fingerprint2.VERSION = '1.8.0' | ||
Fingerprint2.x64hash128 = x64hash128 | ||
Fingerprint2.VERSION = '2.0.0' | ||
return Fingerprint2 | ||
}) |
{ | ||
"name": "@fingerprintjs/fingerprintjs", | ||
"version": "1.8.6", | ||
"version": "2.0.3", | ||
"description": "Modern & flexible browser fingerprinting library", | ||
@@ -24,6 +24,7 @@ "repository": { | ||
"devDependencies": { | ||
"gulp": "^3.9.1", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-standard": "^10.1.1", | ||
"gulp-uglify": "^3.0.0", | ||
"gulp": "^4.0.0", | ||
"gulp-util": "^3.0.8", | ||
"gulp-header-license": "^1.0.9", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-uglify": "^3.0.1", | ||
"standard": "^10.0.3" | ||
@@ -30,0 +31,0 @@ }, |
333
README.md
@@ -5,2 +5,3 @@ # Fingerprintjs2 | ||
[![](https://badges.gitter.im/Valve/fingerprintjs2.svg)](https://gitter.im/Valve/fingerprintjs2) | ||
[![npm](https://img.shields.io/npm/dm/fingerprintjs2.svg)][npm-link] | ||
@@ -11,18 +12,2 @@ <a href="https://www.patreon.com/bePatron?u=7954991" data-patreon-widget-type="become-patron-button">Support library on Patreon!</a> | ||
Original fingerprintjs library was developed in 2012, it's now impossible to evolve it | ||
without breaking backwards compatibilty, so this project will be where | ||
all the new development happens. | ||
This project will use significantly more sources for fingerprinting, all | ||
of them will be configurable, that is it should be possible to | ||
cherry-pick only the options you need or just enable them all. | ||
I'm also paying special attention to IE plugins, popular in China, such | ||
as QQ, Baidu and others. | ||
This project will not be backwards compatible with original | ||
fingerprintjs. | ||
This project uses `semver`. | ||
## Installation | ||
@@ -39,75 +24,98 @@ | ||
```js | ||
new Fingerprint2().get(function(result, components) { | ||
console.log(result) // a hash, representing your device fingerprint | ||
console.log(components) // an array of FP components | ||
}) | ||
if (window.requestIdleCallback) { | ||
requestIdleCallback(function () { | ||
Fingerprint2.get(function (components) { | ||
console.log(components) // an array of components: {key: ..., value: ...} | ||
}) | ||
}) | ||
} else { | ||
setTimeout(function () { | ||
Fingerprint2.get(function (components) { | ||
console.log(components) // an array of components: {key: ..., value: ...} | ||
}) | ||
}, 500) | ||
} | ||
``` | ||
**Note:** You should not run fingerprinting directly on or after page load. Rather, delay it for a few milliseconds to ensure consistent fingerprints. See [#307](https://github.com/Valve/fingerprintjs2/issues/307), [#254](https://github.com/Valve/fingerprintjs2/issues/254), and others. | ||
**Note:** You should not run fingerprinting directly on or after page load. Rather, delay it for a few milliseconds with [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout) or [requestIdleCallback](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) to ensure consistent fingerprints. See [#307](https://github.com/Valve/fingerprintjs2/issues/307), [#254](https://github.com/Valve/fingerprintjs2/issues/254), and others. | ||
#### You can pass an object with options (all of which are optional): | ||
On my machine (MBP 2013 Core i5) + Chrome 46 the default FP process takes about 80-100ms. If you use `extendedJsFonts` option this time will increase up to 2000ms (cold font cache). | ||
To speed up fingerprint computation, you can exclude font detection (~ 40ms), canvas fingerprint (~ 10ms), WebGL fingerprint (~ 35 ms), and Audio fingerprint (~30 ms). | ||
## Options | ||
You choose which components to include in the fingerprint, and configure some other stuff. Example: | ||
```js | ||
var options = {swfPath: '/assets/FontList.swf', excludeUserAgent: true} | ||
new Fingerprint2(options).get(function(result) { | ||
console.log(result) | ||
}) | ||
var options = {fonts: {extendedJsFonts: true}, excludes: {userAgent: true}} | ||
``` | ||
Full list of options will be in the | ||
(https://github.com/Valve/fingerprintjs2/wiki/List-of-options) wiki | ||
page. | ||
For the default options, please see the source code (look for `var defaultOptions = {`). | ||
Flash font enumeration is disabled by default. JS code is used by | ||
default to get the list of available fonts. | ||
### `fonts.extendedJsFonts` | ||
The reason for this is that Flash will not work in incognito mode. | ||
By default, JS font detection will only detect up to 65 installed fonts. If you want to improve the font detection, you can pass `extendedJsFonts: true` option. This will increase the number of detectable fonts to ~500. | ||
However, you can make the library to use Flash when detecting the fonts | ||
with: | ||
Note that this option increases fingerprint duration from about 80-100ms to up to 2000ms (cold font cache). It can incur even more overhead on mobile Firefox browsers, which is much slower in font detection, so use it with caution on mobile devices. | ||
### `fonts.userDefinedFonts` | ||
Specifies an array of user-defined fonts to increase font fingerprint entropy even more. | ||
While hundreds of the most popular fonts are included in the extended font list, you may wish to increase the entropy of the font fingerprint by specifying the `userDefinedFonts` option as an array of font names, **but make sure to call the Fingerprint function after the page load, and not before**, otherwise font detection might not work properly and in a result returned hash might be different every time you reloaded the page. | ||
```js | ||
excludeJsFonts: true | ||
Fingerprint2.get({ | ||
userDefinedFonts: ["Nimbus Mono", "Junicode", "Presto"] | ||
}, function(components) { | ||
}) | ||
``` | ||
option. | ||
To use Flash font enumeration, make sure you have swfobject available. | ||
If you don't, the library will skip the Flash part entirely. | ||
### `fonts.swfContainerId` | ||
Specifies the dom element ID to be used for swf embedding (flash fonts) | ||
#### `detectScreenOrientation` option is `true` by default | ||
### `fonts.swfPath` | ||
Specifies the path to the FontList.swf (flash fonts) | ||
To ensure consistent fingerprints when users rotate their mobile | ||
devices. | ||
### `screen.detectScreenOrientation` (default: true) | ||
### `plugins.sortPluginsFor` (default: `[/palemoon/i]`) | ||
##### All fingerprinting sources are enabled by default, i.e. you don't need to explicitly configure the library to include them. | ||
Some browsers randomise plugin order. You can give a list of user agent regexes for which plugins should be sorted. | ||
```js | ||
new Fingerprint2().get(function(result, components) { | ||
// this will use all available fingerprinting sources | ||
console.log(result) | ||
// components is an array of all fingerprinting components used | ||
console.log(components) | ||
}) | ||
``` | ||
### `plugins.excludeIE` | ||
Skip IE plugin enumeration/detection | ||
#### `userDefinedFonts` option | ||
### `audio.excludeIOS11` (default: true) | ||
While hundreds of the most popular fonts are included in the extended font list, you may wish to increase the entropy of the font fingerprint by specifying the `userDefinedFonts` option as an array of font names, **but make sure to call the Fingerprint function after the page load, and not before**, otherwise font detection might not work properly and in a result returned hash might be different every time you reloaded the page. | ||
iOS 11 prevents audio fingerprinting unless started from a user interaction (screen tap), preventing the fingerprinting process from finishing. If you're sure you start fingerprinting from a user interaction event handler, you may enable audio fingerprinting on iOS 11. | ||
```js | ||
new Fingerprint2({ | ||
userDefinedFonts: ["Nimbus Mono", "Junicode", "Presto"] | ||
}).get(function(result, components) { | ||
console.log(result) | ||
}) | ||
### `audio.timeout` default 1000 | ||
maximum time allowed for 'audio' component | ||
### `fontsFlash` | ||
To use Flash font enumeration, make sure you have swfobject available. If you don't, the library will skip the Flash part entirely. | ||
### `extraComponents` | ||
Arrays of extra components to include. | ||
``` | ||
var options = { | ||
extraComponents : [ | ||
{key: 'customKey', getData: function (done, options) { | ||
done('infos ...') | ||
} | ||
] | ||
} | ||
``` | ||
#### `preprocessor` option | ||
### `preprocessor` | ||
Function that is called with each component value that may be used to modify component values before computing the fingerprint. | ||
For example: strip browser version from user agent. | ||
Function that is called with each component value that may be used to modify component values before computing the fingerprint. For example: strip browser version from user agent. | ||
```js | ||
new Fingerprint2({ | ||
Fingerprint2.get({ | ||
preprocessor: function(key, value) { | ||
@@ -118,79 +126,170 @@ if (key == "user_agent") { | ||
return userAgentMinusVersion | ||
} else { | ||
return value | ||
} | ||
return value | ||
} | ||
}).get(function(result, components) { | ||
},function(components) { | ||
// user_agent component will contain string processed with our function. For example: Windows Chrome | ||
console.log(result, components) | ||
}); | ||
``` | ||
#### View the fingerprint locally | ||
### `excludes` | ||
You can view your browser fingerprint locally by starting a webserver and viewing the `index.html` page. | ||
Loading `index.html` from the filesystem won't work due to Flash's ExternalInterface security restrictions. | ||
An object of with components keys to exclude. Empty object to include everything. By default most of the components are included (please see the source code for details). | ||
To start a web server you can try using one of the following: | ||
``` | ||
var options = { | ||
excludes: {userAgent: true, language: true} | ||
} | ||
``` | ||
* Ruby 1.9.2+ | ||
To see a list of possible excludes, please see the source code (look for `var components = [`). | ||
`ruby -run -e httpd . -p 8080` | ||
### Constants | ||
* Python 2.x | ||
The constants used for unavailable, error'd, or excluded components' values. | ||
`python -m SimpleHTTPServer 8080` | ||
```js | ||
var options = { | ||
NOT_AVAILABLE: 'not available', | ||
ERROR: 'error', | ||
EXCLUDED: 'excluded', | ||
} | ||
``` | ||
* Python 3.x | ||
- `NOT_AVAILABLE`: Component value if the browser doesn't support the API the component uses (e.g. `enumerateDevices`) or the browser doesn't provide a useful value (e.g. `deviceMemory`). | ||
- `ERROR`: The component function threw an error. | ||
- `EXCLUDED`: The component was excluded. | ||
`python -m http.server 8080` | ||
* PHP 5.4+ | ||
## Upgrade guide from 1.8.2 to 2.0.0 | ||
`php -S 0.0.0.0:8080` | ||
### Backwards compatibility mode | ||
Fingerprintjs2 v2.0 provides a v1.8 compatibility wrapper that keeps user's fingerprints identical to the ones generated with v1.8. Note that we will drop this wrapper at some point. | ||
### List of fingerprinting sources | ||
Note that the `options` parameter **must be provided in v2.0 syntax**. | ||
1. UserAgent | ||
2. Language | ||
3. Color Depth | ||
4. Screen Resolution | ||
5. Timezone | ||
6. Has session storage or not | ||
7. Has local storage or not | ||
8. Has indexed DB | ||
9. Has IE specific 'AddBehavior' | ||
10. Has open DB | ||
11. CPU class | ||
12. Platform | ||
13. DoNotTrack or not | ||
14. Full list of installed fonts (maintaining their order, which increases the entropy), implemented with Flash. | ||
15. A list of installed fonts, detected with JS/CSS (side-channel technique) - can detect up to 500 installed fonts without flash | ||
16. Canvas fingerprinting | ||
17. WebGL fingerprinting | ||
18. Plugins (IE included) | ||
19. Is AdBlock installed or not | ||
20. Has the user tampered with its languages <sup>[1](https://github.com/Valve/fingerprintjs2/wiki/Browser-tampering)</sup> | ||
21. Has the user tampered with its screen resolution <sup>[1](https://github.com/Valve/fingerprintjs2/wiki/Browser-tampering)</sup> | ||
22. Has the user tampered with its OS <sup>[1](https://github.com/Valve/fingerprintjs2/wiki/Browser-tampering)</sup> | ||
23. Has the user tampered with its browser <sup>[1](https://github.com/Valve/fingerprintjs2/wiki/Browser-tampering)</sup> | ||
24. Touch screen detection and capabilities | ||
25. Pixel Ratio | ||
26. System's total number of logical processors available to the user agent. | ||
27. [Device memory](https://w3c.github.io/device-memory/) | ||
28. Audio fingerprinting | ||
```js | ||
// options must be provided in v2.0 syntax | ||
Fingerprint2.getV18(options, function (result, components) { | ||
// result is murmur hash fingerprint | ||
// components is array of {key: 'foo', value: 'component value'} | ||
}) | ||
``` | ||
### get and getPromise | ||
By default, JS font detection will only detect up to 65 installed fonts. If you want to improve the font detection, | ||
you can pass `extendedJsFonts: true` option. This will increase the number of detectable fonts to ~500. | ||
`Fingerprint2.get` is now a static function. It replaces `new Fingerprint2().get`. It will not hash the result by default anymore. | ||
On my machine (MBP 2013 Core i5) + Chrome 46 the default FP process takes about 80-100ms. If you use `extendedJsFonts` option this time will increase up to 2000ms (cold font cache). | ||
This option can incur even more overhead on mobile Firefox browsers, which is much slower in font detection, so use it with caution on mobile devices. | ||
``` | ||
var options = {} | ||
Fingerprint2.get(options, function (components) { | ||
// components is array of {key: 'foo', value: 'component value'} | ||
... | ||
}) | ||
To speed up fingerprint computation, you can exclude font detection (~ 40ms), canvas fingerprint (~ 10ms), WebGL fingerprint (~ 35 ms), and Audio fingerprint (~30 ms). | ||
// or | ||
### Many more fingerprinting sources will be implemented, such as | ||
(in no particular order) | ||
Fingerprint2.getPromise(options).then(function (components) { | ||
// components is array of {key: 'foo', value: 'component value'} | ||
... | ||
}) | ||
``` | ||
Fingerprint2 ships with the murmur hash function that you may use to create a hash fingerprint: | ||
``` | ||
Fingerprint2.get(options, function (components) { | ||
var values = components.map(function (component) { return component.value }) | ||
var murmur = Fingerprint2.x64hash128(values.join(''), 31) | ||
}) | ||
``` | ||
### Excludes | ||
Before exclusion was done by putting an individual excludes like `excludeTouchSupport: true` in the options. | ||
To exclude a component now, put its key inside the excludes object in options | ||
``` | ||
var options = {excludes: {touchSupport: true}} | ||
``` | ||
### Custom Entropy Function | ||
`options.customEntropyFunction` and `customKey` have been replaced with a extension friendly, stable alternative. The new contract allows for async sources as well. See below for component definition. `options.extraComponents` should contain an array with custom components. | ||
``` | ||
var options = { | ||
extraComponents : [ | ||
{key: 'customKey', getData: function (done, options) { | ||
done('infos ...') | ||
} | ||
] | ||
} | ||
``` | ||
### jsfonts and flashFonts | ||
jsfonts has been renamed into fonts. fontsFlash and fonts are now separate components. `fontsFlash` is excluded by default. | ||
### Consistent names for components | ||
Components keys are now all camelCase. Example `'user_agent'` -> `'userAgent'` | ||
### `Fingerprint2.x64hash128` | ||
Fingerprint2.x64hash128 static function is now exposed | ||
### Error constants are exposed and configurable | ||
``` | ||
Fingerprint2.NOT_AVAILABLE = 'not available' | ||
Fingerprint2.ERROR = 'error' | ||
Fingerprint2.EXCLUDED = 'excluded' | ||
``` | ||
### audioTimeout | ||
audioTimeout is an option, default 1000ms | ||
## Development | ||
### Component | ||
A components is an object with at least key and getData keys, example: | ||
``` | ||
{key: 'user_agent', getData: UserAgent, pauseBefore: false} | ||
``` | ||
getData value is the components function. | ||
### Component function | ||
A components function takes done as first argument, and options as an optional second argument. | ||
It must call done exactly once with a value that can be cast to a String. | ||
It must wrap all unreachable code (setTimeout, requestAnimationFrame, etc) in its own try catch, | ||
it should use catch as an opportunity to give a unique value to `done` | ||
``` | ||
function (done, options) { | ||
done(navigator.userAgent) | ||
} | ||
``` | ||
### Tests | ||
Unit tests are in `specs/specs.js` | ||
`npm test` to launch the tests, it requires phanomjs install | ||
To run the tests in the browser, launch `spec_runner.html` | ||
## Other | ||
### Future development | ||
Many more fingerprinting sources will be implemented, such as (in no particular order) | ||
* Multi-monitor detection, | ||
@@ -208,5 +307,4 @@ * Internal HashTable implementation detection | ||
* Video and audio codecs availability | ||
* Audio stack fingerprinting | ||
#### To recompile the `FontList.swf` file: | ||
### To recompile the `FontList.swf` file: | ||
@@ -217,3 +315,3 @@ * Download [Adobe Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html) | ||
#### My talk about the library (in Russian) on FrontEnd Conf 2015 | ||
### Talk about the library (in Russian) on FrontEnd Conf 2015 | ||
@@ -223,1 +321,2 @@ https://player.vimeo.com/video/151208427 | ||
#### License: MIT or Apache, whichever you prefer. | ||
[npm-link]: https://www.npmjs.com/package/fingerprintjs2 |
@@ -1,5 +0,5 @@ | ||
/* global jasmine, describe, spyOn, it, expect, Fingerprint2 */ | ||
/* global jasmine, describe, it, xit , expect, Fingerprint2 */ | ||
'use strict' | ||
function getComponent(components, key) { | ||
function getComponent (components, key) { | ||
for (var x = 0; x < components.length; x++) { | ||
@@ -13,49 +13,41 @@ if (components[x].key === key) { | ||
var onPhantomJs = window._phantom != null | ||
describe('Fingerprint2', function () { | ||
describe('new', function () { | ||
it('creates a new instance of FP2', function () { | ||
expect(new Fingerprint2()).not.toBeNull() | ||
describe('FP2', function () { | ||
it('.get should be available', function () { | ||
expect(Fingerprint2.get).toBeDefined() | ||
}) | ||
it('accepts an empty options object', function () { | ||
expect(new Fingerprint2({})).not.toBeNull() | ||
it('.getPromise should be available', function () { | ||
expect(Fingerprint2.getPromise).toBeDefined() | ||
}) | ||
it('uses default options', function () { | ||
var fp2 = new Fingerprint2() | ||
expect(fp2.options.swfContainerId).toEqual('fingerprintjs2') | ||
expect(fp2.options.swfPath).toEqual('flash/compiled/FontList.swf') | ||
expect(fp2.options.userDefinedFonts).toEqual([]) | ||
it('.get accepts an empty options object', function (done) { | ||
Fingerprint2.get({}, function (result) { | ||
expect(result).not.toBeNull() | ||
done() | ||
}) | ||
}) | ||
it('allows to override default options', function () { | ||
var fp2 = new Fingerprint2({swfPath: 'newpath', userDefinedFonts: ['Ethos', 'Quenda']}) | ||
expect(fp2.options.swfContainerId).toEqual('fingerprintjs2') | ||
expect(fp2.options.swfPath).toEqual('newpath') | ||
expect(fp2.options.userDefinedFonts).toEqual(['Ethos', 'Quenda']) | ||
it('.get works when omitting options object', function (done) { | ||
Fingerprint2.get(function (result) { | ||
expect(result).not.toBeNull() | ||
done() | ||
}) | ||
}) | ||
}) | ||
it('allows to add new options', function () { | ||
var fp2 = new Fingerprint2({excludeUserAgent: true}) | ||
expect(fp2.options.swfContainerId).toEqual('fingerprintjs2') | ||
expect(fp2.options.swfPath).toEqual('flash/compiled/FontList.swf') | ||
expect(fp2.options.excludeUserAgent).toBe(true) | ||
// legacy usage | ||
describe('new', function () { | ||
it('throws an error', function () { | ||
// eslint-disable-next-line | ||
expect(function () { new Fingerprint2() }).toThrow() | ||
}) | ||
describe('sortPluginsFor', function () { | ||
it('has default value', function () { | ||
var fp2 = new Fingerprint2() | ||
expect(fp2.options.sortPluginsFor).toEqual([/palemoon/i]) | ||
}) | ||
it('allows to set new array of regexes', function () { | ||
var fp2 = new Fingerprint2({sortPluginsFor: [/firefox/i, /chrome/i]}) | ||
expect(fp2.options.sortPluginsFor).toEqual([/firefox/i, /chrome/i]) | ||
}) | ||
}) | ||
}) | ||
// legacy | ||
describe('without new keyword', function () { | ||
it('creates a new instance of FP2', function () { | ||
expect(Fingerprint2()).not.toBeNull() | ||
it('throws an error', function () { | ||
expect(function () { Fingerprint2() }).toThrow() | ||
}) | ||
@@ -66,5 +58,5 @@ }) | ||
describe('default options', function () { | ||
it('calculates fingerprint', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result) { | ||
// legacy | ||
it('calculates fingerprint hash', function (done) { | ||
Fingerprint2.getV18(function (result) { | ||
expect(result).toMatch(/^[0-9a-f]{32}$/i) | ||
@@ -76,6 +68,7 @@ done() | ||
it('does not try calling flash font detection', function (done) { | ||
var fp2 = new Fingerprint2() | ||
spyOn(fp2, 'flashFontsKey') | ||
fp2.get(function (result) { | ||
expect(fp2.flashFontsKey).not.toHaveBeenCalled() | ||
var flashFontKey = 'fontsFlash' | ||
Fingerprint2.get(function (components) { | ||
expect(components.some(function (componentResult) { | ||
return componentResult.key === flashFontKey | ||
})).toBeFalse() | ||
done() | ||
@@ -86,65 +79,37 @@ }) | ||
describe('non-default options', function () { | ||
it('does not use userAgent when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludeUserAgent: true}) | ||
spyOn(fp2, 'getUserAgent') | ||
fp2.get(function (result) { | ||
expect(fp2.getUserAgent).not.toHaveBeenCalled() | ||
done() | ||
describe('excludes work:', function () { | ||
[ | ||
'userAgent', | ||
'pixelRatio', | ||
'deviceMemory', | ||
'screenResolution', | ||
'availableScreenResolution', | ||
'plugins', | ||
'timezone' | ||
].forEach(function (key) { | ||
it('does not use ' + key + ' when excluded', function (done) { | ||
var options = {excludes: {}} | ||
options.excludes[key] = true | ||
Fingerprint2.get(options, function (components) { | ||
expect(components.some(function (componentResult) { | ||
return componentResult.key === key | ||
})).toBeFalse() | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
it('does not use pixelRatio when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludePixelRatio: true}) | ||
spyOn(fp2, 'getPixelRatio') | ||
fp2.get(function (result) { | ||
expect(fp2.getPixelRatio).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
// navigator.appName is read only | ||
xit('does not use IE plugins info when excluded', function (done) { | ||
var previous = navigator.appName | ||
navigator.appName = 'Microsoft Internet Explorer' | ||
var key = 'plugins' | ||
Fingerprint2.get({plugins: {excludeIE: true}}, function (components) { | ||
expect(components.some(function (componentResult) { | ||
return componentResult.key === key | ||
})).toBeFalse() | ||
navigator.appName = previous | ||
done() | ||
}) | ||
it('does not use deviceMemory when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludeDeviceMemory: true}) | ||
spyOn(fp2, 'getDeviceMemory') | ||
fp2.get(function (result) { | ||
expect(fp2.getDeviceMemory).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
}) | ||
it('does not use screen resolution when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludeScreenResolution: true}) | ||
spyOn(fp2, 'getScreenResolution') | ||
fp2.get(function (result) { | ||
expect(fp2.getScreenResolution).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
}) | ||
it('does not use available screen resolution when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludeAvailableScreenResolution: true}) | ||
spyOn(fp2, 'getAvailableScreenResolution') | ||
fp2.get(function (result) { | ||
expect(fp2.getAvailableScreenResolution).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
}) | ||
it('does not use plugins info when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludePlugins: true}) | ||
spyOn(fp2, 'getRegularPlugins') | ||
fp2.get(function (result) { | ||
expect(fp2.getRegularPlugins).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
}) | ||
it('does not use IE plugins info when excluded', function (done) { | ||
var fp2 = new Fingerprint2({excludeIEPlugins: true}) | ||
spyOn(fp2, 'getIEPlugins') | ||
fp2.get(function (result) { | ||
expect(fp2.getIEPlugins).not.toHaveBeenCalled() | ||
done() | ||
}) | ||
}) | ||
}) | ||
@@ -154,4 +119,3 @@ | ||
it('does it return components as a second argument to callback', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
Fingerprint2.get(function (components) { | ||
expect(components).not.toBeNull() | ||
@@ -163,4 +127,3 @@ done() | ||
it('checks if returned components is array', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
Fingerprint2.get(function (components) { | ||
expect(components).toBeArrayOfObjects() | ||
@@ -171,5 +134,5 @@ done() | ||
it('checks if js_fonts component is array', function (done) { | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'js_fonts')).toBeArray() | ||
it('checks if fonts component is array', function (done) { | ||
Fingerprint2.get(function (components) { | ||
expect(getComponent(components, 'fonts')).toBeArray() | ||
done() | ||
@@ -179,6 +142,5 @@ }) | ||
it('returns user_agent as the first element', function (done) { | ||
var fp2 = new Fingerprint2() | ||
fp2.get(function (result, components) { | ||
expect(components[0].key).toEqual('user_agent') | ||
it('returns userAgent as the first element', function (done) { | ||
Fingerprint2.get(function (components) { | ||
expect(components[0].key).toEqual('userAgent') | ||
done() | ||
@@ -203,4 +165,4 @@ }) | ||
Array.prototype.bar = 2 | ||
ctr = 0 | ||
for (var y in baseFonts) { | ||
// eslint-disable-next-line | ||
ctr = 0; for (var _ in baseFonts) { | ||
ctr++ | ||
@@ -258,12 +220,13 @@ // Now foo & bar is a part of EVERY array and | ||
}) | ||
describe('customFunction option', function () { | ||
it('concatinates the current keys with the customFunction output', function (done) { | ||
function customFunction () { | ||
return 'RANDOM_STRING' | ||
describe('extraComponents option', function () { | ||
it('uses extraComponents', function (done) { | ||
function customFunction (done) { | ||
done('RANDOM_STRING') | ||
} | ||
var spy = jasmine.createSpy('customFunction', customFunction).and.callThrough() | ||
var fp = new Fingerprint2({ | ||
'customFunction': spy | ||
}) | ||
fp.get(function (result, keys) { | ||
Fingerprint2.get({ | ||
extraComponents: [{key: 'customFunction', getData: spy}] | ||
}, function (keys) { | ||
expect(spy).toHaveBeenCalled() | ||
@@ -273,74 +236,157 @@ done() | ||
}) | ||
}) | ||
describe('audio fingerprint', function () { | ||
it('checks audio fingerprint', function (done) { | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'audio_fp')).not.toBeNull() | ||
it('its key is used', function (done) { | ||
var options = { | ||
extraComponents: [ | ||
{ | ||
key: 'TEST_STRING', | ||
getData: function customFunction (done) { | ||
done('RANDOM_STRING') | ||
} | ||
} | ||
] | ||
} | ||
Fingerprint2.get(options, function (components) { | ||
expect(getComponent(components, 'TEST_STRING')).toEqual('RANDOM_STRING') | ||
done() | ||
}) | ||
}) | ||
it('safely introduce a new component even if it throws', function (done) { | ||
var options = { | ||
extraComponents: [ | ||
{ | ||
key: 'my key', | ||
getData: function customFunction (done) { | ||
throw new Error('unstable component') | ||
} | ||
} | ||
] | ||
} | ||
Fingerprint2.get(options, function (components) { | ||
// if we arrive here, it means the rest of the fingerprint was not disturbed | ||
expect(components).toBeDefined() | ||
done() | ||
}) | ||
}) | ||
}) | ||
describe('error constants', function () { | ||
it('are configurable', function (done) { | ||
var NA = 'NA' | ||
var options = { | ||
NOT_AVAILABLE: NA, | ||
extraComponents: [ | ||
{ | ||
key: 'my key', | ||
getData: function customFunction (done, options2) { | ||
done(options2.NOT_AVAILABLE) | ||
} | ||
} | ||
] | ||
} | ||
Fingerprint2.get(options, function (components) { | ||
expect(components).toBeDefined() | ||
expect(getComponent(components, 'my key')).toEqual(NA) | ||
done() | ||
}) | ||
}) | ||
}) | ||
describe('webgl shader precision format', function () { | ||
it('checks webgl shader precision format loop', function (done) { | ||
if (!onPhantomJs) { | ||
describe('enumerate devices fingerprint', function () { | ||
it('checks enumerate devices fingerprint', function (done) { | ||
var options = {excludes: {}} | ||
Fingerprint2.get(options, function (components) { | ||
if (navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) { | ||
expect(getComponent(components, 'enumerateDevices')).not.toBeNull() | ||
} | ||
done() | ||
}) | ||
}) | ||
}) | ||
} | ||
var fp2 = new Fingerprint2() | ||
var gl = fp2.getWebglCanvas(); | ||
var item = function (name, descr, attr1, attr2, attr3) { | ||
var fmt = gl.getShaderPrecisionFormat(attr1, attr2)[attr3] | ||
return ['webgl ', name, ' shader ', descr, ':', fmt].join('') | ||
} | ||
var webglExpectedArray = [ | ||
item('vertex' , 'high float precision' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'precision'), | ||
item('vertex' , 'high float precision rangeMin' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'rangeMin'), | ||
item('vertex' , 'high float precision rangeMax' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'rangeMax'), | ||
item('vertex' , 'medium float precision' , gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'precision'), | ||
item('vertex' , 'medium float precision rangeMin', gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'rangeMin'), | ||
item('vertex' , 'medium float precision rangeMax', gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'rangeMax'), | ||
item('vertex' , 'low float precision' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'precision'), | ||
item('vertex' , 'low float precision rangeMin' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'rangeMin'), | ||
item('vertex' , 'low float precision rangeMax' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'rangeMax'), | ||
item('vertex' , 'high int precision' , gl.VERTEX_SHADER , gl.HIGH_INT , 'precision'), | ||
item('vertex' , 'high int precision rangeMin' , gl.VERTEX_SHADER , gl.HIGH_INT , 'rangeMin'), | ||
item('vertex' , 'high int precision rangeMax' , gl.VERTEX_SHADER , gl.HIGH_INT , 'rangeMax'), | ||
item('vertex' , 'medium int precision' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'precision'), | ||
item('vertex' , 'medium int precision rangeMin' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'rangeMin'), | ||
item('vertex' , 'medium int precision rangeMax' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'rangeMax'), | ||
item('vertex' , 'low int precision' , gl.VERTEX_SHADER , gl.LOW_INT , 'precision'), | ||
item('vertex' , 'low int precision rangeMin' , gl.VERTEX_SHADER , gl.LOW_INT , 'rangeMin'), | ||
item('vertex' , 'low int precision rangeMax' , gl.VERTEX_SHADER , gl.LOW_INT , 'rangeMax'), | ||
item('fragment', 'high float precision' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'precision'), | ||
item('fragment', 'high float precision rangeMin' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'rangeMin'), | ||
item('fragment', 'high float precision rangeMax' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'rangeMax'), | ||
item('fragment', 'medium float precision' , gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'precision'), | ||
item('fragment', 'medium float precision rangeMin', gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'rangeMin'), | ||
item('fragment', 'medium float precision rangeMax', gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'rangeMax'), | ||
item('fragment', 'low float precision' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'precision'), | ||
item('fragment', 'low float precision rangeMin' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'rangeMin'), | ||
item('fragment', 'low float precision rangeMax' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'rangeMax'), | ||
item('fragment', 'high int precision' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'precision'), | ||
item('fragment', 'high int precision rangeMin' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'rangeMin'), | ||
item('fragment', 'high int precision rangeMax' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'rangeMax'), | ||
item('fragment', 'medium int precision' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'precision'), | ||
item('fragment', 'medium int precision rangeMin' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'rangeMin'), | ||
item('fragment', 'medium int precision rangeMax' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'rangeMax'), | ||
item('fragment', 'low int precision' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'precision'), | ||
item('fragment', 'low int precision rangeMin' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'rangeMin'), | ||
item('fragment', 'low int precision rangeMax' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'rangeMax'), | ||
] | ||
if (!onPhantomJs) { | ||
describe('audio fingerprint', function () { | ||
it('checks audio fingerprint', function (done) { | ||
Fingerprint2.get(function (components) { | ||
expect(getComponent(components, 'audio')).not.toBeNull() | ||
done() | ||
}) | ||
}) | ||
}) | ||
} | ||
fp2.get(function (_, components) { | ||
fp2.each(webglExpectedArray, function (item) { | ||
expect(getComponent(components, 'webgl').indexOf(item)).not.toEqual(-1) | ||
if (!onPhantomJs) { | ||
describe('webgl shader precision format', function () { | ||
// fp2.getWebglCanvas() not exposed | ||
it('checks webgl shader precision format loop', function (done) { | ||
Fingerprint2.get(function (components) { | ||
getComponent(components, 'webgl') | ||
}) | ||
done() | ||
var canvas = document.createElement('canvas') | ||
var gl = null | ||
try { | ||
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl') | ||
} catch (e) { /* squelch */ } | ||
if (gl == null) { | ||
done() | ||
} | ||
var item = function (name, descr, attr1, attr2, attr3) { | ||
var fmt = gl.getShaderPrecisionFormat(attr1, attr2)[attr3] | ||
return ['webgl ', name, ' shader ', descr, ':', fmt].join('') | ||
} | ||
var webglExpectedArray = [ /* eslint-disable */ | ||
item('vertex' , 'high float precision' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'precision'), | ||
item('vertex' , 'high float precision rangeMin' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'rangeMin'), | ||
item('vertex' , 'high float precision rangeMax' , gl.VERTEX_SHADER , gl.HIGH_FLOAT , 'rangeMax'), | ||
item('vertex' , 'medium float precision' , gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'precision'), | ||
item('vertex' , 'medium float precision rangeMin', gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'rangeMin'), | ||
item('vertex' , 'medium float precision rangeMax', gl.VERTEX_SHADER , gl.MEDIUM_FLOAT, 'rangeMax'), | ||
item('vertex' , 'low float precision' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'precision'), | ||
item('vertex' , 'low float precision rangeMin' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'rangeMin'), | ||
item('vertex' , 'low float precision rangeMax' , gl.VERTEX_SHADER , gl.LOW_FLOAT , 'rangeMax'), | ||
item('vertex' , 'high int precision' , gl.VERTEX_SHADER , gl.HIGH_INT , 'precision'), | ||
item('vertex' , 'high int precision rangeMin' , gl.VERTEX_SHADER , gl.HIGH_INT , 'rangeMin'), | ||
item('vertex' , 'high int precision rangeMax' , gl.VERTEX_SHADER , gl.HIGH_INT , 'rangeMax'), | ||
item('vertex' , 'medium int precision' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'precision'), | ||
item('vertex' , 'medium int precision rangeMin' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'rangeMin'), | ||
item('vertex' , 'medium int precision rangeMax' , gl.VERTEX_SHADER , gl.MEDIUM_INT , 'rangeMax'), | ||
item('vertex' , 'low int precision' , gl.VERTEX_SHADER , gl.LOW_INT , 'precision'), | ||
item('vertex' , 'low int precision rangeMin' , gl.VERTEX_SHADER , gl.LOW_INT , 'rangeMin'), | ||
item('vertex' , 'low int precision rangeMax' , gl.VERTEX_SHADER , gl.LOW_INT , 'rangeMax'), | ||
item('fragment', 'high float precision' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'precision'), | ||
item('fragment', 'high float precision rangeMin' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'rangeMin'), | ||
item('fragment', 'high float precision rangeMax' , gl.FRAGMENT_SHADER, gl.HIGH_FLOAT , 'rangeMax'), | ||
item('fragment', 'medium float precision' , gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'precision'), | ||
item('fragment', 'medium float precision rangeMin', gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'rangeMin'), | ||
item('fragment', 'medium float precision rangeMax', gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT, 'rangeMax'), | ||
item('fragment', 'low float precision' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'precision'), | ||
item('fragment', 'low float precision rangeMin' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'rangeMin'), | ||
item('fragment', 'low float precision rangeMax' , gl.FRAGMENT_SHADER, gl.LOW_FLOAT , 'rangeMax'), | ||
item('fragment', 'high int precision' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'precision'), | ||
item('fragment', 'high int precision rangeMin' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'rangeMin'), | ||
item('fragment', 'high int precision rangeMax' , gl.FRAGMENT_SHADER, gl.HIGH_INT , 'rangeMax'), | ||
item('fragment', 'medium int precision' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'precision'), | ||
item('fragment', 'medium int precision rangeMin' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'rangeMin'), | ||
item('fragment', 'medium int precision rangeMax' , gl.FRAGMENT_SHADER, gl.MEDIUM_INT , 'rangeMax'), | ||
item('fragment', 'low int precision' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'precision'), | ||
item('fragment', 'low int precision rangeMin' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'rangeMin'), | ||
item('fragment', 'low int precision rangeMax' , gl.FRAGMENT_SHADER, gl.LOW_INT , 'rangeMax'), | ||
] | ||
Fingerprint2.get(function (components) { | ||
webglExpectedArray.forEach(function (item) { | ||
expect(getComponent(components, 'webgl').indexOf(item)).not.toEqual(-1) | ||
}) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
} | ||
describe('preprocessor', function () { | ||
it('checks that preprocessor not used by default', function (done) { | ||
(new Fingerprint2()).get(function (_, components) { | ||
expect(getComponent(components, 'user_agent')).not.toEqual('MyUserAgent') | ||
Fingerprint2.get(function (components) { | ||
expect(getComponent(components, 'userAgent')).not.toEqual('MyUserAgent') | ||
done() | ||
@@ -351,6 +397,7 @@ }) | ||
it('checks that preprocessor function applied to component value', function (done) { | ||
var mykey = 'userAgent' | ||
var options = { | ||
preprocessor: function (key, value) { | ||
if (key === 'user_agent') { | ||
value = 'MyUserAgent' | ||
if (key === mykey) { | ||
return 'MyUserAgent' | ||
} | ||
@@ -360,4 +407,4 @@ return value | ||
} | ||
(new Fingerprint2(options)).get(function (_, components) { | ||
expect(getComponent(components, 'user_agent')).toEqual('MyUserAgent') | ||
Fingerprint2.get(options, function (components) { | ||
expect(getComponent(components, mykey)).toEqual('MyUserAgent') | ||
done() | ||
@@ -368,3 +415,22 @@ }) | ||
if (!onPhantomJs) { | ||
describe('extra', function () { | ||
//https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/navigator/NavigatorPlugins-impl.js | ||
it('should no throw in jsdom like environment', function (done) { | ||
// direct assignment does not work | ||
Object.defineProperty(navigator, "plugins", { | ||
value: { | ||
javaEnabled: function () { | ||
return false | ||
} | ||
} | ||
}) | ||
Fingerprint2.get(function (components) { | ||
expect(getComponent(components, 'plugins')).toBeDefined() | ||
done() | ||
}) | ||
}) | ||
}) | ||
} | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6909
316
324562
6
27