Skip to content

Commit

Permalink
Added in support for IE 4 - 9 for blurring and a check for versions l…
Browse files Browse the repository at this point in the history
…ower than 10 as 10 supports blur.
  • Loading branch information
Dwayne Charrington committed Feb 25, 2013
1 parent 118171c commit 653f1c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions spoiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
applyBlur = function() {
var radius = maxBlur - step;

if (browser.msie) {
alert("WARNING, this site contains spoilers!");
if (browser.msie && ieLessThanTen()) {
var filterValue = "progid:DXImageTransform.Microsoft.Blur(pixelradius="+radius+")";
$spoiler.css('filter', filterValue);
} else if (browser.mozilla) {
var filterValue = radius > 0 ? "url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='blur'><feGaussianBlur stdDeviation='" + radius + "' /></filter></svg>#blur\")" : '';
$spoiler.css('filter', filterValue);
Expand Down Expand Up @@ -76,6 +77,15 @@
}
}

// Does the user have IE 9 or less?
ieLessThanTen = function() {
if(!!document.createElement('canvas').getContext) {
return false;
} else {
return true;
}
}

applyBlur();

$spoiler.on('mouseover', function(e) {
Expand Down

0 comments on commit 653f1c2

Please sign in to comment.