2018-04-23 09:52:52 +02:00
|
|
|
(function(a,c,b){if(typeof window.define==="function"&&window.define.amd){window.define(b)}else{if(typeof module!=="undefined"&&module.exports){module.exports=b()}else{if(c.exports){c.exports=b()}else{c[a]=b()}}}})("Fingerprint2",this,function(){var Fingerprint2=function(options){if(!(this instanceof Fingerprint2)){return new Fingerprint2(options)}var defaultOptions={swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:true,sortPluginsFor:[/palemoon/i],userDefinedFonts:[],excludeDoNotTrack:true,excludePixelRatio:true};this.options=this.extend(options,defaultOptions);this.nativeForEach=Array.prototype.forEach;this.nativeMap=Array.prototype.map};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]}}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})}};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(newKeys){var values=[];that.each(newKeys.data,function(pair){var value=pair.value;if(value&&typeof value.join==="function"){value=value.join(";")}values.push(value)});var murmur=that.x64hash128(values.join("~~~"),31);return done(murmur,newKeys.data)})},customEntropyFunction:function(keys){if(typeof this.options.customFunction==="function"){keys.addPreprocessedComponent({key:"custom",value:this.options.customFunction()})}return keys},userAgentKey:function(keys){if(!this.options.excludeUserAgent){keys.addPreprocessedComponent({key:"user_agent",value:this.getUserAgent()})}return keys},getUserAgent:function(){return navigator.userAgent},languageKey:function(keys){if(!this.options.excludeLanguage){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},availableScreenResoluti
|