SHARE
TWEET

RSI Tracker

a guest May 7th, 2015 516 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.     Turbulent = window.Turbulent || {};
  3.     Turbulent.Mark = Turbulent.Object.extend({
  4.         tokenName: "xsrf-token",
  5.         tokenTtl: 300,
  6.         tokenValue: null,
  7.         data: null,
  8.         init: function(params) {
  9.             this._super(params);
  10.             if (params) {
  11.                 this.tokenName = params.name;
  12.                 this.tokenValue = params.token;
  13.                 this.tokenTtl = params.ttl;
  14.                 this.refresh();
  15.             }
  16.         },
  17.         refresh: function() {
  18.             var token = $.cookie(this.tokenName);
  19.             if (token) {
  20.                 var time = parseInt(token.substring(token.lastIndexOf(":") + 1));
  21.                 if (time > (new Date()).getTime())
  22.                     return;
  23.             }
  24.             var ttl = (new Date()).getTime() + this.tokenTtl * 1000;
  25.             $.cookie(this.tokenName, this.tokenValue + ':' + this.generate() + ':' + ttl, {
  26.                 'path': '/'
  27.             });
  28.         },
  29.         generate: function(raw) {
  30.             if (!this.data) {
  31.                 var nav = this.getNavigatorProperties();
  32.                 this.data = {
  33.                     'mode': document.documentMode,
  34.                     'navigator': nav,
  35.                     'screen': this.getScreenProperties(),
  36.                     'colors': this.getSystemColors(),
  37.                     'timezone': (new Date()).getTimezoneOffset(),
  38.                     'plugins': (window.ActiveXObject ? this.getIEActiveX() : this.getPlugins()),
  39.                     'canvas2d': nav.canvas2d ? this.getCanvasMark() : null,
  40.                     'canvasWebgl': nav.canvasWebgl ? this.getWebglMark() : null,
  41.                     'fonts': !nav.canvas2d ? this.getFonts() : null
  42.                 };
  43.             }
  44.             return raw ? JSON.stringify(this.data) : b64_md5(JSON.stringify(this.data));
  45.         },
  46.         hash: function(key, seed) {
  47.             var remainder, bytes, h1, h1b, c1, c2, k1, i;
  48.             remainder = key.length & 3;
  49.             bytes = key.length - remainder;
  50.             h1 = seed;
  51.             c1 = 0xcc9e2d51;
  52.             c2 = 0x1b873593;
  53.             i = 0;
  54.             while (i < bytes) {
  55.                 k1 = ((key.charCodeAt(i) & 0xff)) | ((key.charCodeAt(++i) & 0xff) << 8) | ((key.charCodeAt(++i) & 0xff) << 16) | ((key.charCodeAt(++i) & 0xff) << 24);
  56.                 ++i;
  57.                 k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  58.                 k1 = (k1 << 15) | (k1 >>> 17);
  59.                 k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  60.                 h1 ^= k1;
  61.                 h1 = (h1 << 13) | (h1 >>> 19);
  62.                 h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  63.                 h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  64.             }
  65.             k1 = 0;
  66.             switch (remainder) {
  67.                 case 3:
  68.                     k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  69.                 case 2:
  70.                     k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  71.                 case 1:
  72.                     k1 ^= (key.charCodeAt(i) & 0xff);
  73.                     k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  74.                     k1 = (k1 << 15) | (k1 >>> 17);
  75.                     k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  76.                     h1 ^= k1;
  77.             }
  78.             h1 ^= key.length;
  79.             h1 ^= h1 >>> 16;
  80.             h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  81.             h1 ^= h1 >>> 13;
  82.             h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  83.             h1 ^= h1 >>> 16;
  84.             return h1 >>> 0;
  85.         },
  86.         getWebglMark: function() {
  87.             var canvas = document.createElement('canvas');
  88.             canvas.width = 100;
  89.             canvas.height = 100;
  90.             var gl = canvas.getContext('experimental-webgl', {
  91.                 antialias: true
  92.             });
  93.             if (!gl) return;
  94.             gl.viewport(0, 0, 100, 100);
  95.             var vertexShaderScript = 'attribute vec3 vertexPosition; uniform mat4 modelViewMatrix; uniform mat4 perspectiveMatrix; varying highp vec4 pos; void main(void) { gl_Position = perspectiveMatrix * modelViewMatrix * vec4(vertexPosition, 1.0); pos = gl_Position; }';
  96.             var vertexShader = gl.createShader(gl.VERTEX_SHADER);
  97.             gl.shaderSource(vertexShader, vertexShaderScript);
  98.             gl.compileShader(vertexShader);
  99.             if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
  100.                 gl.deleteShader(vertexShader);
  101.                 return;
  102.             }
  103.             var fragmentShaderScript = 'precision highp float; varying highp vec4 pos; void main(void) { float red = abs( sin( pos.x / pos.y * pos.z )); float green = abs( sin( pos.y * pos.x / pos.z )); float blue = abs( sin( pos.x * pos.y * pos.z )); gl_FragColor = vec4(red, green, blue, 0.9 ); }';
  104.             var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
  105.             gl.shaderSource(fragmentShader, fragmentShaderScript);
  106.             gl.compileShader(fragmentShader);
  107.             if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
  108.                 gl.deleteShader(fragmentShader);
  109.                 return;
  110.             }
  111.             gl.program = gl.createProgram();
  112.             gl.attachShader(gl.program, vertexShader);
  113.             gl.attachShader(gl.program, fragmentShader);
  114.             gl.linkProgram(gl.program);
  115.             if (!gl.getProgramParameter(gl.program, gl.LINK_STATUS)) {
  116.                 gl.deleteProgram(gl.program);
  117.                 gl.deleteProgram(vertexShader);
  118.                 gl.deleteProgram(fragmentShader);
  119.                 return;
  120.             }
  121.             gl.useProgram(gl.program);
  122.             var vertexPosition = gl.getAttribLocation(gl.program, "vertexPosition");
  123.             gl.enableVertexAttribArray(vertexPosition);
  124.             gl.clearColor(255.0, 255.0, 255.0, 0.0);
  125.             gl.clearDepth(1.0);
  126.             gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
  127.             gl.enable(gl.BLEND);
  128.             var vertexBuffer = gl.createBuffer();
  129.             gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
  130.             var vertices = new Float32Array([-0.9, -1.9, 5.9, -1.2, 2.9, 6.9, 1.5, -1.3, 6.9, -1.0, 0.0, 4.0, 1.3, 1.5, 4.0, 1.5, -1.1, 5.0]);
  131.             gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
  132.             gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
  133.             var perspectiveMatrix = [7.59575411272, 0, 0, 1, 0, 7.59575411272, 0, 1, 0, 0, 1.00020002000, 1.00020002000, 0, 0, -1, 0];
  134.             var modelViewMatrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
  135.             var vertexPosAttribLocation = gl.getAttribLocation(gl.program, "vertexPosition");
  136.             gl.vertexAttribPointer(vertexPosAttribLocation, 3.0, gl.FLOAT, false, 0, 0);
  137.             var uModelViewMatrix = gl.getUniformLocation(gl.program, "modelViewMatrix");
  138.             var uPerspectiveMatrix = gl.getUniformLocation(gl.program, "perspectiveMatrix");
  139.             gl.uniformMatrix4fv(uModelViewMatrix, false, new Float32Array(perspectiveMatrix));
  140.             gl.uniformMatrix4fv(uPerspectiveMatrix, false, new Float32Array(modelViewMatrix));
  141.             gl.drawArrays(gl.TRIANGLES, 0, vertices.length / 3.0);
  142.             gl.flush();
  143.             return this.hash(canvas.toDataURL(), 7);
  144.         },
  145.         fonts: ["Abadi MT Condensed Light", "Adobe Fangsong Std", "Adobe Hebrew", "Adobe Ming Std", "Agency FB", "Arab", "Arabic Typesetting", "Arial Black", "Batang", "Bauhaus 93", "Bell MT", "Bitstream Vera Serif", "Bodoni MT", "Bookman Old Style", "Braggadocio", "Broadway", "Calibri", "Californian FB", "Castellar", "Casual", "Centaur", "Century Gothic", "Chalkduster", "Colonna MT", "Copperplate Gothic Light", "DejaVu LGC Sans Mono", "Desdemona", "DFKai-SB", "Dotum", "Engravers MT", "Eras Bold ITC", "Eurostile", "FangSong", "Forte", "Franklin Gothic Heavy", "French Script MT", "Gabriola", "Gigi", "Gisha", "Goudy Old Style", "Gulim", "GungSeo", "Haettenschweiler", "Harrington", "Hiragino Sans GB", "Impact", "Informal Roman", "KacstOne", "Kino MT", "Kozuka Gothic Pr6N", "Lohit Gujarati", "Loma", "Lucida Bright", "Lucida Fax", "Magneto", "Malgun Gothic", "Matura MT Script Capitals", "Menlo", "MingLiU-ExtB", "MoolBoran", "MS PMincho", "MS Reference Sans Serif", "News Gothic MT", "Niagara Solid", "Nyala", "Palace Script MT", "Papyrus", "Perpetua", "Playbill", "PMingLiU", "Rachana", "Rockwell", "Sawasdee", "Script MT Bold", "Segoe Print", "Showcard Gothic", "SimHei", "Snap ITC", "TlwgMono", "Tw Cen MT Condensed Extra Bold", "Ubuntu", "Umpush", "Univers", "Utopia", "Vladimir Script", "Wide Latin"],
  146.         getCanvasMark: function() {
  147.             var canvas = document.createElement('canvas');
  148.             canvas.width = 100;
  149.             canvas.height = 100;
  150.             var ctx = canvas.getContext('2d');
  151.             if (!ctx) return;
  152.             ctx.textBaseline = "top";
  153.             ctx.textBaseline = "alphabetic";
  154.             ctx.fillStyle = "rgba(255, 0, 0, 0.3)";
  155.             ctx.fillRect(5, 5, 30, 30);
  156.             ctx.fillStyle = "rgba(0, 255, 0, 0.3)";
  157.             ctx.fillRect(65, 5, 30, 30);
  158.             ctx.fillStyle = "rgba(0, 0, 255, 0.3)";
  159.             ctx.fillRect(5, 65, 30, 30);
  160.             ctx.fillStyle = "rgba(255, 0, 255, 0.3)";
  161.             ctx.fillRect(65, 65, 30, 30);
  162.             ctx.fillStyle = "rgba(255, 255, 0, 0.3)";
  163.             ctx.fillRect(25, 25, 30, 50);
  164.             ctx.fillStyle = "rgba(0, 255, 255, 0.3)";
  165.             ctx.fillRect(45, 25, 30, 50);
  166.             for (var y = 0; y < this.fonts.length; y++) {
  167.                 ctx.font = "18px '" + this.fonts[y] + "', sans-serif";
  168.                 ctx.fillStyle = "rgba(" + (y % 10) * 25 + ", " + (255 - (y % 5) * 50) + ", " + (y % 5) * 50 + ", " + 1 / (y % 3 + 2) + ")";
  169.                 ctx.fillText(String.fromCharCode(y % 26 + 97), (y % 9) * 10 + 4, (y % 10) * 10 + 10);
  170.             }
  171.             return this.hash(canvas.toDataURL(), 7);
  172.         },
  173.         getFonts: function() {
  174.             var baseFonts = ["monospace", "sans-serif", "serif"];
  175.             var h = document.body;
  176.             var s = document.createElement("span");
  177.             var defaultWidth = {};
  178.             var defaultHeight = {};
  179.             s.style.fontSize = "72px";;
  180.             s.innerHTML = "WwMmNnOoLlIi";
  181.             for (var i = 0; i < baseFonts.length; i++) {
  182.                 s.style.fontFamily = baseFonts[i];
  183.                 h.appendChild(s);
  184.                 defaultWidth[baseFonts[i]] = s.offsetWidth;
  185.                 defaultHeight[baseFonts[i]] = s.offsetHeight;
  186.                 h.removeChild(s);
  187.             }
  188.             var found = [];
  189.             for (var i = 0; i < this.fonts.length; i++) {
  190.                 var detected = false;
  191.                 for (var j = 0; j < baseFonts.length; j++) {
  192.                     s.style.fontFamily = this.fonts[i] + "," + baseFonts[j];
  193.                     h.appendChild(s);
  194.                     detected = (s.offsetWidth != defaultWidth[baseFonts[j]] || s.offsetHeight != defaultHeight[baseFonts[j]]);
  195.                     h.removeChild(s);
  196.                     if (detected)
  197.                         break;
  198.                 }
  199.                 if (detected)
  200.                     found.push(this.fonts[i]);
  201.             }
  202.             return found;
  203.         },
  204.         getPlugins: function() {
  205.             var plugins = ["4game", "AdblockPlugin", "AdobeExManCCDetect", "AdobeExManDetect", "Alawar NPAPI utils", "Aliedit Plug-In", "Alipay Security Control 3", "AliSSOLogin plugin", "AmazonMP3DownloaderPlugin", "AOL Media Playback Plugin", "AppUp", "ArchiCAD", "AVG SiteSafety plugin", "Babylon ToolBar", "Battlelog Game Launcher", "BitCometAgent", "Bitdefender QuickScan", "BlueStacks Install Detector", "CatalinaGroup Update", "Citrix ICA Client", "Citrix online plug-in", "Citrix Receiver Plug-in", "Coowon Update", "DealPlyLive Update", "Default Browser Helper", "DivX Browser Plug-In", "DivX Plus Web Player", "DivX VOD Helper Plug-in", "doubleTwist Web Plugin", "Downloaders plugin", "downloadUpdater", "eMusicPlugin DLM6", "ESN Launch Mozilla Plugin", "ESN Sonar API", "Exif Everywhere", "Facebook Plugin", "File Downloader Plug-in", "FileLab plugin", "FlyOrDie Games Plugin", "Folx 3 Browser Plugin", "FUZEShare", "GDL Object Web Plug-in 16.00", "GFACE Plugin", "Ginger", "Gnome Shell Integration", "Google Earth Plugin", "Google Earth Plug-in", "Google Gears 0.5.33.0", "Google Talk Effects Plugin", "Google Update", "Harmony Firefox Plugin", "Harmony Plug-In", "Heroes & Generals live", "HPDetect", "Html5 location provider", "IE Tab plugin", "iGetterScriptablePlugin", "iMesh plugin", "Kaspersky Password Manager", "LastPass", "LogMeIn Plugin 1.0.0.935", "LogMeIn Plugin 1.0.0.961", "Ma-Config.com plugin", "Microsoft Office 2013", "MinibarPlugin", "Native Client", "Nitro PDF Plug-In", "Nokia Suite Enabler Plugin", "Norton Identity Safe", "npAPI Plugin", "NPLastPass", "NPPlayerShell", "npTongbuAddin", "NyxLauncher", "Octoshape Streaming Services", "Online Storage plug-in", "Orbit Downloader", "Pando Web Plugin", "Parom.TV player plugin", "PDF integrado do WebKit", "PDF-XChange Viewer", "PhotoCenterPlugin1.1.2.2", "Picasa", "PlayOn Plug-in", "QQ2013 Firefox Plugin", "QQDownload Plugin", "QQMiniDL Plugin", "QQMusic", "RealDownloader Plugin", "Roblox Launcher Plugin", "RockMelt Update", "Safer Update", "SafeSearch", "Scripting.Dictionary", "SefClient Plugin", "Shell.UIHelper", "Silverlight Plug-In", "Simple Pass", "Skype Web Plugin", "SumatraPDF Browser Plugin", "Symantec PKI Client", "Tencent FTN plug-in", "Thunder DapCtrl NPAPI Plugin", "TorchHelper", "Unity Player", "Uplay PC", "VDownloader", "Veetle TV Core", "VLC Multimedia Plugin", "Web Components", "WebKit-integrierte PDF", "WEBZEN Browser Extension", "Wolfram Mathematica", "WordCaptureX", "WPI Detector 1.4", "Yandex Media Plugin", "Yandex PDF Viewer", "YouTube Plug-in", "zako"];
  206.             var plugin;
  207.             var seen = {};
  208.             var found = [];
  209.             for (var i = 0; i < navigator.plugins.length; i++) {
  210.                 plugin = navigator.plugins[i];
  211.                 seen[plugin.name] = true;
  212.                 found.push(this.getPluginProperties(plugin));
  213.             }
  214.             for (var i; i < plugins.length; i++) {
  215.                 if (!seen[plugins[i]] && (plugin = navigator.plugins[plugins[i]]))
  216.                     found.push(this.getPluginProperties(plugin));
  217.             }
  218.             return found;
  219.         },
  220.         getPluginProperties: function(plugin) {
  221.             var p = {
  222.                 'name': plugin.name,
  223.                 'filename': plugin.filename.toLowerCase(),
  224.                 'description': plugin.description
  225.             };
  226.             plugin.version !== void 0 && (p.version = plugin.version), p.mimeTypes = [];
  227.             for (var j = 0; plugin.length > j; j++) {
  228.                 var mime = plugin[j];
  229.                 p.mimeTypes.push({
  230.                     description: mime.description,
  231.                     suffixes: mime.suffixes,
  232.                     type: mime.type
  233.                 })
  234.             }
  235.             return p;
  236.         },
  237.         getIEActiveX: function() {
  238.             var plugins = ["AcroPDF.PDF", "Adodb.Stream", "AgControl.AgControl", "DevalVRXCtrl.DevalVRXCtrl.1", "MacromediaFlashPaper.MacromediaFlashPaper", "Msxml2.DOMDocument", "Msxml2.XMLHTTP", "PDF.PdfCtrl", "QuickTime.QuickTime", "QuickTimeCheckObject.QuickTimeCheck.1", "RealPlayer", "RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)", "RealVideo.RealVideo(tm) ActiveX Control (32-bit)", "rmocx.RealPlayer G2 Control", "Scripting.Dictionary", "Shell.UIHelper", "ShockwaveFlash.ShockwaveFlash", "SWCtl.SWCtl", "TDCCtl.TDCCtl", "WMPlayer.OCX"];
  239.             var found = [];
  240.             for (var i; i < plugins.length; i++) {
  241.                 try {
  242.                     var obj = new ActiveXObject(plugins[i]),
  243.                         p = {
  244.                             'name': plugins[i]
  245.                         };
  246.                     try {
  247.                         p.version = obj.GetVariable("$version")
  248.                     } catch (e) {}
  249.                     found.push(p);
  250.                 } catch (e) {}
  251.             }
  252.             return found;
  253.         },
  254.         getSystemColors: function() {
  255.             var elements = ["ActiveBorder", "ActiveCaption", "AppWorkspace", "Background", "ButtonFace", "ButtonHighlight", "ButtonShadow", "ButtonText", "CaptionText", "GrayText", "Highlight", "HighlightText", "InactiveBorder", "InactiveCaption", "InactiveCaptionText", "InfoBackground", "InfoText", "Menu", "MenuText", "Scrollbar", "ThreeDDarkShadow", "ThreeDFace", "ThreeDHighlight", "ThreeDLightShadow", "ThreeDShadow", "Window", "WindowFrame", "WindowText"];
  256.             var div = document.createElement("div");
  257.             var colors = {};
  258.             if (!window.getComputedStyle)
  259.                 return colors;
  260.             for (var i = 0; elements.length > i; i++) {
  261.                 document.body.appendChild(div);
  262.                 div.style.color = elements[i];
  263.                 colors[elements[i]] = window.getComputedStyle(div).getPropertyValue("color");
  264.                 document.body.removeChild(div);
  265.             }
  266.             return colors;
  267.         },
  268.         getScreenProperties: function() {
  269.             var screenProps = ["colorDepth", "deviceXPI", "height", "width"];
  270.             var props = {};
  271.             for (var i = 0; i < screenProps.length; i++) {
  272.                 if (screen[screenProps[i]])
  273.                     props[screenProps[i]] = screen[screenProps[i]];
  274.             }
  275.             return props;
  276.         },
  277.         getNavigatorProperties: function() {
  278.             var props = {};
  279.             var order = [];
  280.             for (var property in navigator) {
  281.                 if ("object" != typeof navigator[property] && "function" != typeof navigator[property]) {
  282.                     props[property] = navigator[property];
  283.                     order.push(property);
  284.                 }
  285.             }
  286.             props.enumerationOrder = order, props.javaEnabled = navigator.javaEnabled();
  287.             var canvas = document.createElement('canvas');
  288.             props.canvas2d = !!(canvas.getContext && canvas.getContext('2d'));
  289.             var canvas = document.createElement('canvas');
  290.             props.canvasWebgl = !!(canvas.getContext && canvas.getContext('experimental-webgl'));
  291.             try {
  292.                 props.taintEnabled = navigator.taintEnabled()
  293.             } catch (e) {}
  294.             try {
  295.                 props.localStorage = !!window.localStorage;
  296.             } catch (e) {
  297.                 props.localStorage = true;
  298.             }
  299.             try {
  300.                 props.sessionStorage = !!window.sessionStorage;
  301.             } catch (e) {
  302.                 props.sessionStorage = true;
  303.             }
  304.             try {
  305.                 document.createEvent("TouchEvent");
  306.                 props.touch = true;
  307.             } catch (e) {
  308.                 props.touch = false;
  309.             }
  310.             return props;
  311.         }
  312.     });
  313. })(jQuery);;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top