Kafeine

Detect

Jun 14th, 2015
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. var agt=navigator.userAgent.toLowerCase();
  2. var ie = (agt.indexOf("msie") != -1);
  3. var ns = (navigator.appName.indexOf("Netscape") != -1);
  4. var op = (navigator.appName.indexOf("Opera") != -1);
  5. var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
  6. var mac = (agt.indexOf("mac")!=-1);
  7.  
  8. if (ie && win)
  9. {
  10. pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl","Shockwave Director") + detectIE2("D27CDB6E-AE6D-11cf-96B8-444553540000","Shockwave Flash") + detectIE("rmocx.RealPlayerG2Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE2("760C4B83-E211-11D2-BF3E-00805FBE84A6","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader") + detectIE2("14E8BBD8-1D1C-4D56-A4DA-D20B75EB814E","Foxit Reader") + detectIE("JavaWebStart.isInstalled","Java");
  11. }
  12. if (ns || !win || op)
  13. {
  14. nse = "";
  15. for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
  16. pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Foxit Reader");
  17. pluginlist += navigator.javaEnabled() ? "Java," : "";
  18. }
  19.  
  20. function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))\</SCRIPT\>\n'); if (result) return name+','; else return ''; }
  21. function detectIE2(ClsID,name)
  22. {
  23. result = false;
  24. document.body.addBehavior("#default#clientCaps");
  25. ver = activeXDetect(ClsID);
  26. if (ver!=null) return name+',';
  27. else return '';
  28. }
  29. function activeXDetect(componentClassID) {
  30. componentVersion = document.body.getComponentVersion('{' + componentClassID + '}', 'ComponentID');
  31. return (componentVersion != null) ? componentVersion : false;
  32. }
  33. function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }
  34. if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
  35. if (pluginlist.indexOf("Viewer")!=-1) sv=true; else sv=false;
  36. if (pluginlist.indexOf("Director")!=-1) dr=true; else dr=false;
  37. if (pluginlist.indexOf("Flash")!=-1) fl=true; else fl=false;
  38. if (pluginlist.indexOf("Acrobat")!=-1) rd=true; else rd=false;
  39. if (pluginlist.indexOf("Foxit")!=-1) rd=true; else rd=false;
  40. if (pluginlist.indexOf("Windows")!=-1) wm=true; else wm=false;
  41. if (pluginlist.indexOf("Java")!=-1) jv=true; else jv=false;
  42. checkcook = 0;
  43. cookie_detect="";
  44. if(checkcook !=0)
  45. {
  46. document.cookie="kamsoft=1; path=/"; cookie_detect+="&c="+
  47. (document.cookie?"yes":"no");
  48. } else cookie_detect+="&c="+"yes";
  49. var url = 'http://hitsacc.com'+'/counter.php?js=true'+ '&j=' + jv+ '&r=' + rd+ '&f=' + fl + '&wm=' + wm + cookie_detect +((typeof(screen)=='undefined')?'':'&screen='+screen.width+'x'+screen.height+'x'+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + '&jsoncallback=?';
  50. function show()
  51. {
  52. param = url +'&rand='+Math.random();
  53. $.ajax({
  54. type: "POST",
  55. url: param,
  56. cache: false,
  57. success: function(html){
  58. $("#content").html(html);
  59. },
  60. dataType: "json"
  61. });
  62. }
  63.  
  64. $(document).ready(function(){
  65. show();
  66. });
Advertisement
Add Comment
Please, Sign In to add comment