=== ReadBar - Smart Reading Time & Dynamic Progress Bar ===
Contributors: noorwork
Donate link: https://buymeacoffee.com/noorwork
Tags: reading time, progress bar, estimated reading time, reading progress, engagement
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show an estimated reading time and a scroll progress bar on your posts and pages. Blocks, shortcode, per-post overrides, no tracking by default.

== Description ==

ReadBar tells readers how long an article will take and shows them how far through it they are. Both parts are optional, both are configurable, and neither adds a request to any external service.

**Reading time**

* Estimates from a words-per-minute figure you control.
* Multibyte-safe word counting, so Bengali, Hindi, Arabic, Chinese, Japanese and Korean articles are measured correctly rather than reported as zero.
* Optionally adds time for images, videos, embeds and lines of code, because a photo essay reads slower than its word count suggests.
* Ignores shortcodes, script and style blocks, so a gallery shortcode no longer inflates the estimate.
* Shows above the title, above the content, below the content, in archive excerpts, in a block, or anywhere via shortcode.
* Optional clock icon, full control over colour, alignment, font size, margin and padding.

**Reading progress bar**

* Fixed to the top or bottom of the screen, with independent positions for mobile, tablet and desktop.
* Flat, rounded, gradient or glow styles, and any height from 1 to 40 pixels.
* Optional floating circular indicator, with a scroll percentage and an optional "back to top" action.
* Measures the article rather than the whole document, so the bar reaches 100% at the end of the text instead of at the bottom of the comments and footer. You can point it at any CSS selector.
* Written in plain JavaScript with no jQuery dependency, batched into a single animation frame per scroll, and it respects the visitor's reduced-motion preference.
* Exposes `role="progressbar"` with a live `aria-valuenow`, so screen readers can report progress.

**Blocks and shortcode**

* **Reading Time** block — use it in a post or in a Site Editor template.
* **Reading Progress Bar** block — switch the bar on for exactly the entries a template covers.
* `[read_bar_reading_time]` shortcode with `show_on`, `align`, `content`, `font_size`, `text_color`, `bg_color`, `prefix`, `postfix`, `show_icon` and `post_id`.
* A ReadBar box on every post and page for a manual minute count, or to hide ReadBar on that one entry.

== Privacy and data ==

ReadBar contacts no external server unless you explicitly allow it.

After activation you are shown a setup screen with two buttons: **Allow & finish setup** and **Finish without sharing**. Neither is pre-selected, no feature is withheld either way, and the answer is stored in the `noorwork0625readbar_consent` option. You can change it at any time on **ReadBar → Settings → Privacy**; unticking the box stops every outbound request immediately.

If you allow it, ReadBar sends the following to `https://license.noorwork.com/wp-json/codelocker/v1/lead` when it is activated, updated or deactivated:

* Your site address, WordPress version, PHP version and active theme name
* Site language, timezone, and whether the site is multisite
* The ReadBar version, which ReadBar features are switched on, and the install date
* The contact email you entered, if you entered one
* The reason you select in the deactivation dialog, and any note you add to it

ReadBar never sends your post content, your visitors or any analytics about them, IP addresses, user accounts, passwords or licence keys.

The deactivation dialog is shown whether or not you allowed reporting. If you did not allow it, pressing "Send & deactivate" transmits that single message — your reason plus the ReadBar, WordPress and PHP versions and your site address — and nothing after it. "Skip & deactivate" and the close button send nothing at all, and deactivation proceeds either way.

Service provider: NoorWork, https://noorwork.com. Privacy policy: https://noorwork.com/privacy-policy/

== Installation ==

= Via WordPress Dashboard (recommended) =

1. Go to `Plugins > Add New`.
2. Search for "ReadBar", or click `Upload Plugin` and choose `read-bar.zip`.
3. Click `Install Now`, then `Activate`.
4. The setup screen opens automatically. Choose what to show and answer the reporting question.

= Via FTP =

1. Unzip `read-bar.zip`.
2. Upload the `read-bar` folder into `wp-content/plugins/`.
3. Activate it under `Plugins > Installed Plugins`, then run the setup from the notice at the top of the screen.

== Frequently Asked Questions ==

= The reading time or progress bar is not showing. =

Check that the feature is enabled on its tab, that the current post type is ticked under "Display on Post Types", and that the device you are testing on is ticked under "Visibility". Also check the ReadBar box in the post editor — the entry may be set to hide ReadBar.

