Created
March 1, 2010 01:26
-
-
Save gbakernet/317994 to your computer and use it in GitHub Desktop.
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
/*! hasflash.js version 1.1 | |
* Flash Detect from MIT/GPL - http://jquery.thewikies.com/swfobject/ | |
* */ | |
/*jslint onevar: true, undef: true, eqeqeq: true, regexp: true, newcap: true, immed: true */ | |
/*globals navigator, window, document */ | |
(function(window, Plugin, footprint){ | |
if(window[footprint]){return;} | |
else {window[footprint]=1;} | |
var getFlashVersion = function() { | |
var flashVersion; | |
try { | |
flashVersion = Plugin.description || (function () { | |
return ( | |
new Plugin('ShockwaveFlash.ShockwaveFlash') | |
).GetVariable('$version'); | |
}()); | |
} | |
catch (e) { | |
flashVersion = 'Unavailable'; | |
} | |
return flashVersion; | |
}, | |
flashVersionMatchVersionNumbers = getFlashVersion().match(/\d+/g) || [0], | |
fv = parseInt(flashVersionMatchVersionNumbers[0], 10) || 0, | |
t = "has-js js", | |
de = document.documentElement, | |
setDE = function(s){ | |
de.className += (de.className === "" ? "" : " ") + s; | |
}, | |
counter; | |
if(!isNaN(fv) && fv > 1 && fv < 100) { | |
t += " has-flash"; | |
for(counter = fv; counter >= 8; counter--) { | |
t += " flash-gt-eq-" + counter; | |
} | |
} | |
setDE(t); | |
}(window, navigator.plugins['Shockwave Flash'] || window.ActiveXObject, 'hasflash-js-footprint')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment