Skip to content

Releases

2.0.0

Choose a tag to compare

@afbora afbora released this 31 Oct 20:59
ed13c64

Kirby Detect Ad Block now works on Kirby 5 and Kirby 6, with an accessible warning, a banner mode and more reliable detection.

New

  • Banner mode. Set mode to 'banner' for a gentle hint at the bottom of the page instead of a blocking dialog. Visitors can close it, and it then stays hidden for 7 days (the remember option, stored in the browser, no cookie).
  • Translations. The texts are translated into English, German and Turkish and follow the language of the page. Each text option can also be an array with one text per language code, and every option can be passed to the snippet.
  • More reliable detection. The plugin now uses bait elements that current filter lists hide, and a small bait script served by your own site that ad blockers block. A missing file never shows the warning, and no request goes to another domain.
  • JavaScript events. adblock:checked and adblock:detected let you react in your own way. Call event.preventDefault() to skip the plugin's warning, or set mode to false to only run the check.

Fixed

  • The warning now opens above sticky headers and menus. It used z-index: 2 before.
  • The warning is a real modal dialog: focus moves into it, the page behind it can't be used, and screen readers announce it.
  • Custom overlay snippets no longer break the script.
  • The inline script and styles use Kirby's nonce, so the plugin works with a Content Security Policy.

Breaking changes

  • Requires Kirby 5 or 6 and PHP 8.2 or newer. For Kirby 3 and 4, keep using 1.0.2.
  • The warning is a <dialog> with the classes detect-adblock and detect-adblock-banner. The IDs detectAdBlockOverlay and detectAdBlockInfo are gone, so update your own CSS for them.
  • The texts are escaped. To use HTML, override the detect-adblock-overlay snippet.
  • The default texts changed. Set the title, text and button options to keep your own.
  • A custom detect-adblock-overlay snippet needs the data-detect-adblock attribute on the warning. Snippets with the ID detectAdBlockOverlay still work.

See the README for all options and the upgrade notes.

Repository: https://github.com/owebstudio/kirby-detect-adblock
License: MIT, see LICENSE

1.0.2

Choose a tag to compare

@afbora afbora released this 14 Sep 20:08
1.0.2

1.0.1

Choose a tag to compare

@afbora afbora released this 11 Sep 12:09
1.0.1 (Kirby Next)

1.0.0

Choose a tag to compare

@afbora afbora released this 27 Jan 21:29

Initial version