mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-07-16 01:52:53 -04:00
Dispatch a JS event when an entry finishes being marked read/unread (#9031)
* Dispatch a JS event when an entry finishes being marked read/unread Extensions that render their own read/unread indicator outside of the main article list (e.g. a custom reading pane) had no way to know when a mark read/unread AJAX request completed, so their own UI could get stuck (e.g. a spinner never reset). Dispatch a `freshrss:entryStateChange` event on `document` with the entry id and new state once the toggle has been applied, following the existing `freshrss:*` JavaScript event convention used elsewhere in main.js. Fixes #8862 * Minor preferences --------- Co-authored-by: Gerard Alvear <gerard.alvear@logiqd.me> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
committed by
GitHub
parent
8aa8655cda
commit
28bc73afed
@@ -31,6 +31,8 @@ See also [the FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases).
|
||||
* Always jump article to top when header is offscreen, also when **Stick the article to the top when opened* is disabled [#8870](https://github.com/FreshRSS/FreshRSS/pull/8870)
|
||||
* Fix padding for `.nav_menu` in Alternative-Dark, Flat, and Nord themes [#8901](https://github.com/FreshRSS/FreshRSS/pull/8901)
|
||||
* Various UI and style improvements: [#8823](https://github.com/FreshRSS/FreshRSS/pull/8823), [#8824](https://github.com/FreshRSS/FreshRSS/pull/8824)
|
||||
* Extensions
|
||||
* New `freshrss:entryStateChange` JavaScript event for extensions, dispatched when an article has finished being marked as read/unread [#8862](https://github.com/FreshRSS/FreshRSS/pull/9031)
|
||||
* I18n
|
||||
* Improve Hungarian [#8879](https://github.com/FreshRSS/FreshRSS/pull/8879)
|
||||
* Improve Italian [#8880](https://github.com/FreshRSS/FreshRSS/pull/8880)
|
||||
|
||||
@@ -106,6 +106,7 @@ People are sorted by name so please keep this order.
|
||||
* [FromTheMoon85](https://github.com/FromTheMoon85): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:FromTheMoon85)
|
||||
* [Gabriele Biggio](https://github.com/gabbihive): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:gabbihive)
|
||||
* [Gaurav Thakur](https://github.com/notfoss): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:notfoss), [Web](https://blog.notfoss.com/)
|
||||
* [Gerard Alvear](https://github.com/Elgeryy1): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:Elgeryy1)
|
||||
* [Gianni Scolaro](https://github.com/giannidsp): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:giannidsp)
|
||||
* [Glyn Normington](https://github.com/glyn): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:glyn), [Web](https://underlap.org/)
|
||||
* [Gregor Nathanael Meyer](https://github.com/spackmat): [contributions](https://github.com/FreshRSS/FreshRSS/pulls?q=is:pr+author:spackmat), [Web](https://der-meyer.de)
|
||||
|
||||
@@ -225,6 +225,7 @@ if (document.readyState && document.readyState !== 'loading' && typeof window.co
|
||||
The following events are available:
|
||||
|
||||
* `freshrss:globalContextLoaded`: will be dispatched after load the global `context` variable, useful for referencing variables injected with the `Minz_HookType::JsVars` hook.
|
||||
* `freshrss:entryStateChange`: will be dispatched on `document` after an entry has finished being marked as read or unread (i.e. once the underlying AJAX request has completed). The `detail` property of the event contains `id` (the entry ID) and `isRead` (the new read state). Useful for extensions that display their own read/unread indicator outside of the main article list, e.g. in a custom reading pane.
|
||||
|
||||
### Injecting CDN content
|
||||
|
||||
|
||||
@@ -289,6 +289,13 @@ async function send_mark_read_queue(queue, asRead, callback) {
|
||||
incUnreadsFeed(div, feed_id, inc);
|
||||
}
|
||||
delete pending_entries['flux_' + queue[i]];
|
||||
// Let extensions know an entry finished being marked as read/unread
|
||||
document.dispatchEvent(new CustomEvent('freshrss:entryStateChange', {
|
||||
detail: {
|
||||
id: queue[i],
|
||||
isRead: !div.classList.contains('not_read'),
|
||||
},
|
||||
}));
|
||||
}
|
||||
faviconNbUnread();
|
||||
if (json.tags) {
|
||||
|
||||
Reference in New Issue
Block a user