1 line
39 KiB
JavaScript
1 line
39 KiB
JavaScript
![]() |
(function(a,c,b){if(typeof define==="function"&&define.amd){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(){if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement,fromIndex){var k;if(this==null){throw new TypeError("'this' is null or undefined")}var O=Object(this);var len=O.length>>>0;if(len===0){return -1}var n=+fromIndex||0;if(Math.abs(n)===Infinity){n=0}if(n>=len){return -1}k=Math.max(n>=0?n:len-Math.abs(n),0);while(k<len){if(k in O&&O[k]===searchElement){return k}k++}return -1}}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:[]};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},log:function(msg){if(window.console){console.log(msg)}},get:function(done){var keys=[];keys=this.userAgentKey(keys);keys=this.languageKey(keys);keys=this.colorDepthKey(keys);keys=this.pixelRatioKey(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.adBlockKey(keys);keys=this.hasLiedLanguagesKey(keys);keys=this.hasLiedResolutionKey(keys);keys=this.hasLiedOsKey(keys);keys=this.hasLiedBrowserKey(keys);keys=this.touchSupportKey(keys);var that=this;this.fontsKey(keys,function(newKeys){var values=[];that.each(newKeys,function(pair){var value=pair.value;if(typeof pair.value.join!=="undefined"){value=pair.value.join(";")}values.push(value)});var murmur=that.x64hash128(values.join("~~~"),31);return done(murmur,newKeys)})},userAgentKey:function(keys){if(!this.options.excludeUserAgent){keys.push({key:"user_agent",value:this.getUserAgent()})}return keys},getUserAgent:function(){return navigator.userAgent},languageKey:function(keys){if(!this.options.excludeLanguage){keys.push({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""})}return keys},colorDepthKey:function(keys){if(!this.options.excludeColorDepth){keys.push({key:"color_depth",value:screen.colorDepth||-1})}return keys},pixelRatioKey:function(keys){if(!this.options.excludePixelRatio){keys.push({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=(screen.height>screen.width)?[screen.height,screen.width]:[screen.width,screen.height]}else{resolution=[screen.width,screen.height]}if(typeof resolution!=="undefined"){keys.push({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(screen.availWidth&&screen.availHeight){if(this.options.detectScreenOrientation){available=(screen.availHeight>screen.availWidth)?[screen.availHeight,screen.availWidth]:[screen.availWidth,screen.availHeight]}else{available=[screen.availHeight,screen.availWidth]}}if(typeof available!=="undefined"){keys.push({key:"available_resolution",value:available})}retur
|