= My Bengali (or Chinese, Arabic, Hindi) posts showed "1 min read" for everything. =

That was a bug in 1.0.0: word counting only understood single-byte languages. 1.1.0 counts words per Unicode word boundary and treats CJK glyphs by character count, so estimates are now correct in every language.

= The bar hit 100% before I finished reading. =

1.0.0 measured the whole document, including the header, comments and footer. 1.1.0 measures the article element by default, and you can set an exact CSS selector under Progress Bar → Scroll Target.

= Can I set the reading time by hand for one article? =

Yes. Every post and page has a ReadBar box in the editor sidebar with a minutes field. Leave it empty to calculate automatically.

= Does ReadBar work with block themes and the Site Editor? =

Yes. Both blocks can be placed in templates and template parts, and the progress-bar block lets one template have its own bar style.

= Does ReadBar phone home? =

Not unless you say yes. See the "Privacy and data" section above for exactly what is and is not sent.

== Screenshots ==

1. Reading time and progress bar on the front end.
2. The first-run setup screen.
3. Reading Time settings.
4. Progress Bar settings.
5. The Privacy tab.
6. The Reading Time block in the editor.

== Changelog ==

= 1.1.0 - 2026-09-10 =

**Added**

* First-run setup screen with an explicit, unselected choice about usage reporting.
* Privacy tab to review what is collected and withdraw permission at any time.
* Deactivation feedback dialog with a nine-reason list and an optional note.
* Reading Time block and Reading Progress Bar block, both usable in Site Editor templates.
* Per-post ReadBar box: manual reading-time override, or hide ReadBar on that entry.
* Optional media weighting — seconds per image, per video or embed, and per line of code.
* Reading time in archive and search excerpts.
* Bar styles (flat, rounded, gradient, glow), configurable bar height, and a floating circular indicator with scroll percentage and an optional back-to-top action.
* Scroll Target setting to measure a specific element instead of the whole page.
* Optional clock icon, and `prefix`, `postfix`, `show_icon` and `post_id` shortcode parameters.
* `uninstall.php` that removes every option, table and post meta the plugin created.
* Filters: `noorwork0625readbar_reading_time`, `noorwork0625readbar_cjk_chars_per_word`, `noorwork0625readbar_service_url`.

**Fixed**

* Word counting ignored multibyte languages, reporting zero words for CJK and other non-Latin scripts.
* Prefix and suffix were escaped twice, so an ampersand rendered as `&amp;amp;`.
* Shortcodes and gallery markup were counted as words, inflating the estimate.
* The progress bar measured the whole document instead of the article, so it filled early.
* The scroll handler ran unthrottled on every scroll event and forced a layout read each time.
* The settings screen referenced a message container that was never rendered, so the second status message went nowhere.
* The save button's label was reset to an untranslated hardcoded string after saving.
* Default post types differed between the activation routine and the settings defaults.
* The schema check ran on every front-end request and re-ran whenever the plugin version changed, rather than when the schema did.
* Composer's autoload path for the settings processors used a lowercase directory that does not exist on case-sensitive filesystems.
* Activation did nothing on the other sites of a multisite network, or on sites created later.
* Emptying a checkbox group could not be saved because the stored value was merged over the defaults.

**Changed**

* The front-end script no longer requires jQuery.
* Presentation moved out of PHP into the stylesheet and CSS custom properties; no inline `<style>` or `<script>` is printed.
* Settings are read through one shared accessor instead of two independent caches.
* Requires WordPress 6.2 or newer; tested against WordPress 7.1.
* Settings screen rebuilt as a full-screen enterprise dashboard: a left sidebar replaces the top tab strip, every field lives in a card, and toggles, segmented controls and colour swatches replace raw checkboxes and `<select>` boxes.
* Reading Time and Progress Bar tabs now show a live preview panel that updates as you change colours, alignment, bar style and height, without saving first.
* The Save button moved to a sticky top bar so it is reachable from any tab, with an inline saved/error status next to it.
* Shortcode reference restyled as a copyable code block and a parameter table.

= 1.0.0 - 2025-06-06 =

* Initial release: estimated reading time, reading progress bar, device visibility, post-type selection and the `[read_bar_reading_time]` shortcode.

== Upgrade Notice ==

= 1.1.0 =
Corrects reading-time estimates for non-Latin languages and stops the progress bar filling early. Adds blocks, per-post overrides and a privacy screen. After updating you will be asked once whether ReadBar may report usage; declining changes nothing about how it works.
