1/* 2 3jQuery Browser Plugin 4 * Version 1.1.0 5 * URL: http://jquery.thewikies.com/browser 6 * Description: jQuery Browser Plugin extends browser detection capabilities and implements CSS browser selectors. 7 * Author: Nate Cavanaugh, Minhchau Dang, & Jonathan Neal 8 * Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license. 9 10*/ 11 12var jQueryBrowser = function() { 13 14 // Define whether Browser Selectors will be added automatically; set as false to disable. 15 var addSelectors = true; 16 17 // Define Navigator Properties. 18 var pl = navigator.platform; 19 var ua = navigator.userAgent; 20 21 // Define Browser Properties. 22 var ob = { 23 24 // Define the rendering client 25 gecko: /Gecko/.test(ua) && !/like Gecko/.test(ua), 26 webkit: /WebKit/.test(ua), 27 28 // Define the browser 29 aol: /America Online Browser/.test(ua), 30 camino: /Camino/.test(ua), 31 firefox: /Firefox/.test(ua), 32 flock: /Flock/.test(ua), 33 icab: /iCab/.test(ua), 34 konqueror: /KDE/.test(ua), 35 mozilla: /mozilla/.test(ua), 36 msie: /MSIE/.test(ua), 37 netscape: /Netscape/.test(ua), 38 opera: /Opera/.test(ua), 39 safari: /Safari/.test(ua), 40 browser: /(MSIE|Firefox|Opera|Safari|KDE|iCab|Flock)/.exec(ua)[0], 41 42 // Define the opperating system 43 win: /Win/.test(pl), 44 mac: /Mac/.test(pl), 45 linux: /Linux/.test(pl), 46 iphone: /iPhone/.test(pl), 47 OS: /(Win|Mac|Linux|iPhone)/.exec(pl)[0], 48 49 // Define the classic navigator properties 50 platform: pl, 51 agent: ua, 52 53 // Define the 'addSelectors' function which adds Browser Selectors to a tag; by default <HTML>. 54 addSelectors: function() { 55 jQuery(arguments[0] || 'html').addClass([this.renderer,this.browser,this.browser+this.version.major,this.OS,'js'].join(' ').toLowerCase()); 56 }, 57 58 // Define the 'removeSelectors' function which removes Browser Selectors to a tag; by default <HTML>. 59 removeSelectors: function() { 60 jQuery(arguments[0] || 'html').removeClass([this.renderer,this.browser,this.browser+this.version.major,this.OS,'js'].join(' ').toLowerCase()); 61 } 62 63 }; 64 65 // Redefine the Rendering Client. 66 ob.renderer = (ob.gecko) ? 'gecko' : (ob.webkit) ? 'webkit' : ''; 67 68 // Redefine the Browser Client Version. 69 ob.version = {}; 70 ob.version.string = (ob.msie) 71 ? /MSIE ([^;]+)/.exec(ua)[1] 72 : (ob.firefox) 73 ? /Firefox\/(.+)/.exec(ua)[1] 74 : (ob.safari) 75 ? /Version\/([^\s]+)/.exec(ua)[1] 76 : (ob.opera) 77 ? /Opera\/([^\s]+)/.exec(ua)[1] 78 : ''; 79 ob.version.number = parseFloat(ob.version.string); 80 ob.version.major = /([^\.]+)/.exec(ob.version.string)[1]; 81 82 // Run the 'addSelectors' Function if the 'addSelectors' Variable is set as true. 83 if (addSelectors) { 84 ob.addSelectors(); 85 } 86 87 // Define the jQuery 'browser' Object. 88 jQuery.browser = ob; 89 90}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.