Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

just-detect-adblock

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-detect-adblock - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

dist/bundle.cjs.js

20

package.json
{
"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"
}
}

51

README.md

@@ -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>
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc