public
Last active

  • Download Gist
hasjs.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/*! 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'));

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.