{"id":17048829,"url":"https://github.com/sitexw/blockadblock","last_synced_at":"2025-05-16T06:05:23.220Z","repository":{"id":31429091,"uuid":"34992630","full_name":"sitexw/BlockAdBlock","owner":"sitexw","description":"Allows you to detect the extension AdBlock (and other)","archived":false,"fork":false,"pushed_at":"2019-05-13T13:50:24.000Z","size":16,"stargazers_count":622,"open_issues_count":11,"forks_count":115,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-16T06:05:21.457Z","etag":null,"topics":["adblock","adblocker","blockadblock"],"latest_commit_sha":null,"homepage":"http://fuckadblock.sitexw.fr/blockadblock/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"lazyparser/xbotblockly","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sitexw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-03T16:32:56.000Z","updated_at":"2025-05-03T07:17:51.000Z","dependencies_parsed_at":"2022-09-05T22:00:58.463Z","dependency_job_id":null,"html_url":"https://github.com/sitexw/BlockAdBlock","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitexw%2FBlockAdBlock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitexw%2FBlockAdBlock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitexw%2FBlockAdBlock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sitexw%2FBlockAdBlock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sitexw","download_url":"https://codeload.github.com/sitexw/BlockAdBlock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478187,"owners_count":22077676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adblock","adblocker","blockadblock"],"created_at":"2024-10-14T09:53:08.295Z","updated_at":"2025-05-16T06:05:23.194Z","avatar_url":"https://github.com/sitexw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"BlockAdBlock (v3.2.1)\n===========\n\n([FuckAdBlock](https://github.com/sitexw/FuckAdBlock) same project but with a more convenient name)\n\nYou can detect nasty ad blockers.\nOnline example: http://sitexw.fr/blockadblock/\n\n\nValid on\n---------------------\n- Google Chrome\n- Mozilla Firefox\n- Internet Explorer (8+)\n- Safari\n- Opera\n\nInstall via\n---------------------\nManual:\n```\nDownload \"blockadblock.js\" and add it to your website.\n```\nBower:\n```\nbower install blockadblock\n```\nNode.js/io.js:\n```\nnpm install blockadblock\n```\n\n\nCode example\n---------------------\n```javascript\n// Function called if AdBlock is not detected\nfunction adBlockNotDetected() {\n\talert('AdBlock is not enabled');\n}\n// Function called if AdBlock is detected\nfunction adBlockDetected() {\n\talert('AdBlock is enabled');\n}\n\n// Recommended audit because AdBlock lock the file 'blockadblock.js' \n// If the file is not called, the variable does not exist 'blockAdBlock'\n// This means that AdBlock is present\nif(typeof blockAdBlock === 'undefined') {\n\tadBlockDetected();\n} else {\n\tblockAdBlock.onDetected(adBlockDetected);\n\tblockAdBlock.onNotDetected(adBlockNotDetected);\n\t// and|or\n\tblockAdBlock.on(true, adBlockDetected);\n\tblockAdBlock.on(false, adBlockNotDetected);\n\t// and|or\n\tblockAdBlock.on(true, adBlockDetected).onNotDetected(adBlockNotDetected);\n}\n\n// Change the options\nblockAdBlock.setOption('checkOnLoad', false);\n// and|or\nblockAdBlock.setOption({\n\tdebug: true,\n\tcheckOnLoad: false,\n\tresetOnEnd: false\n});\n```\n\nDefault options\n---------------------\n```javascript\n// At launch, check if AdBlock is enabled\n// Uses the method blockAdBlock.check()\ncheckOnLoad: true\n\n// At the end of the check, is that it removes all events added ?\nresetOnEnd: true\n\n// The number of milliseconds between each check\nloopCheckTime: 50\n\n// The number of negative checks after which there is considered that AdBlock is not enabled\n// Time (ms) = 50*(5-1) = 200ms (per default)\nloopMaxNumber: 5\n\n// CSS class used by the bait caught AdBlock\nbaitClass: 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links'\n\n// CSS style used to hide the bait of the users\nbaitStyle: 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;'\n\n// Displays the debug in the console (available only from version 3.2 and more)\ndebug: false\n```\n\nMethod available\n---------------------\n```javascript\n// Allows to set options\n// #options: string|object\n// #value:   string\nblockAdBlock.setOption(options, value);\n\n// Manually check if AdBlock is enabled.\n// Returns `true` upon completion of check.\n// Returns `false` if check cannot be performed (eg due to another check in progress).\n// The parameter 'loop' allows checking without loop several times according to the value of 'loopMaxNumber'\n// Example: loop=true  =\u003e time~=200ms (time varies depending on the configuration)\n//          loop=false =\u003e time~=1ms\n// #loop: boolean (default: true)\nblockAdBlock.check(loop);\n\n// Allows to manually simulate the presence of AdBlock or not\n// #detected: boolean (AdBlock is detected ?)\nblockAdBlock.emitEvent(detected);\n\n// Allows to clear all events added via methods 'on', 'onDetected' and 'onNotDetected'\nblockAdBlock.clearEvent();\n\n// Allows to add an event if AdBlock is detected\n// #detected: boolean (true: detected, false: not detected)\n// #fn:       function\nblockAdBlock.on(detected, fn);\n\n// Similar to blockAdBlock.on(true|false, fn)\nblockAdBlock.onDetected(fn);\nblockAdBlock.onNotDetected(fn);\n```\n\nInstance\n---------------------\n*(Available only from version 3.1 and more)*\nBy default, BlockAdBlock is instantiated automatically.\nTo block this automatic instantiation, simply create a variable \"blockAdBlock\" with a value (null, false, ...) before importing the script.\n```html\n\u003cscript\u003evar blockAdBlock = false;\u003c/script\u003e\n\u003cscript src=\"./blockadblock.js\"\u003e\u003c/script\u003e\n```\nAfter that, you are free to create your own instances:\n```javascript\nblockAdBlock = new BlockAdBlock;\n// and|or\nmyBlockAdBlock = new BlockAdBlock({\n\tcheckOnLoad: true,\n\tresetOnEnd: true\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitexw%2Fblockadblock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsitexw%2Fblockadblock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsitexw%2Fblockadblock/lists"}