Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var sr_validate = {
  2.     smrTime: new Date(2005, 0, 15).getTimezoneOffset(),
  3.     wntrTime: new Date(2005, 6, 15).getTimezoneOffset(),
  4.     comps: [],
  5.     activeX: {
  6.         "Flash": ["ShockwaveFlash.ShockwaveFlash", function (ax) {
  7.             return ax.getVariable("$version");
  8.         }],
  9.         "Director": ["SWCtl.SWCtl", function (ax) {
  10.             return ax.ShockwaveVersion("");
  11.         }]
  12.     },
  13.     comp: null,
  14.     setDoc: function (element) {
  15.         var rslt = null;
  16.         try {
  17.             rslt = document.getElementById(element);
  18.         } catch (e) {}
  19.         if (rslt === null || typeof (rslt) == 'undefined') {
  20.             try {
  21.                 rslt = document.getElementsByName(element)[0];
  22.             } catch (e1) {}
  23.         }
  24.         if (rslt === null || typeof (rslt) == 'undefined') {
  25.             for (var x = 0; x < document.forms.length; x++) {
  26.                 var currForm = document.forms[x];
  27.                 for (var y = 0; y < currForm.elements.length; y++) {
  28.                     var currElement = currForm[y];
  29.                     if (currElement.name == element || currElement.id == element) {
  30.                         return currElement;
  31.                     }
  32.                 }
  33.             }
  34.         }
  35.         return rslt;
  36.     },
  37.     evl: function (id) {
  38.         var rslt = "";
  39.         try {
  40.             if (typeof (this.comp.getComponentVersion) != 'undefined') {
  41.                 rslt = this.comp.getComponentVersion(id, "ComponentID");
  42.             }
  43.         } catch (e) {
  44.             var len = e.message.length;
  45.             len = (len > 40 ? 40 : len);
  46.             rslt = escape(e.message.substr(0, len));
  47.         }
  48.         return rslt;
  49.     },
  50.     exec: function (possibles) {
  51.         for (var i = 0; i < possibles.length; i++) {
  52.             try {
  53.                 var val = eval(possibles[i]);
  54.                 if (val) {
  55.                     return val;
  56.                 }
  57.             } catch (e) {}
  58.         }
  59.         return "";
  60.     },
  61.     loadComp: function (name) {
  62.         var version = "";
  63.         try {
  64.             if (navigator.plugins && navigator.plugins.length) {
  65.                 var regex = new RegExp(name + ".* ([0-9._]+)");
  66.                 for (var j = 0; j < navigator.plugins.length; j++) {
  67.                     var match = regex.exec(navigator.plugins[j].name);
  68.                     if (match === null) {
  69.                         match = regex.exec(navigator.plugins[j].description);
  70.                     }
  71.                     if (match) {
  72.                         version = match[1];
  73.                     }
  74.                 }
  75.             } else if (window.ActiveXObject && sr_validate.activeX[name]) {
  76.                 try {
  77.                     var ax = new ActiveXObject(sr_validate.activeX[name][0]);
  78.                     version = sr_validate.activeX[name][1](ax);
  79.                 } catch (e1) {
  80.                     version = "";
  81.                 }
  82.             }
  83.         } catch (e) {
  84.             version = e.message;
  85.         }
  86.         return version;
  87.     },
  88.     loadComps: function () {
  89.         var comps = ["Acrobat", "Flash", "QuickTime", "Java Plug-in", "Director", "Office"];
  90.         for (var i = 0; i < comps.length; i++) {
  91.             var name = comps[i];
  92.             sr_validate.comps[name] = sr_validate.loadComp(name);
  93.         }
  94.     },
  95.     getTimeZn: function () {
  96.         return Math.abs(this.smrTime - this.wntrTime);
  97.     },
  98.     isSummer: function () {
  99.         return (this.getTimeZn() !== 0);
  100.     },
  101.     isWinter: function (date) {
  102.         var minOffset = Math.min(this.smrTime, this.wntrTime);
  103.         return (this.isSummer() && date.getTimezoneOffset() == minOffset);
  104.     },
  105.     getDayOfYr: function (str) {
  106.         var result = 0;
  107.         var latencyFactor = 0;
  108.         if (this.isWinter(str)) {
  109.             latencyFactor = this.getTimeZn();
  110.         }
  111.         result = -(str.getTimezoneOffset() + latencyFactor) / 60.0;
  112.         return result;
  113.     },
  114.     replaceString: function (s, a, b, global) {
  115.         if (typeof (global) != 'boolean') {
  116.             global = false;
  117.         }
  118.         var first = true;
  119.         var i;
  120.         while ((i = s.indexOf(a)) >= 0 && (global || first)) {
  121.             s = s.substr(0, i) + b + s.substr(i + a.length);
  122.             first = false;
  123.         }
  124.         return s;
  125.     },
  126.     currDate: function () {
  127.         return new Date(2005, 5, 7, 21, 33, 44, 888).toLocaleString();
  128.     },
  129.     userPrefs: function (debug) {
  130.         this.debug = debug;
  131.         var str = new Date();
  132.         var arr = ["\"TF1\"", "\"015\"", "ScriptEngineMajorVersion()", "ScriptEngineMinorVersion()", "ScriptEngineBuildVersion()", "sr_validate.evl('{7790769C-0471-11D2-AF11-00C04FA35D02}')", "sr_validate.evl('{89820200-ECBD-11CF-8B85-00AA005B4340}')", "sr_validate.evl('{283807B5-2C60-11D0-A31D-00AA00B92C03}')", "sr_validate.evl('{4F216970-C90C-11D1-B5C7-0000F8051515}')", "sr_validate.evl('{44BBA848-CC51-11CF-AAFA-00AA00B6015C}')", "sr_validate.evl('{9381D8F2-0288-11D0-9501-00AA00B911A5}')", "sr_validate.evl('{4F216970-C90C-11D1-B5C7-0000F8051515}')", "sr_validate.evl('{5A8D6EE0-3E18-11D0-821E-444553540000}')", "sr_validate.evl('{89820200-ECBD-11CF-8B85-00AA005B4383}')", "sr_validate.evl('{08B0E5C0-4FCB-11CF-AAA5-00401C608555}')", "sr_validate.evl('{45EA75A0-A269-11D1-B5BF-0000F8051515}')", "sr_validate.evl('{DE5AED00-A4BF-11D1-9948-00C04F98BBC9}')", "sr_validate.evl('{22D6F312-B0F6-11D0-94AB-0080C74C7E95}')", "sr_validate.evl('{44BBA842-CC51-11CF-AAFA-00AA00B6015B}')", "sr_validate.evl('{3AF36230-A269-11D1-B5BF-0000F8051515}')", "sr_validate.evl('{44BBA840-CC51-11CF-AAFA-00AA00B6015C}')", "sr_validate.evl('{CC2A9BA0-3BDD-11D0-821E-444553540000}')", "sr_validate.evl('{08B0E5C0-4FCB-11CF-AAA5-00401C608500}')", "navigator.appCodeName", "navigator.appName", "navigator.appVersion", "sr_validate.exec(['navigator.productSub','navigator.appMinorVersion'])", "navigator.browserLanguage", "navigator.cookieEnabled", "sr_validate.exec(['navigator.oscpu','navigator.cpuClass'])", "navigator.onLine", "navigator.platform", "navigator.systemLanguage", "navigator.userAgent", "sr_validate.exec(['navigator.language','navigator.userLanguage'])", "document.defaultCharset", "document.domain", "screen.deviceXDPI", "screen.deviceYDPI", "screen.fontSmoothingEnabled", "screen.updateInterval", "sr_validate.isSummer()", "sr_validate.isWinter(str)", "'@UTC@'", "sr_validate.getDayOfYr(str)", "sr_validate.currDate()", "screen.width", "screen.height", "sr_validate.comps['Acrobat']", "sr_validate.comps['Flash']", "sr_validate.comps['QuickTime']", "sr_validate.comps['Java Plug-in']", "sr_validate.comps['Director']", "sr_validate.comps['Office']", "(new Date().getTime()) - str.getTime()", "sr_validate.smrTime", "sr_validate.wntrTime", "str.toLocaleString()", "screen.colorDepth", "window.screen.availWidth", "window.screen.availHeight", "window.screen.availLeft", "window.screen.availTop", "sr_validate.compN('Acrobat')", "sr_validate.compN('Adobe SVG')", "sr_validate.compN('Authorware')", "sr_validate.compN('Citrix ICA')", "sr_validate.compN('Director')", "sr_validate.compN('Flash')", "sr_validate.compN('MapGuide')", "sr_validate.compN('MetaStream')", "sr_validate.compN('PDFViewer')", "sr_validate.compN('QuickTime')", "sr_validate.compN('RealOne')", "sr_validate.compN('RealPlayer Enterprise')", "sr_validate.compN('RealPlayer Plugin')", "sr_validate.compN('Seagate Software Report')", "sr_validate.compN('Silverlight')", "sr_validate.compN('Windows Media')", "sr_validate.compN('iPIX')", "sr_validate.compN('nppdf.so')", "sr_validate.getFontHeight()"];
  133.         sr_validate.loadComps();
  134.         this.rslt = "";
  135.         for (var i = 0; i < arr.length; i++) {
  136.             if (this.debug) {
  137.                 this.rslt += sr_validate.replaceString(arr[i], '"', "'", true);
  138.                 this.rslt += "=";
  139.             }
  140.             var tmp = null;
  141.             try {
  142.                 tmp = eval(arr[i]);
  143.             } catch (e) {
  144.                 tmp = "";
  145.             }
  146.             this.rslt += (this.debug ? tmp : escape(tmp));
  147.             this.rslt += ";";
  148.             if (this.debug) {
  149.                 this.rslt += "\\n";
  150.             }
  151.         }
  152.         this.rslt = sr_validate.replaceString(this.rslt, escape('@UTC@'), new Date().getTime());
  153.         this.encodeData = new Function("return '" + this.rslt + "'");
  154.     },
  155.     load_data: function (name) {
  156.         try {
  157.             var element = null;
  158.             element = this.setDoc(name);
  159.             if (element === null) {
  160.                 return;
  161.             }
  162.             try {
  163.                 var prefs = new this.userPrefs();
  164.                 element.value = prefs.encodeData();
  165.             } catch (e1) {
  166.                 element.value = escape(e1.message);
  167.             }
  168.         } catch (e) {}
  169.     },
  170.     compN: function (name) {
  171.         try {
  172.             if (navigator.plugins && navigator.plugins.length) {
  173.                 for (var i = 0; i < navigator.plugins.length; i++) {
  174.                     var plugin = navigator.plugins[i];
  175.                     if (plugin.name.indexOf(name) >= 0) {
  176.                         return plugin.name + ((plugin.description) ? '|' + plugin.description : '');
  177.                     }
  178.                 }
  179.             }
  180.         } catch (e) {}
  181.         return '';
  182.     },
  183.     getFontHeight: function () {
  184.         var span = document.createElement('span');
  185.         span.innerHTML = '&nbsp;';
  186.         span.style.position = "absolute";
  187.         span.style.left = "-9999px";
  188.         document.body.appendChild(span);
  189.         var height = span.offsetHeight;
  190.         document.body.removeChild(span);
  191.         return height;
  192.     }
  193. };
  194. try {
  195.     sr_validate.comp = document.createElement("span");
  196.     if (typeof (sr_validate.comp.addBehavior) != 'undefined') {
  197.         sr_validate.comp.addBehavior("#default#clientCaps");
  198.     }
  199. } catch (e) {}
  200.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement