just-detect-adblock
Advanced tools
Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "just-detect-adblock", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "It's FuckAdBlock with a minimalist API.", | ||
"main": "index.js", | ||
"main": "dist/bundle.cjs.js", | ||
"module": "dist/bundle.esm.js", | ||
"browser": "dist/bundle.umd.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"test": "http-server ./ --silent -c-1 -o /test/index.html" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"repository": { | ||
@@ -25,3 +32,8 @@ "type": "git", | ||
}, | ||
"homepage": "https://github.com/wmcmurray/just-detect-adblock#readme" | ||
"homepage": "https://github.com/wmcmurray/just-detect-adblock#readme", | ||
"devDependencies": { | ||
"http-server": "^0.12.3", | ||
"rollup": "^2.32.0", | ||
"rollup-plugin-terser": "^7.0.2" | ||
} | ||
} |
@@ -1,5 +0,16 @@ | ||
# just-detect-adblock | ||
This package is strongly ~~inspired~~ copied from [BlockAdBlock](https://github.com/sitexw/BlockAdBlock) & [FuckAdBlock](https://github.com/sitexw/FuckAdBlock). I just didn't liked how overly complicated the end user API was so I made this, which contains only one function to detect if an adblocker is active or not. | ||
# just-detect-adblock :no_entry_sign::detective: | ||
This package was originally ~~inspired~~ copied from [BlockAdBlock](https://github.com/sitexw/BlockAdBlock) & [FuckAdBlock](https://github.com/sitexw/FuckAdBlock), then I added features that those don't have. I just didn't like how overly complicated their API was, so I made this, which contains only helper functions that can be called manually. The rest is up to you ! | ||
## Installation | ||
## Features | ||
- can detect **browser extensions** (like **Adblock Plus**) | ||
- can detect **Brave browser** shields | ||
- can detect **Opera browser** adblocker | ||
<br> | ||
## How to use | ||
``` | ||
@@ -9,7 +20,12 @@ npm install just-detect-adblock --save | ||
## API | ||
| Methods | Return | Description | | ||
| :---------------------------- | :------------------------------ | :------------------------------------------------------------------| | ||
| `detectAnyAdblocker()` | *Promise(detected=true/false)* | perform all available checks below until at least one is positive | | ||
| `detectDomAdblocker()` | *Promise(detected=true/false)* | detect if a browser extension is hiding ads from the DOM | | ||
| `detectBraveShields()` | *Promise(detected=true/false)* | detect if Brave browser shields seems to be activated | | ||
| `detectOperaAdblocker()` | *Promise(detected=true/false)* | detect if Opera browser adblocker seems to be activated | | ||
| **DEPRECATED** `isDetected()` | *true/false* | if an adblocker is detected **(old behavior only, this method does not detect Brave or Opera adblockers, please use `detectAnyAdblocker` instead)** | | ||
* `isDetected()` Returns true/false if an adblocker is detected. | ||
<br> | ||
## Exemples | ||
@@ -19,7 +35,22 @@ | ||
```javascript | ||
import adBlocker from 'just-detect-adblock' | ||
import { detectAnyAdblocker } from 'just-detect-adblock' | ||
if(adBlocker.isDetected()){ | ||
// an adblocker is detected | ||
} | ||
detectAnyAdblocker().then((detected) => { | ||
if(detected){ | ||
// an adblocker is detected | ||
} | ||
}); | ||
``` | ||
### Browser | ||
```html | ||
<script type="text/javascript" src="/dist/bundle.umd.js"></script> | ||
<script type="text/javascript"> | ||
justDetectAdblock.detectAnyAdblocker().then(function(detected) { | ||
if(detected){ | ||
// an adblocker is detected | ||
} | ||
}); | ||
</script> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
10406
5
0
55
3
28