From 8d23aeb5796d8165e75ba8abb470d697a971042d Mon Sep 17 00:00:00 2001 From: Valentin Date: Thu, 13 Nov 2014 18:22:48 +0100 Subject: [PATCH] Added support for IE8 and new version (3.0.1 => 3.0.2) --- README.md | 4 ++-- bower.json | 2 +- fuckadblock.js | 13 +++++++++---- package.json | 2 +- test.html | 4 ++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index cea9133..586e6c8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -FuckAdBlock (v3.0.1) +FuckAdBlock (v3.0.2) =========== Allows you to detect those nasty ad blockers. @@ -9,7 +9,7 @@ Valid on : --------------------- - Google Chrome - Mozilla Firefox -- Internet Explorer +- Internet Explorer (8+) - Safari - Opera diff --git a/bower.json b/bower.json index a357e44..36c8805 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "FuckAdBlock", "author": ["Valentin Allaire "], - "version": "3.0.1", + "version": "3.0.2", "main": "fuckadblock.js", "licenses": [], "ignore": [ diff --git a/fuckadblock.js b/fuckadblock.js index cc2cd00..dd42cb1 100644 --- a/fuckadblock.js +++ b/fuckadblock.js @@ -1,5 +1,5 @@ /* -FuckAdBlock 3.0.1 +FuckAdBlock 3.0.2 http://github.com/sitexw/FuckAdBlock */ @@ -14,7 +14,7 @@ http://github.com/sitexw/FuckAdBlock } var self = this; - window.addEventListener('load', function() { + var eventCallback = function() { setTimeout(function() { if(self._options.checkOnLoad === true) { if(self._var.bait === null) { @@ -25,7 +25,12 @@ http://github.com/sitexw/FuckAdBlock }, 1); } }, 1); - }, false); + }; + if(window.addEventListener) { + window.addEventListener('load', eventCallback, false); + } else { + window.attachEvent('onload', eventCallback); + } }; FuckAdBlock.prototype._options = { checkOnLoad: true, @@ -33,7 +38,7 @@ http://github.com/sitexw/FuckAdBlock loopCheckTime: 50, loopMaxNumber: 5, baitClass: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links', - baitStyle: 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;', + baitStyle: 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;' }; FuckAdBlock.prototype._var = { version: '3.0.1', diff --git a/package.json b/package.json index 6dc2521..57721aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "FuckAdBlock", - "version": "3.0.1", + "version": "3.0.2", "description": "Detects ad blockers", "main": "fuckadblock.js", "scripts": { diff --git a/test.html b/test.html index 9924afc..426aada 100644 --- a/test.html +++ b/test.html @@ -1,7 +1,7 @@ - FuckAdBlock 3.0.1 + FuckAdBlock 3.0.2