Created
August 16, 2019 14:36
-
-
Save chelovekula/b117c3dba6b6986ddfc5269ed9407431 to your computer and use it in GitHub Desktop.
data-collect.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function newFingerprint() { | |
showLoadingOverlay(); | |
window.fpStepCommonComplete = false; | |
window.fpStepAudio = { | |
pxi_output : false, | |
pxi_full_buffer_hash : false, | |
nt_vc_output : false, | |
cc_output : false, | |
hybrid_output : false | |
}; | |
window.fpStepPngEtagComplete = false; | |
if(window.fpStepForceSendTimeout) { | |
clearTimeout(window.fpStepForceSendTimeout); | |
} | |
window.fpStepForceSendTimeout = setTimeout(function() { | |
fpStepComplete(true); | |
}, 500); | |
window.fpSent = false; | |
window.fp2 = {}; | |
window.fp2obj = new Fingerprint2({extendedJsFonts: true}); | |
var d1 = new Date(); | |
window.fp2obj.get(function(result, components) { | |
var d2 = new Date(); | |
var timeString = "Time took to calculate the fingerprint: " + (d2 - d1) + "ms"; | |
//var details = "<strong>Detailed information: </strong><br />"; | |
//if(typeof window.console !== "undefined") { | |
//console.log(timeString); | |
//console.log(result); | |
for (var index in components) { | |
var obj = components[index]; | |
var value = obj.value; | |
//var line = obj.key + " = " + value.toString().substr(0, 100); | |
var line = obj.key + " = " + value.toString(); | |
window.fp2[obj.key] = value; | |
//console.log(line); | |
//details += line + "<br />"; | |
} | |
//} | |
//$("#details").html(details); | |
//$("#fp").text(result); | |
//$("#time").text(timeString); | |
//fpFinish(fp2, fp2obj); | |
window.fpStepCommonComplete = true; | |
fpStepComplete(); | |
}); | |
audioFingerprint(); // start delay doesn't matter | |
getPngEtag(); | |
} | |
function fpFinish(fp2, fp2obj) { | |
var fp = {}; | |
var fp_html = ''; | |
if("undefined" == typeof fp2obj || "undefined" == typeof fp2obj.x64hash128) { | |
fp2obj = {}; | |
fp2obj.x64hash128 = function(s) { | |
return 'hash calculation error'; | |
} | |
} | |
fp.nav_userAgent = ("undefined" != typeof navigator.userAgent ? navigator.userAgent : ""); | |
fp.nav_appName = ("undefined" != typeof navigator.appName ? navigator.appName : ""); | |
fp.nav_appCodeName = ("undefined" != typeof navigator.appCodeName ? navigator.appCodeName : ""); | |
fp.nav_appVersion = ("undefined" != typeof navigator.appVersion ? navigator.appVersion : ""); | |
fp.nav_appMinorVersion = ("undefined" != typeof navigator.appMinorVersion ? navigator.appMinorVersion : ""); | |
fp.nav_buildID = ("undefined" != typeof navigator.buildID ? navigator.buildID : ""); | |
fp.nav_buildid = ("undefined" != typeof navigator.buildid ? navigator.buildid : ""); | |
fp.nav_cpuClass = ("undefined" != typeof navigator.cpuClass ? navigator.cpuClass : ""); | |
fp.nav_oscpu = ("undefined" != typeof navigator.oscpu ? navigator.oscpu : ""); | |
fp.nav_platform = ("undefined" != typeof navigator.platform ? navigator.platform : ""); | |
fp.nav_product = ("undefined" != typeof navigator.product ? navigator.product : ""); | |
fp.nav_productsub = ("undefined" != typeof navigator.productSub ? navigator.productSub : ""); | |
fp.nav_vendor = ("undefined" != typeof navigator.vendor ? navigator.vendor : ""); | |
fp.nav_vendorsub = ("undefined" != typeof navigator.vendorSub ? navigator.vendorSub : ""); | |
fp.nav_hardwareConcurrency = ("undefined" != typeof navigator.hardwareConcurrency ? navigator.hardwareConcurrency : ""); | |
fp.nav_window_screen_orientation_div_clientWidth = ("undefined" != typeof viewport.offsetWidth ? viewport.offsetWidth : "") | |
fp.nav_window_screen_orientation_div_clientHeight = ("undefined" != typeof viewport.offsetHeight ? viewport.offsetHeight : "") | |
fp.nav_deviceMemory = ("undefined" != typeof navigator.deviceMemory ? navigator.deviceMemory : ""); | |
fp.nav_window_screen_width = ("undefined" != typeof window.screen.width ? window.screen.width : ""); | |
fp.nav_window_screen_height = ("undefined" != typeof window.screen.height ? window.screen.height : ""); | |
fp.nav_window_screen_availWidth = ("undefined" != typeof window.screen.availWidth ? window.screen.availWidth : ""); | |
fp.nav_window_screen_availHeight = ("undefined" != typeof window.screen.availHeight ? window.screen.availHeight : ""); | |
fp.nav_window_screen_pixelDepth = ("undefined" != typeof window.screen.pixelDepth ? window.screen.pixelDepth : ""); | |
fp.devicePixelRatio = ("undefined" != typeof window.devicePixelRatio ? window.devicePixelRatio : "Not supported."); | |
fp.nav_window_screen_availLeft = ("undefined" != typeof window.screen.availLeft ? window.screen.availLeft : ""); | |
fp.nav_window_screen_availTop = ("undefined" != typeof window.screen.availTop ? window.screen.availTop : ""); | |
fp.nav_window_screen_innerHeight = ("undefined" != typeof window.innerHeight ? window.innerHeight : "") | |
fp.nav_window_screen_innerWidth = ("undefined" != typeof window.innerWidth ? window.innerWidth : "") | |
fp.nav_window_screen_orientation_angle = ("undefined" != typeof window.screen.orientation.angle ? window.screen.orientation.angle : "") | |
fp.nav_window_screen_orientation_type = ("undefined" != typeof window.screen.orientation.type ? window.screen.orientation.type : "") | |
fp.nav_window_screen_orientation_onchange = ("undefined" != typeof window.screen.orientation.onchange ? window.screen.orientation.onchange : "") | |
fp.color_depth = ("undefined" != typeof fp2.color_depth ? fp2.color_depth : ""); | |
fp.langs = ("undefined" != typeof navigator.languages ? navigator.languages : []); | |
fp.lang = ("undefined" != typeof navigator.language ? navigator.language : ""); | |
fp.userLang = ("undefined" != typeof navigator.userLanguage ? navigator.userLanguage : ""); | |
fp.browserLang = ("undefined" != typeof navigator.browserLanguage ? navigator.browserLanguage : ""); | |
fp.systemLang = ("undefined" != typeof navigator.systemLanguage ? navigator.systemLanguage : ""); | |
if("undefined" != typeof navigator.connection) { | |
fp.nav_connection_effectiveType = ("undefined" != typeof navigator.connection.effectiveType ? navigator.connection.effectiveType : ""); | |
fp.nav_connection_rtt = ("undefined" != typeof navigator.connection.rtt ? navigator.connection.rtt : ""); | |
fp.nav_connection_downlink = ("undefined" != typeof navigator.connection.downlink ? navigator.connection.downlink : ""); | |
fp.nav_connection_saveData = ("undefined" != typeof navigator.connection.saveData ? navigator.connection.saveData : ""); | |
} | |
var date = (new Date()); | |
fp.comp_tz_offset = ('+'+(date.getTimezoneOffset())*(-1))/60; | |
fp.comp_time_ms = Math.round(date.getTime()/1000) + ((date.getTimezoneOffset()*60)*(-1)); // local | |
fp.comp_time = date.toString(); // local | |
var winterDate = new Date(date.getFullYear(), 0, 1), | |
summerDate = new Date(date.getFullYear(), 6, 1), | |
DSTexists = winterDate.getTimezoneOffset() != summerDate.getTimezoneOffset(); | |
fp.dst_exists = DSTexists; | |
fp.plugins = ("undefined" != typeof fp2.regular_plugins ? fp2.regular_plugins : []); | |
fp.mimetypes = getMimeTypes(); | |
var canvasImgBase64 = ("undefined" != typeof fp2.canvas ? fp2.canvas.split('canvas fp:')[1] : ""); | |
var canvasImgBase64hash = fp2obj.x64hash128(canvasImgBase64); | |
//console.log(canvasImgBase64); | |
fp.canvas_hash = canvasImgBase64hash; | |
if(fp2.webgl) { | |
var webglImgBase64 = fp2.webgl.split("~extensions:")[0]; | |
var webglExtensions = fp2.webgl.split("~extensions:")[1]; | |
//console.log(webglExtensions); | |
var webglImgBase64hash = fp2obj.x64hash128(webglImgBase64); | |
var webglExtensionsHash = fp2obj.x64hash128(webglExtensions); | |
} | |
else { | |
var webglImgBase64hash = 'Not supported.'; | |
var webglExtensionsHash = 'Not supported.'; | |
} | |
console.log(webglImgBase64); | |
fp.webgl_image_hash = webglImgBase64hash; | |
fp.webgl_ext_hash = webglExtensionsHash; | |
fp.webgl_vendor = getWebGLDebugVendor(); | |
fp.webgl_renderer = getWebGLDebugRenderer(); | |
fp.webgl_basic_vendor = getWebGLBasicVendor(); | |
fp.webgl_basic_renderer = getWebGLBasicRenderer(); | |
fp.webgl_basic_version = getWebGLBasicVersion(); | |
fp.webgl_basic_shading_lang_ver = getWebGLBasicShadingLangVer(); | |
fp.webgl_basic_max_texture_max_anisotropy_ext = getWebGLBasicMaxTextureMaxAnisotropyExt(); | |
fp.webgl_MaxVertexAttribs = getWebGLMaxVertexAttribs(); | |
fp.webgl_MaxVertexUniformVectors = getWebGLMaxVertexUniformVectors(); | |
fp.webgl_MaxVertexTextureImageUnits = getWebGLMaxVertexTextureImageUnits(); | |
fp.webgl_MaxVaryingVectors = getWebGLMaxVaryingVectors(); | |
fp.webgl_MaxVertexUniformComponents = getWebGLMaxVertexUniformComponents(); | |
fp.webgl_MaxVertexUniformBlocks = getWebGLMaxVertexUniformBlocks(); | |
fp.webgl_MaxVertexOutputComponents = getWebGLMaxVertexOutputComponents(); | |
fp.webgl_MaxVaryingComponents = getWebGLMaxVaryingComponents(); | |
fp.webgl_MaxTransformFeedbackInterleavedComponents = getWebGLMaxTransformFeedbackInterleavedComponents(); | |
fp.webgl_MaxTransformFeedbackSeparateAttribs = getWebGLMaxTransformFeedbackSeparateAttribs(); | |
fp.webgl_MaxTransformFeedbackSeparateComponents = getWebGLMaxTransformFeedbackSeparateComponents(); | |
fp.webgl_AliasedLineWidthRange = getWebGLAliasedLineWidthRange(); | |
fp.webgl_AliasedPointSizeRange = getWebGLAliasedPointSizeRange(); | |
fp.webgl_MaxFragmentUniformVectors = getWebGLMaxFragmentUniformVectors(); | |
fp.webgl_MaxTextureImageUnits = getWebGLMaxTextureImageUnits(); | |
fp.webgl_MaxFragmentUniformComponents = getWebGLMaxFragmentUniformComponents(); | |
fp.webgl_MaxFragmentUniformBlocks = getWebGLMaxFragmentUniformBlocks(); | |
fp.webgl_MaxFragmentInputComponents = getWebGLMaxFragmentInputComponents(); | |
fp.webgl_MinProgramTexelOffset = getWebGLMinProgramTexelOffset(); | |
fp.webgl_MaxProgramTexelOffset = getWebGLMaxProgramTexelOffset(); | |
fp.webgl_MaxDrawBuffers = getWebGLMaxDrawBuffers(); | |
fp.webgl_MaxColorAttachments = getWebGLMaxColorAttachments(); | |
fp.webgl_MaxSamples = getWebGLMaxSamples(); | |
fp.webgl_RedBits = getWebGLRedBits(); | |
fp.webgl_GreenBits = getWebGLGreenBits(); | |
fp.webgl_BlueBits = getWebGLBlueBits(); | |
fp.webgl_AlphaBits = getWebGLAlphaBits(); | |
fp.webgl_DepthBits = getWebGLDepthBits(); | |
fp.webgl_StencilBits = getWebGLStencilBits(); | |
fp.webgl_MaxRenderbufferSize = getWebGLMaxRenderbufferSize(); | |
fp.webgl_MaxViewportDims = getWebGLMaxViewportDims(); | |
fp.webgl_MaxTextureSize = getWebGLMaxTextureSize(); | |
fp.webgl_MaxCubeMapTextureSize = getWebGLMaxCubeMapTextureSize(); | |
fp.webgl_MaxCombinedTextureImageUnits = getWebGLMaxCombinedTextureImageUnits(); | |
fp.webgl_Max3DTextureSize = getWebGLMax3DTextureSize(); | |
fp.webgl_MaxArrayTextureLayers = getWebGLMaxArrayTextureLayers(); | |
fp.webgl_MaxTextureLodBias = getWebGLMaxTextureLodBias(); | |
fp.webgl_MaxUniformBufferBindings = getWebGLMaxUniformBufferBindings(); | |
fp.webgl_MaxUniformBlockSize = getWebGLMaxUniformBlockSize(); | |
fp.webgl_UniformBufferOffsetAlignment = getWebGLUniformBufferOffsetAlignment(); | |
fp.webgl_MaxCombinedUniformBlocks = getWebGLMaxCombinedUniformBlocks(); | |
fp.webgl_MaxCombinedVertexUniformComponents = getWebGLMaxCombinedVertexUniformComponents(); | |
fp.webgl_MaxCombinedFragmentUniformComponents = getWebGLMaxCombinedFragmentUniformComponents(); | |
fp.webgl_Aliasing = getWebGLAliasing(); | |
fp.webgl_BestFloatPrecision = getBestFloatPrecision(); | |
fp.webgl_SupportExtensions = getSupportExtensions(); | |
fp.webgl_IntPrecision = getIntPrecision(); | |
fp.webgl_Angle = getWebGLAngle(); | |
//a+b; | |
fp.fonts = ("undefined" != typeof fp2.js_fonts ? fp2.js_fonts : []); | |
fp.fonts_hash = ("undefined" != typeof fp2.js_fonts ? fp2obj.x64hash128(fp2.js_fonts.join(', ')) : ""); | |
fp.font_smoothing = getFontSmoothing(); | |
var installedAlphabets = getInstalledAlphabets(); | |
fp.installed_alphabets = ("undefined" != typeof installedAlphabets ? installedAlphabets.join(', ') : ""); | |
var systemColorsCodes = getSystemColorsCodes(); | |
fp.system_colors_codes_hash = (systemColorsCodes ? fp2obj.x64hash128(systemColorsCodes) : 'Not supported.'); | |
fp.is_fake_lang = ("undefined" != typeof fp2.has_lied_languages ? fp2.has_lied_languages : ""); | |
fp.is_fake_res = ("undefined" != typeof fp2.has_lied_resolution ? fp2.has_lied_resolution : ""); | |
fp.is_fake_os = ("undefined" != typeof fp2.has_lied_os ? fp2.has_lied_os : ""); | |
fp.is_fake_browser = ("undefined" != typeof fp2.has_lied_browser ? fp2.has_lied_browser : ""); | |
fp.audio_fp_pxi_output = (window.audioData ? window.audioData.pxi_output : false); | |
fp.audio_fp_pxi_full_buffer_hash = (window.audioData ? window.audioData.pxi_full_buffer_hash : false); | |
fp.audio_fp_nt_vc_output = (window.audioData ? JSON.stringify(window.audioData.nt_vc_output) : false); | |
fp.audio_fp_cc_output = ((window.audioData && window.audioData.cc_output) ? fp2obj.x64hash128(window.audioData.cc_output.toString()) : false); | |
fp.audio_fp_hybrid_output = ((window.audioData && window.audioData.hybrid_output) ? fp2obj.x64hash128(window.audioData.hybrid_output.toString()) : false); | |
var clientRectsFP = getClientRectsFP(); | |
fp.client_rects_hash = (clientRectsFP ? fp2obj.x64hash128(clientRectsFP) : false); | |
//fp.canvas_protection = getCanvasProtection(); | |
fp.canvas_protection_data = getCanvasProtectionData(); | |
fp.webgl_protection = getWebGLProtection(); | |
fp.webgl_protection2_1_res = getWebGLProtection2("webgl").join(':::'); | |
fp.webgl_protection2_2_res = getWebGLProtection2("webgl2").join(':::'); | |
fp.png_etag = window.pngEtag; | |
if (fp.nav_userAgent.indexOf('Windows') > -1) | |
{ | |
fp.os = "Windows"; | |
} | |
if (fp.nav_userAgent.indexOf('Linux') > -1) | |
{ | |
fp.os = "Linux"; | |
} | |
if (fp.nav_userAgent.indexOf('Android') > -1) | |
{ | |
fp.os = "Android"; | |
} | |
if (fp.nav_userAgent.indexOf('Firefox') > -1) | |
{ | |
fp.browser = "Firefox"; | |
} | |
if (fp.nav_userAgent.indexOf('Chrome') > -1) | |
{ | |
fp.browser = "Chrome"; | |
} | |
if (fp.nav_userAgent.indexOf('OPR') > -1) | |
{ | |
fp.browser = "OPR"; | |
} | |
if (fp.nav_userAgent.indexOf('Mac ') > -1) | |
{ | |
fp.os = "Apple"; | |
} | |
document.getElementById('nav_userAgent').value = fp.nav_userAgent; | |
document.getElementById('nav_appName').value = fp.nav_appName; | |
document.getElementById('nav_appCodeName').value = fp.nav_appCodeName; | |
document.getElementById('nav_appVersion').value = fp.nav_appVersion; | |
document.getElementById('nav_appMinorVersion').value = fp.nav_appMinorVersion; | |
document.getElementById('nav_buildID').value = fp.nav_buildID; | |
document.getElementById('nav_buildid').value = fp.nav_buildid; | |
document.getElementById('nav_cpuClass').value = fp.nav_cpuClass; | |
document.getElementById('nav_oscpu').value = fp.nav_oscpu; | |
document.getElementById('nav_platform').value = fp.nav_platform; | |
document.getElementById('nav_product').value = fp.nav_product; | |
document.getElementById('nav_productsub').value = fp.nav_productsub; | |
document.getElementById('nav_vendor').value = fp.nav_vendor; | |
document.getElementById('nav_vendorsub').value = fp.nav_vendorsub; | |
document.getElementById('nav_hardwareConcurrency').value = fp.nav_hardwareConcurrency; | |
document.getElementById('nav_deviceMemory').value = fp.nav_deviceMemory; | |
document.getElementById('nav_window_screen_orientation_div_clientWidth').value = fp.nav_window_screen_orientation_div_clientWidth; | |
document.getElementById('nav_window_screen_orientation_div_clientHeight').value = fp.nav_window_screen_orientation_div_clientHeight; | |
document.getElementById('nav_window_screen_width').value = fp.nav_window_screen_width; | |
document.getElementById('nav_window_screen_height').value = fp.nav_window_screen_height; | |
document.getElementById('nav_window_screen_availWidth').value = fp.nav_window_screen_availWidth; | |
document.getElementById('nav_window_screen_availHeight').value = fp.nav_window_screen_availHeight; | |
document.getElementById('nav_window_screen_pixelDepth').value = fp.nav_window_screen_pixelDepth; | |
document.getElementById('nav_window_screen_availLeft').value = fp.nav_window_screen_availLeft; | |
document.getElementById('nav_window_screen_availTop').value = fp.nav_window_screen_availTop; | |
document.getElementById('nav_window_screen_innerHeight').value = fp.nav_window_screen_innerHeight; | |
document.getElementById('nav_window_screen_innerWidth').value = fp.nav_window_screen_innerWidth; | |
document.getElementById('nav_window_screen_orientation_angle').value = fp.nav_window_screen_orientation_angle; | |
document.getElementById('nav_window_screen_orientation_type').value = fp.nav_window_screen_orientation_type; | |
document.getElementById('nav_window_screen_orientation_onchange').value = fp.nav_window_screen_orientation_onchange; | |
document.getElementById('color_depth').value = fp.color_depth; | |
document.getElementById('devicePixelRatio').value = fp.devicePixelRatio; | |
document.getElementById('langs').value = fp.langs; | |
document.getElementById('lang').value = fp.lang; | |
document.getElementById('userLang').value = fp.userLang; | |
document.getElementById('browserLang').value = fp.browserLang; | |
document.getElementById('systemLang').value = fp.systemLang; | |
document.getElementById('nav_connection_effectiveType').value = fp.nav_connection_effectiveType; | |
document.getElementById('nav_connection_rtt').value = fp.nav_connection_rtt; | |
document.getElementById('nav_connection_downlink').value = fp.nav_connection_downlink; | |
document.getElementById('nav_connection_saveData').value = fp.nav_connection_saveData; | |
document.getElementById('comp_tz_offset').value = fp.comp_tz_offset; | |
document.getElementById('comp_time_ms').value = fp.comp_time_ms; | |
document.getElementById('comp_time').value = fp.comp_time; | |
document.getElementById('plugins').value = fp.plugins; | |
document.getElementById('mimetypes').value = fp.mimetypes; | |
document.getElementById('dst_exists').value = fp.dst_exists; | |
document.getElementById('canvas_hash').value = fp.canvas_hash; | |
document.getElementById('webgl_image_hash').value = fp.webgl_image_hash; | |
document.getElementById('webgl_ext_hash').value = fp.webgl_ext_hash; | |
document.getElementById('webgl_vendor').value = fp.webgl_vendor; | |
document.getElementById('webgl_renderer').value = fp.webgl_renderer; | |
document.getElementById('webgl_basic_vendor').value = fp.webgl_basic_vendor; | |
document.getElementById('webgl_basic_renderer').value = fp.webgl_basic_renderer; | |
document.getElementById('webgl_basic_version').value = fp.webgl_basic_version; | |
document.getElementById('webgl_basic_shading_lang_ver').value = fp.webgl_basic_shading_lang_ver; | |
document.getElementById('webgl_basic_max_texture_max_anisotropy_ext').value = fp.webgl_basic_max_texture_max_anisotropy_ext; | |
document.getElementById('webgl_MaxVertexAttribs').value = fp.webgl_MaxVertexAttribs; | |
document.getElementById('webgl_MaxVertexUniformVectors').value = fp.webgl_MaxVertexUniformVectors; | |
document.getElementById('webgl_MaxVertexTextureImageUnits').value = fp.webgl_MaxVertexTextureImageUnits; | |
document.getElementById('webgl_MaxVaryingVectors').value = fp.webgl_MaxVaryingVectors; | |
document.getElementById('webgl_MaxVertexUniformComponents').value = fp.webgl_MaxVertexUniformComponents; | |
document.getElementById('webgl_MaxVertexUniformBlocks').value = fp.webgl_MaxVertexUniformBlocks; | |
document.getElementById('webgl_MaxVertexOutputComponents').value = fp.webgl_MaxVertexOutputComponents; | |
document.getElementById('webgl_MaxVaryingComponents').value = fp.webgl_MaxVaryingComponents; | |
document.getElementById('webgl_MaxTransformFeedbackInterleavedComponents').value = fp.webgl_MaxTransformFeedbackInterleavedComponents; | |
document.getElementById('webgl_MaxTransformFeedbackSeparateAttribs').value = fp.webgl_MaxTransformFeedbackSeparateAttribs; | |
document.getElementById('webgl_MaxTransformFeedbackSeparateComponents').value = fp.webgl_MaxTransformFeedbackSeparateComponents; | |
document.getElementById('webgl_AliasedLineWidthRange').value = fp.webgl_AliasedLineWidthRange; | |
document.getElementById('webgl_AliasedPointSizeRange').value = fp.webgl_AliasedPointSizeRange; | |
document.getElementById('webgl_MaxFragmentUniformVectors').value = fp.webgl_MaxFragmentUniformVectors; | |
document.getElementById('webgl_MaxTextureImageUnits').value = fp.webgl_MaxTextureImageUnits; | |
document.getElementById('webgl_MaxFragmentUniformComponents').value = fp.webgl_MaxFragmentUniformComponents; | |
document.getElementById('webgl_MaxFragmentUniformBlocks').value = fp.webgl_MaxFragmentUniformBlocks; | |
document.getElementById('webgl_MaxFragmentInputComponents').value = fp.webgl_MaxFragmentInputComponents; | |
document.getElementById('webgl_MinProgramTexelOffset').value = fp.webgl_MinProgramTexelOffset; | |
document.getElementById('webgl_MaxProgramTexelOffset').value = fp.webgl_MaxProgramTexelOffset; | |
document.getElementById('webgl_MaxDrawBuffers').value = fp.webgl_MaxDrawBuffers; | |
document.getElementById('webgl_MaxColorAttachments').value = fp.webgl_MaxColorAttachments; | |
document.getElementById('webgl_MaxSamples').value = fp.webgl_MaxSamples; | |
document.getElementById('webgl_RedBits').value = fp.webgl_RedBits; | |
document.getElementById('webgl_GreenBits').value = fp.webgl_GreenBits; | |
document.getElementById('webgl_BlueBits').value = fp.webgl_BlueBits; | |
document.getElementById('webgl_AlphaBits').value = fp.webgl_AlphaBits; | |
document.getElementById('webgl_DepthBits').value = fp.webgl_DepthBits; | |
document.getElementById('webgl_StencilBits').value = fp.webgl_StencilBits; | |
document.getElementById('webgl_MaxRenderbufferSize').value = fp.webgl_MaxRenderbufferSize; | |
document.getElementById('webgl_MaxViewportDims').value = fp.webgl_MaxViewportDims; | |
document.getElementById('webgl_MaxTextureSize').value = fp.webgl_MaxTextureSize; | |
document.getElementById('webgl_MaxCubeMapTextureSize').value = fp.webgl_MaxCubeMapTextureSize; | |
document.getElementById('webgl_MaxCombinedTextureImageUnits').value = fp.webgl_MaxCombinedTextureImageUnits; | |
document.getElementById('webgl_Max3DTextureSize').value = fp.webgl_Max3DTextureSize; | |
document.getElementById('webgl_MaxArrayTextureLayers').value = fp.webgl_MaxArrayTextureLayers; | |
document.getElementById('webgl_MaxTextureLodBias').value = fp.webgl_MaxTextureLodBias; | |
document.getElementById('webgl_MaxUniformBufferBindings').value = fp.webgl_MaxUniformBufferBindings; | |
document.getElementById('webgl_MaxUniformBlockSize').value = fp.webgl_MaxUniformBlockSize; | |
document.getElementById('webgl_UniformBufferOffsetAlignment').value = fp.webgl_UniformBufferOffsetAlignment; | |
document.getElementById('webgl_MaxCombinedUniformBlocks').value = fp.webgl_MaxCombinedUniformBlocks; | |
document.getElementById('webgl_MaxCombinedVertexUniformComponents').value = fp.webgl_MaxCombinedVertexUniformComponents; | |
document.getElementById('webgl_MaxCombinedFragmentUniformComponents').value = fp.webgl_MaxCombinedFragmentUniformComponents; | |
document.getElementById('fonts').value = fp.fonts; | |
document.getElementById('fonts_hash').value = fp.fonts_hash; | |
document.getElementById('font_smoothing').value = fp.font_smoothing; | |
document.getElementById('installed_alphabets').value = fp.installed_alphabets; | |
document.getElementById('system_colors_codes_hash').value = fp.system_colors_codes_hash; | |
document.getElementById('audio_fp_pxi_output').value = fp.audio_fp_pxi_output; | |
document.getElementById('audio_fp_pxi_full_buffer_hash').value = fp.audio_fp_pxi_full_buffer_hash; | |
document.getElementById('audio_fp_nt_vc_output').value = fp.audio_fp_nt_vc_output; | |
document.getElementById('audio_fp_cc_output').value = fp.audio_fp_cc_output; | |
document.getElementById('audio_fp_hybrid_output').value = fp.audio_fp_hybrid_output; | |
document.getElementById('client_rects_hash').value = fp.client_rects_hash; | |
document.getElementById('png_etag').value = fp.png_etag; | |
document.getElementById('webgl_Aliasing').value = fp.webgl_Aliasing; | |
document.getElementById('webgl_BestFloatPrecision').value = fp.webgl_BestFloatPrecision; | |
document.getElementById('webgl_SupportExtensions').value = fp.webgl_SupportExtensions; | |
document.getElementById('webgl_IntPrecision').value = fp.webgl_IntPrecision; | |
document.getElementById('webgl_Angle').value = fp.webgl_Angle; | |
document.getElementById('os').value = fp.os; | |
document.getElementById('browser').value = fp.browser; | |
document.getElementById("fingerprint_button").click() | |
} | |
function fpStepComplete(forceSend) { | |
if(typeof(forceSend) === 'undefined') forceSend = false; | |
if(window.fpSent) { return; } | |
if( | |
forceSend || | |
( | |
window.fpStepCommonComplete && | |
window.fpStepAudio.pxi_output && | |
window.fpStepAudio.pxi_full_buffer_hash && | |
window.fpStepAudio.nt_vc_output && | |
window.fpStepAudio.cc_output && | |
window.fpStepAudio.hybrid_output && | |
window.fpStepPngEtagComplete | |
) | |
) { | |
window.fpSent = true; | |
clearTimeout(window.fpStepForceSendTimeout); | |
try { | |
fpFinish(window.fp2, window.fp2obj); | |
} | |
catch(e){catchErrorFunc(e);} | |
} | |
} | |
function getMimeTypes() { | |
var ret; | |
try { | |
var nm = navigator.mimeTypes; | |
if(nm && nm.length) { | |
var m = []; | |
for (var i = 0; i < nm.length; i++) { | |
//m.push(nm[i].description+'::'+nm[i].suffixes+'::'+nm[i].type); | |
m.push([nm[i].description, nm[i].type]); | |
} | |
ret = m; | |
} | |
else { | |
ret = []; | |
} | |
} | |
catch(e) { | |
ret = []; | |
} | |
return ret; | |
} | |
var CryptoJS = CryptoJS || function(a, b) { | |
var c = {}, | |
d = c.lib = {}, | |
e = function() {}, | |
f = d.Base = { | |
extend: function(a) { | |
e.prototype = this; | |
var b = new e; | |
return a && b.mixIn(a), b.hasOwnProperty("init") || (b.init = function() { | |
b.$super.init.apply(this, arguments) | |
}), b.init.prototype = b, b.$super = this, b | |
}, | |
create: function() { | |
var a = this.extend(); | |
return a.init.apply(a, arguments), a | |
}, | |
init: function() {}, | |
mixIn: function(a) { | |
for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b]); | |
a.hasOwnProperty("toString") && (this.toString = a.toString) | |
}, | |
clone: function() { | |
return this.init.prototype.extend(this) | |
} | |
}, | |
g = d.WordArray = f.extend({ | |
init: function(a, c) { | |
a = this.words = a || [], this.sigBytes = c != b ? c : 4 * a.length | |
}, | |
toString: function(a) { | |
return (a || i).stringify(this) | |
}, | |
concat: function(a) { | |
var b = this.words, | |
c = a.words, | |
d = this.sigBytes; | |
if (a = a.sigBytes, this.clamp(), d % 4) | |
for (var e = 0; e < a; e++) b[d + e >>> 2] |= (c[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((d + e) % 4); | |
else if (65535 < c.length) | |
for (e = 0; e < a; e += 4) b[d + e >>> 2] = c[e >>> 2]; | |
else b.push.apply(b, c); | |
return this.sigBytes += a, this | |
}, | |
clamp: function() { | |
var b = this.words, | |
c = this.sigBytes; | |
b[c >>> 2] &= 4294967295 << 32 - 8 * (c % 4), b.length = a.ceil(c / 4) | |
}, | |
clone: function() { | |
var a = f.clone.call(this); | |
return a.words = this.words.slice(0), a | |
}, | |
random: function(b) { | |
for (var c = [], d = 0; d < b; d += 4) c.push(4294967296 * a.random() | 0); | |
return new g.init(c, b) | |
} | |
}), | |
h = c.enc = {}, | |
i = h.Hex = { | |
stringify: function(a) { | |
var b = a.words; | |
a = a.sigBytes; | |
for (var c = [], d = 0; d < a; d++) { | |
var e = b[d >>> 2] >>> 24 - 8 * (d % 4) & 255; | |
c.push((e >>> 4).toString(16)), c.push((15 & e).toString(16)) | |
} | |
return c.join("") | |
}, | |
parse: function(a) { | |
for (var b = a.length, c = [], d = 0; d < b; d += 2) c[d >>> 3] |= parseInt(a.substr(d, 2), 16) << 24 - 4 * (d % 8); | |
return new g.init(c, b / 2) | |
} | |
}, | |
j = h.Latin1 = { | |
stringify: function(a) { | |
var b = a.words; | |
a = a.sigBytes; | |
for (var c = [], d = 0; d < a; d++) c.push(String.fromCharCode(b[d >>> 2] >>> 24 - 8 * (d % 4) & 255)); | |
return c.join("") | |
}, | |
parse: function(a) { | |
for (var b = a.length, c = [], d = 0; d < b; d++) c[d >>> 2] |= (255 & a.charCodeAt(d)) << 24 - 8 * (d % 4); | |
return new g.init(c, b) | |
} | |
}, | |
k = h.Utf8 = { | |
stringify: function(a) { | |
try { | |
return decodeURIComponent(escape(j.stringify(a))) | |
} catch (a) { | |
throw Error("Malformed UTF-8 data") | |
} | |
}, | |
parse: function(a) { | |
return j.parse(unescape(encodeURIComponent(a))) | |
} | |
}, | |
l = d.BufferedBlockAlgorithm = f.extend({ | |
reset: function() { | |
this._data = new g.init, this._nDataBytes = 0 | |
}, | |
_append: function(a) { | |
"string" == typeof a && (a = k.parse(a)), this._data.concat(a), this._nDataBytes += a.sigBytes | |
}, | |
_process: function(b) { | |
var c = this._data, | |
d = c.words, | |
e = c.sigBytes, | |
f = this.blockSize, | |
h = e / (4 * f), | |
h = b ? a.ceil(h) : a.max((0 | h) - this._minBufferSize, 0); | |
if (b = h * f, e = a.min(4 * b, e), b) { | |
for (var i = 0; i < b; i += f) this._doProcessBlock(d, i); | |
i = d.splice(0, b), c.sigBytes -= e | |
} | |
return new g.init(i, e) | |
}, | |
clone: function() { | |
var a = f.clone.call(this); | |
return a._data = this._data.clone(), a | |
}, | |
_minBufferSize: 0 | |
}); | |
d.Hasher = l.extend({ | |
cfg: f.extend(), | |
init: function(a) { | |
this.cfg = this.cfg.extend(a), this.reset() | |
}, | |
reset: function() { | |
l.reset.call(this), this._doReset() | |
}, | |
update: function(a) { | |
return this._append(a), this._process(), this | |
}, | |
finalize: function(a) { | |
return a && this._append(a), this._doFinalize() | |
}, | |
blockSize: 16, | |
_createHelper: function(a) { | |
return function(b, c) { | |
return new a.init(c).finalize(b) | |
} | |
}, | |
_createHmacHelper: function(a) { | |
return function(b, c) { | |
return new m.HMAC.init(a, c).finalize(b) | |
} | |
} | |
}); | |
var m = c.algo = {}; | |
return c | |
}(Math); | |
! function() { | |
var a = CryptoJS, | |
b = a.lib, | |
c = b.WordArray, | |
d = b.Hasher, | |
e = [], | |
b = a.algo.SHA1 = d.extend({ | |
_doReset: function() { | |
this._hash = new c.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) | |
}, | |
_doProcessBlock: function(a, b) { | |
for (var c = this._hash.words, d = c[0], f = c[1], g = c[2], h = c[3], i = c[4], j = 0; 80 > j; j++) { | |
if (16 > j) e[j] = 0 | a[b + j]; | |
else { | |
var k = e[j - 3] ^ e[j - 8] ^ e[j - 14] ^ e[j - 16]; | |
e[j] = k << 1 | k >>> 31 | |
} | |
k = (d << 5 | d >>> 27) + i + e[j], k = 20 > j ? k + ((f & g | ~f & h) + 1518500249) : 40 > j ? k + ((f ^ g ^ h) + 1859775393) : 60 > j ? k + ((f & g | f & h | g & h) - 1894007588) : k + ((f ^ g ^ h) - 899497514), i = h, h = g, g = f << 30 | f >>> 2, f = d, d = k | |
} | |
c[0] = c[0] + d | 0, c[1] = c[1] + f | 0, c[2] = c[2] + g | 0, c[3] = c[3] + h | 0, c[4] = c[4] + i | 0 | |
}, | |
_doFinalize: function() { | |
var a = this._data, | |
b = a.words, | |
c = 8 * this._nDataBytes, | |
d = 8 * a.sigBytes; | |
return b[d >>> 5] |= 128 << 24 - d % 32, b[(d + 64 >>> 9 << 4) + 14] = Math.floor(c / 4294967296), b[(d + 64 >>> 9 << 4) + 15] = c, a.sigBytes = 4 * b.length, this._process(), this._hash | |
}, | |
clone: function() { | |
var a = d.clone.call(this); | |
return a._hash = this._hash.clone(), a | |
} | |
}); | |
a.SHA1 = d._createHelper(b), a.HmacSHA1 = d._createHmacHelper(b) | |
}(); | |
function audioFingerprint() { | |
window.audioData = {}; | |
if ((window.AudioContext || window.webkitAudioContext) === undefined){ | |
//window.audioData = "Not supported"; | |
window.audioData = false; | |
} else { | |
// Performs fingerprint as found in https://client.a.pxi.pub/PXmssU3ZQ0/main.min.js | |
//Sum of buffer values | |
function run_pxi_fp() { | |
try { | |
try { | |
var context = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(1, 44100, 44100); | |
} catch(e) { handleCreateAudioContextException(e); return;} | |
if (!context) { | |
window.audioData.pxi_output = 0; | |
} | |
// Create oscillator | |
pxi_oscillator = context.createOscillator(); | |
pxi_oscillator.type = "triangle"; | |
pxi_oscillator.frequency.value = 1e4; | |
// Create and configure compressor | |
pxi_compressor = context.createDynamicsCompressor(); | |
pxi_compressor.threshold && (pxi_compressor.threshold.value = -50); | |
pxi_compressor.knee && (pxi_compressor.knee.value = 40); | |
pxi_compressor.ratio && (pxi_compressor.ratio.value = 12); | |
pxi_compressor.reduction && (pxi_compressor.reduction.value = -20); | |
pxi_compressor.attack && (pxi_compressor.attack.value = 0); | |
pxi_compressor.release && (pxi_compressor.release.value = .25); | |
// Connect nodes | |
pxi_oscillator.connect(pxi_compressor); | |
pxi_compressor.connect(context.destination); | |
// Start audio processing | |
pxi_oscillator.start(0); | |
context.startRendering(); | |
context.oncomplete = function (evnt) { | |
window.audioData.pxi_output = 0; | |
var sha1 = CryptoJS.algo.SHA1.create(); | |
for (var i = 0; i < evnt.renderedBuffer.length; i++) { | |
sha1.update(evnt.renderedBuffer.getChannelData(0)[i].toString()); | |
} | |
hash = sha1.finalize(); | |
window.audioData.pxi_full_buffer_hash = hash.toString(CryptoJS.enc.Hex); | |
window.fpStepAudio.pxi_full_buffer_hash = true; | |
fpStepComplete(); | |
for (var i = 4500; 5e3 > i; i++) { | |
window.audioData.pxi_output += Math.abs(evnt.renderedBuffer.getChannelData(0)[i]); | |
} | |
pxi_compressor.disconnect(); | |
window.fpStepAudio.pxi_output = true; | |
fpStepComplete(); | |
} | |
} catch (u) { | |
window.audioData.pxi_output = 0; | |
window.fpStepAudio.pxi_output = true; | |
fpStepComplete(); | |
} | |
} | |
// End PXI fingerprint | |
// Performs fingerprint as found in some versions of http://metrics.nt.vc/metrics.js | |
function a(a, b, c) { | |
for (var d in b) "dopplerFactor" === d || "speedOfSound" === d || "currentTime" === | |
d || "number" !== typeof b[d] && "string" !== typeof b[d] || (a[(c ? c : "") + d] = b[d]); | |
return a | |
} | |
function run_nt_vc_fp() { | |
try { | |
try { | |
var nt_vc_context = window.AudioContext || window.webkitAudioContext; | |
} catch(e) { handleCreateAudioContextException(e); return;} | |
if ("function" !== typeof nt_vc_context) window.audioData.nt_vc_output = "Not available"; | |
else { | |
var f = new nt_vc_context, | |
d = f.createAnalyser(); | |
window.audioData.nt_vc_output = a({}, f, "ac-"); | |
window.audioData.nt_vc_output = a(window.audioData.nt_vc_output, f.destination, "ac-"); | |
window.audioData.nt_vc_output = a(window.audioData.nt_vc_output, f.listener, "ac-"); | |
window.audioData.nt_vc_output = a(window.audioData.nt_vc_output, d, "an-"); | |
window.fpStepAudio.nt_vc_output = true; | |
fpStepComplete(); | |
} | |
} catch (g) { | |
window.audioData.nt_vc_output = 0; | |
window.fpStepAudio.nt_vc_output = true; | |
fpStepComplete(); | |
} | |
} | |
// Performs fingerprint as found in https://www.cdn-net.com/cc.js | |
var cc_output = []; | |
function run_cc_fp() { | |
try { | |
var audioCtx = new (window.AudioContext || window.webkitAudioContext); | |
} catch(e) { handleCreateAudioContextException(e); return;} | |
try { | |
var oscillator = audioCtx.createOscillator(), | |
analyser = audioCtx.createAnalyser(), | |
gain = audioCtx.createGain(), | |
scriptProcessor = audioCtx.createScriptProcessor(4096, 1, 1); | |
gain.gain.value = 0; // Disable volume | |
oscillator.type = "triangle"; // Set oscillator to output triangle wave | |
oscillator.connect(analyser); // Connect oscillator output to analyser input | |
analyser.connect(scriptProcessor); // Connect analyser output to scriptProcessor input | |
scriptProcessor.connect(gain); // Connect scriptProcessor output to gain input | |
gain.connect(audioCtx.destination); // Connect gain output to audiocontext destination | |
scriptProcessor.onaudioprocess = function (bins) { | |
try { | |
bins = new Float32Array(analyser.frequencyBinCount); | |
analyser.getFloatFrequencyData(bins); | |
for (var i = 0; i < bins.length; i = i + 1) { | |
cc_output.push(bins[i]); | |
} | |
analyser.disconnect(); | |
scriptProcessor.disconnect(); | |
gain.disconnect(); | |
window.audioData.cc_output = cc_output.slice(0, 30); | |
//console.log('window.audioData.cc_output='+window.audioData.cc_output); | |
window.fpStepAudio.cc_output = true; | |
fpStepComplete(); | |
} | |
catch(e){catchErrorFunc(e);} | |
}; | |
oscillator.start(0); | |
} | |
//catch(e){catchErrorFunc(e);} | |
//TypeError. audioCtx.createOscillator is not a function | |
catch(e){ | |
window.audioData.cc_output = ''; | |
window.fpStepAudio.cc_output = true; | |
fpStepComplete(); | |
} | |
} | |
// Performs a hybrid of cc/pxi methods found above | |
var hybrid_output = []; | |
function run_hybrid_fp() { | |
try { | |
var audioCtx2 = new (window.AudioContext || window.webkitAudioContext); | |
} catch(e) { handleCreateAudioContextException(e); return;} | |
try { | |
var oscillator = audioCtx2.createOscillator(), | |
analyser = audioCtx2.createAnalyser(), | |
gain = audioCtx2.createGain(), | |
scriptProcessor = audioCtx2.createScriptProcessor(4096, 1, 1); | |
// Create and configure compressor | |
compressor = audioCtx2.createDynamicsCompressor(); | |
compressor.threshold && (compressor.threshold.value = -50); | |
compressor.knee && (compressor.knee.value = 40); | |
compressor.ratio && (compressor.ratio.value = 12); | |
compressor.reduction && (compressor.reduction.value = -20); | |
compressor.attack && (compressor.attack.value = 0); | |
compressor.release && (compressor.release.value = .25); | |
gain.gain.value = 0; // Disable volume | |
oscillator.type = "triangle"; // Set oscillator to output triangle wave | |
oscillator.connect(compressor); // Connect oscillator output to dynamic compressor | |
compressor.connect(analyser); // Connect compressor to analyser | |
analyser.connect(scriptProcessor); // Connect analyser output to scriptProcessor input | |
scriptProcessor.connect(gain); // Connect scriptProcessor output to gain input | |
gain.connect(audioCtx2.destination); // Connect gain output to audiocontext destination | |
scriptProcessor.onaudioprocess = function (bins) { | |
try { | |
bins = new Float32Array(analyser.frequencyBinCount); | |
analyser.getFloatFrequencyData(bins); | |
for (var i = 0; i < bins.length; i = i + 1) { | |
hybrid_output.push(bins[i]); | |
} | |
analyser.disconnect(); | |
scriptProcessor.disconnect(); | |
gain.disconnect(); | |
window.audioData.hybrid_output = hybrid_output.slice(0, 30); | |
//console.log('window.audioData.hybrid_output='+window.audioData.hybrid_output); | |
window.fpStepAudio.hybrid_output = true; | |
fpStepComplete(); | |
} | |
catch(e){catchErrorFunc(e);} | |
}; | |
oscillator.start(0); | |
} | |
//catch(e){catchErrorFunc(e);} | |
//TypeError. audioCtx.createOscillator is not a function | |
catch(e){ | |
window.audioData.hybrid_output = ''; | |
window.fpStepAudio.hybrid_output = true; | |
fpStepComplete(); | |
} | |
} | |
run_pxi_fp(); | |
run_nt_vc_fp(); | |
run_cc_fp(); | |
run_hybrid_fp(); | |
} | |
} | |
function handleCreateAudioContextException(e) { | |
if (e instanceof DOMException) { | |
windowStorageSet('new_fp', true); | |
windowStorageSet('new_fp_name', $('input#new_fingerprint_name').val()); | |
window.location.reload(); | |
} else { | |
console.log(e.message); | |
} | |
} | |
function getClientRectsFP() { | |
// Details: http://jcarlosnorte.com/security/2016/03/06/advanced-tor-browser-fingerprinting.html | |
var elem = document.createElement('div'); | |
var s = elem.style; | |
s.position = 'absolute'; | |
s.left = '3.1px'; | |
s.top = '2.1px'; | |
s.zIndex = '-100'; | |
s.visibility = 'hidden'; | |
s.fontSize = '19.123px'; | |
s.transformOrigin = '0.1px 0.2px 0.3px'; | |
s.webkitTransformOrigin = '0.1px 0.2px 0.3px'; | |
s.webkitTransform = 'scale(1.01123) matrix3d(0.251106, 0.0131141, 0, -0.000109893, -0.0380797, 0.349552, 0, 7.97469e-06, 0, 0, 1, 0, 575, 88, 0, 1)'; | |
s.transform = 'scale(1.01123) matrix3d(0.251106, 0.0131141, 0, -0.000109893, -0.0380797, 0.349552, 0, 7.97469e-06, 0, 0, 1, 0, 575, 88, 0, 1)'; | |
elem.innerHTML = '<h1>Sed ut perspiciatis unde</h1>pousdfnmv<b>asd<i id="target">asd</i></b>'; | |
document.body.appendChild(elem); | |
var uuid = ''; | |
try { | |
var rect = document.getElementById('target').getClientRects()[0]; | |
for (var key in rect) { | |
uuid += rect[key]; | |
} | |
} | |
catch(e) { | |
uuid = false; | |
} | |
if (elem.remove) elem.remove(); | |
return uuid; | |
} | |
function getCanvasProtection() { | |
try { | |
var a = document.createElement("canvas").getContext("2d"); | |
a.fillStyle = "rgb(4,3,7)"; | |
a.fillRect(0, 0, 1, 1); | |
a.fill(); | |
if(4 !== a.getImageData(0, 0, 1, 1).data[0]) { | |
return true; | |
} | |
else { | |
return false; | |
} | |
} catch (a) { | |
return false; | |
} | |
} | |
function getCanvasProtectionData() { | |
try { | |
var width = 2, height = 2; | |
var canvas = document.createElement("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
var ctx = canvas.getContext("2d"); | |
ctx.fillStyle = "#ffffff"; | |
ctx.fillRect(0,0,width,height); | |
return canvas.toDataURL(); | |
} catch (a) { | |
return false; | |
} | |
} | |
function getWebGLProtection() { | |
if (window.WebGLRenderingContext) { | |
for (var a = document.createElement("canvas"), b = ["webgl", "experimental-webgl", "moz-webgl"], c = false, d = 0; d < 4; d++) { | |
try { | |
c = a.getContext(b[d]) | |
if (c && "function" != typeof c.getParameter) { | |
return true; | |
} | |
} catch (a) {} | |
} | |
return false; | |
} | |
else { | |
return false; | |
} | |
} | |
function getWebGLProtection2(context) { | |
var error = ''; | |
try { | |
var canvas = document.createElement("canvas"); | |
canvas.width = 11; | |
canvas.height = 13; | |
var gl = canvas.getContext(context) || canvas.getContext("experimental-" + context); | |
gl.clearColor(0, 0, 0, 1); | |
gl.clear(gl.COLOR_BUFFER_BIT); | |
var pixels = new Uint8Array(gl.drawingBufferWidth * gl.drawingBufferHeight * 4); | |
gl.readPixels(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixels); | |
var values = {}; | |
for (var i = 0; i < pixels.length; i += 1){ | |
values[pixels[i]] = (values[pixels[i]] || 0) + 1; | |
} | |
} | |
catch (e){ | |
error = e.message; | |
} | |
return [ | |
(values ? JSON.stringify(values) : 'error'), | |
error.toString() | |
]; | |
} | |
function getWebGLDebugVendor() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx.getSupportedExtensions().indexOf("WEBGL_debug_renderer_info") >= 0) { | |
return ctx.getParameter(ctx.getExtension('WEBGL_debug_renderer_info').UNMASKED_VENDOR_WEBGL); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLDebugRenderer() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx.getSupportedExtensions().indexOf("WEBGL_debug_renderer_info") >= 0) { | |
return ctx.getParameter(ctx.getExtension('WEBGL_debug_renderer_info').UNMASKED_RENDERER_WEBGL); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBasicVersion() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.VERSION !== 'undefined') { | |
return ctx.getParameter(ctx.VERSION); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBasicShadingLangVer() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.SHADING_LANGUAGE_VERSION !== 'undefined') { | |
return ctx.getParameter(ctx.SHADING_LANGUAGE_VERSION); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBasicVendor() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.VENDOR !== 'undefined') { | |
return ctx.getParameter(ctx.VENDOR); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBasicRenderer() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.RENDERER !== 'undefined') { | |
return ctx.getParameter(ctx.RENDERER); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexAttribs() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_VERTEX_ATTRIBS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexUniformVectors() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_VERTEX_UNIFORM_VECTORS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_UNIFORM_VECTORS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexTextureImageUnits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_VERTEX_TEXTURE_IMAGE_UNITS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_TEXTURE_IMAGE_UNITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVaryingVectors() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_VARYING_VECTORS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VARYING_VECTORS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexUniformComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_VERTEX_UNIFORM_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_UNIFORM_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexUniformBlocks() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_VERTEX_UNIFORM_BLOCKS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_UNIFORM_BLOCKS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVertexOutputComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_VERTEX_OUTPUT_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VERTEX_OUTPUT_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxVaryingComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_VARYING_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_VARYING_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTransformFeedbackInterleavedComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTransformFeedbackSeparateAttribs() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTransformFeedbackSeparateComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLAliasedLineWidthRange() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.ALIASED_LINE_WIDTH_RANGE !== 'undefined') { | |
return '['+ctx.getParameter(ctx.ALIASED_LINE_WIDTH_RANGE)+']'; | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLAliasedPointSizeRange() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.ALIASED_POINT_SIZE_RANGE !== 'undefined') { | |
return '['+ctx.getParameter(ctx.ALIASED_POINT_SIZE_RANGE)+']'; | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxFragmentUniformVectors() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_FRAGMENT_UNIFORM_VECTORS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_FRAGMENT_UNIFORM_VECTORS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTextureImageUnits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_TEXTURE_IMAGE_UNITS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TEXTURE_IMAGE_UNITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxFragmentUniformComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_FRAGMENT_UNIFORM_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_FRAGMENT_UNIFORM_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxFragmentUniformBlocks() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_FRAGMENT_UNIFORM_BLOCKS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_FRAGMENT_UNIFORM_BLOCKS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxFragmentInputComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_FRAGMENT_INPUT_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_FRAGMENT_INPUT_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMinProgramTexelOffset() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MIN_PROGRAM_TEXEL_OFFSET !== 'undefined') { | |
return ctx.getParameter(ctx.MIN_PROGRAM_TEXEL_OFFSET); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxProgramTexelOffset() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_PROGRAM_TEXEL_OFFSET !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_PROGRAM_TEXEL_OFFSET); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxDrawBuffers() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_DRAW_BUFFERS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_DRAW_BUFFERS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxColorAttachments() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_COLOR_ATTACHMENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_COLOR_ATTACHMENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxSamples() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_SAMPLES !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_SAMPLES); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLRedBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.RED_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.RED_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLGreenBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.GREEN_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.GREEN_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBlueBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.BLUE_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.BLUE_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLAlphaBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.ALPHA_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.ALPHA_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLDepthBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.DEPTH_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.DEPTH_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLStencilBits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.STENCIL_BITS !== 'undefined') { | |
return ctx.getParameter(ctx.STENCIL_BITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxRenderbufferSize() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_RENDERBUFFER_SIZE !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_RENDERBUFFER_SIZE); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxViewportDims() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_VIEWPORT_DIMS !== 'undefined') { | |
return '['+ctx.getParameter(ctx.MAX_VIEWPORT_DIMS)+']'; | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTextureSize() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_TEXTURE_SIZE !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TEXTURE_SIZE); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxCubeMapTextureSize() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_CUBE_MAP_TEXTURE_SIZE !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_CUBE_MAP_TEXTURE_SIZE); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxCombinedTextureImageUnits() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
if(ctx && typeof ctx.MAX_COMBINED_TEXTURE_IMAGE_UNITS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_COMBINED_TEXTURE_IMAGE_UNITS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMax3DTextureSize() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_3D_TEXTURE_SIZE !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_3D_TEXTURE_SIZE); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxArrayTextureLayers() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_ARRAY_TEXTURE_LAYERS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_ARRAY_TEXTURE_LAYERS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxTextureLodBias() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_TEXTURE_LOD_BIAS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_TEXTURE_LOD_BIAS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxUniformBufferBindings() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_UNIFORM_BUFFER_BINDINGS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_UNIFORM_BUFFER_BINDINGS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxUniformBlockSize() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_UNIFORM_BLOCK_SIZE !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_UNIFORM_BLOCK_SIZE); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLUniformBufferOffsetAlignment() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.UNIFORM_BUFFER_OFFSET_ALIGNMENT !== 'undefined') { | |
return ctx.getParameter(ctx.UNIFORM_BUFFER_OFFSET_ALIGNMENT); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxCombinedUniformBlocks() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_COMBINED_UNIFORM_BLOCKS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_COMBINED_UNIFORM_BLOCKS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxCombinedVertexUniformComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLMaxCombinedFragmentUniformComponents() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
if(ctx && typeof ctx.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS !== 'undefined') { | |
return ctx.getParameter(ctx.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS); | |
} else { | |
return 'Not supported.'; | |
} | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLBasicMaxTextureMaxAnisotropyExt() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); | |
var td_b1 = ctx.getExtension("EXT_texture_filter_anisotropic") || ctx.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || ctx.getExtension("MOZ_EXT_texture_filter_anisotropic"); | |
var td_X8 = ''; | |
if (td_b1) { | |
td_X8 = ctx.getParameter(td_b1.MAX_TEXTURE_MAX_ANISOTROPY_EXT); | |
if (td_X8 === 0) { | |
td_X8 = 2; | |
} | |
} else { | |
td_X8 = "Not supported"; | |
} | |
return td_X8; | |
} | |
catch(e) { | |
return 'Not supported.'; | |
} | |
} | |
function getSupportExtensions() { | |
try { | |
return JSON.stringify(document.createElement("canvas").getContext("webgl").getSupportedExtensions()) | |
} catch (e) { | |
return 'Not supported.'; | |
} | |
} | |
function getIntPrecision() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
return JSON.stringify(ctx.getShaderPrecisionFormat(ctx.FRAGMENT_SHADER, ctx.HIGH_INT)) | |
} catch (e) { | |
return 'Not supported.'; | |
} | |
} | |
function getBestFloatPrecision() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
return JSON.stringify(ctx.getShaderPrecisionFormat(ctx.VERTEX_SHADER, ctx.HIGH_FLOAT)) | |
} catch (e) { | |
return 'Not supported.'; | |
} | |
} | |
function getWebGLAliasing() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
return JSON.stringify(ctx.getContextAttributes().antialias) | |
} catch (e) { | |
return 'Not supported.'; | |
} | |
} | |
//marker_check_error | |
function getWebGLAngle() { | |
try { | |
var canvas = document.createElement('canvas'); | |
var ctx = canvas.getContext("webgl2") || canvas.getContext("experimental-webgl2"); | |
function t(e) { | |
return 0 !== e && 0 == (e & e - 1) | |
} | |
var r = (ctx.getParameter(ctx.ALIASED_LINE_WIDTH_RANGE)); | |
var res = "Win32" !== navigator.platform && "Win64" !== navigator.platform || "Internet Explorer" === ctx.getParameter(ctx.RENDERER) || "Microsoft Edge" === ctx.getParameter(ctx.RENDERER) || r !== O([1, 1]) ? "False" : t(ctx.getParameter(ctx.MAX_VERTEX_UNIFORM_VECTORS)) && t(ctx.getParameter(ctx.MAX_FRAGMENT_UNIFORM_VECTORS)) ? "True, Direct3D 11" : "True, Direct3D 9" | |
return res | |
} catch (e) { | |
return 'Not supported.'; | |
} | |
} | |
function getSystemColorsCodes() { | |
var e = document.createElement("div"), | |
t = '', | |
a = ["ActiveBorder", "ActiveCaption", "AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow", "ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText", "InactiveBorder", "InactiveCaption", "InactiveCaptionText", "InfoBackground", "InfoText", "Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow", "ThreeDFace", "ThreeDHighlight", "ThreeDLightShadow", "ThreeDShadow", "Window", "WindowFrame", "WindowText"]; | |
if(!window.getComputedStyle) return t; | |
for(var i = 0; i < a.length; i++) { | |
document.body.appendChild(e); | |
e.style.color = a[i]; | |
t += a[i]+'='+window.getComputedStyle(e).getPropertyValue("color")+';'; | |
document.body.removeChild(e); | |
} | |
return t; | |
} | |
function safeParseJSON(s) { | |
try { | |
return JSON.parse(s); | |
} catch (error) { | |
return false; | |
} | |
} | |
function getInstalledAlphabets() { | |
var names = safeParseJSON('[ "Latin", "Chinese", "Arabic", "Devanagari", "Cyrillic", "Bengali/Assamese", "Kana", "Gurmukhi", "Javanese", "Hangul", "Telugu", "Tamil", "Malayalam", "Burmese", "Thai", "Sundanese", "Kannada", "Gujarati", "Lao", "Odia", "Ge-ez", "Sinhala", "Armenian", "Khmer", "Greek", "Lontara", "Hebrew", "Tibetan", "Georgian", "Modern Yi", "Mongolian", "Tifinagh", "Syriac", "Thaana", "Inuktitut", "Cherokee" ]'); | |
var codes = safeParseJSON("[[76,97,116,105,110], [27721,23383], [1575,1604,1593,1585,1576,1610,1577], [2342,2375,2357,2344,2366,2327,2352,2368], [1050,1080,1088,1080,1083,1080,1094,1072], [2476,2494,2434,2482,2494,2437,2488,2478,2496,2479,2492,2494], [20206,21517], [2583,2625,2608,2606,2625,2582,2624], [43415,43438], [54620,44544], [3108,3142,3122,3137,3095,3137], [2980,2990,3007,2996,3021], [3374,3378,3375,3390,3379,3330], [4121,4156,4116,4154,4121,4140], [3652,3607,3618], [7070,7077,7060,7082,7059], [3221,3240,3277,3240,3233], [2711,2753,2716,2736,2750,2724,2752], [3749,3762,3751], [2825,2852,2893,2837,2867], [4877,4821,4829], [3523,3538,3458,3524,3517], [1344,1377,1397,1400,1409], [6017,6098,6040,6082,6042], [917,955,955,951,957,953,954,972], [6674,6682,6664,6673], [1488,1500,1508,1489,1497,1514], [3926,3964,3921,3851], [4325,4304,4320,4311,4323,4314,4312], [41352,41760], [6190,6179,6185,6189,6179,6191], [11612,11593,11580,11593,11599,11568,11606], [1808,1834,1825,1821,1808], [1931,1960,1928,1964,1920,1960], [5123,5316,5251,5198,5200,5222], [5091,5043,5033], [55295, 7077]]"); | |
var fontSize = 9; | |
var fontFace = "Verdana"; | |
var extraHeigth = 15; | |
var results = []; | |
var c, code, h, height, i, j, k, l, len, len1, len2, len3, len4, len5, len6, len7, m, n, o, p, ref, ref1, ref2, ref3, round, s, w, width; | |
round = 0; | |
var widths = []; | |
var heights = []; | |
var support = []; | |
var test_div = document.createElement("div"); | |
document.body.appendChild(test_div); | |
test_div.id = "WritingTest"; | |
ref = codes; | |
for (i = 0, len = ref.length; i < len; i++) { | |
code = ref[i]; | |
height = []; | |
width = []; | |
var div = document.createElement("div"); | |
test_div.appendChild(div); | |
round += 1; | |
div.id = round; | |
div.style.display = "inline-block"; | |
for (j = 0, len1 = code.length; j < len1; j++) { | |
c = code[j]; | |
div.innerHTML = ("<font face = '" + fontFace + "' size = ") + fontSize + ">&#" + c + "</font>"; | |
height.push(document.getElementById(round).clientHeight); | |
width.push(document.getElementById(round).clientWidth); | |
} | |
div.innerHTML = ""; | |
for (k = 0, len2 = code.length; k < len2; k++) { | |
c = code[k]; | |
div.innerHTML += ("<font face = '" + fontFace + "' size = ") + fontSize + ">&#" + c + "</font>"; | |
} | |
test_div.innerHTML += height + ";" + width + "<br>"; | |
heights.push(height); | |
widths.push(width); | |
} | |
var tw = widths.pop(); | |
var sw1 = tw[0]; | |
var sw2 = tw[1]; | |
var sh = heights.pop()[0]; | |
ref1 = heights; | |
for (l = 0, len3 = ref1.length; l < len3; l++) { | |
height = ref1[l]; | |
var passed = 0; | |
for (m = 0, len4 = height.length; m < len4; m++) { | |
h = height[m]; | |
if (h !== sh) { | |
support.push(true); | |
passed = 1; | |
break; | |
} | |
} | |
if (passed === 0) { | |
support.push(false); | |
} | |
} | |
var writing_scripts_index = 0; | |
ref2 = widths; | |
for (n = 0, len5 = ref2.length; n < len5; n++) { | |
width = ref2[n]; | |
for (o = 0, len6 = width.length; o < len6; o++) { | |
w = width[o]; | |
if (support[writing_scripts_index] === false) { | |
if (w !== sw1 && w !== sw2) { | |
support[writing_scripts_index] = true; | |
} | |
} | |
} | |
writing_scripts_index += 1; | |
} | |
var res = []; | |
var writing_scripts_index = 0; | |
ref3 = support; | |
for (p = 0, len7 = ref3.length; p < len7; p++) { | |
s = ref3[p]; | |
test_div.innerHTML += names[writing_scripts_index] + ": " + s + " <br>"; | |
if (s === true) { | |
res.push(names[writing_scripts_index]); | |
} | |
writing_scripts_index += 1; | |
} | |
//test_div.remove(); // HTMLDivElement has no method remove | |
test_div.parentNode.removeChild(test_div); | |
//console.log(res); | |
return res; | |
} | |
function getFontSmoothing() { | |
var strFontSmoothing = false, canvasNode, ctx, imageData, alpha; | |
if (typeof(screen.fontSmoothingEnabled) !== "undefined") { | |
strFontSmoothing = screen.fontSmoothingEnabled; | |
} else { | |
try { | |
fontsmoothing = "false"; | |
canvasNode = document.createElement('canvas'); | |
canvasNode.width = "35"; | |
canvasNode.height = "35"; | |
canvasNode.style.display = 'none'; | |
document.body.appendChild(canvasNode); | |
ctx = canvasNode.getContext('2d'); | |
ctx.textBaseline = "top"; | |
ctx.font = "32px Arial"; | |
ctx.fillStyle = "black"; | |
ctx.strokeStyle = "black"; | |
ctx.fillText("O", 0, 0); | |
for (var j = 8; j <= 32; j = j + 1) { | |
for (var i = 1; i <= 32; i = i + 1) { | |
imageData = ctx.getImageData(i, j, 1, 1).data; | |
alpha = imageData[3]; | |
//console.log(alpha); | |
if (alpha !== 255 && alpha !== 0) { | |
strFontSmoothing = true; | |
} | |
} | |
} | |
} catch (err) {} | |
} | |
//console.log(strFontSmoothing); | |
return strFontSmoothing; | |
} | |
function getPngEtag() { | |
window.pngEtag = ""; | |
var canvas = document.createElement("canvas"), img, ctx, pngData = ""; | |
canvas.style.visibility = "hidden"; | |
canvas.style.position = "absolute"; | |
canvas.width = 200; | |
canvas.height = 1; | |
if (canvas && canvas.getContext) { | |
img = new Image(); | |
img.style.visibility = "hidden"; | |
img.style.position = "absolute"; | |
ctx = canvas.getContext("2d"); | |
img.onload = function() { | |
ctx.drawImage(img, 0, 0); | |
// get CanvasPixelArray from given coordinates and dimensions | |
var imgd = ctx.getImageData(0, 0, 200, 1), | |
pix = imgd.data, | |
i, n; | |
// loop over each pixel to get the "RGB" values (ignore alpha) | |
for (i = 0, n = pix.length; i < n; i += 4) { | |
if (pix[i] === 0) { | |
break; | |
} | |
pngData += String.fromCharCode(pix[i]); | |
if (pix[i + 1] === 0) { | |
break; | |
} | |
pngData += String.fromCharCode(pix[i + 1]); | |
if (pix[i + 2] === 0) { | |
break; | |
} | |
pngData += String.fromCharCode(pix[i + 2]); | |
} | |
//console.log(pngData); | |
window.pngEtag = pngData; | |
window.fpStepPngEtagComplete = true; | |
fpStepComplete(); | |
}; | |
//img.crossOrigin = 'Anonymous'; | |
img.src = "etag.png"; | |
} | |
} | |
function catchErrorFunc(e) { | |
//console.log('line='+e.lineNumber+' col='+e.columnNumber+' msg='+e.message); | |
//sendCaughtError('name='+e.name+' line='+e.lineNumber+' col='+e.columnNumber+' msg='+e.message); | |
console.log('name='+e.name+' msg='+e.message+' stack='+e.stack); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment