Browse Source

Merging

pr/1759
Ramiro Saenz 7 years ago
parent
commit
1bcdfa814c
  1. 4
      app/model/Readme.md
  2. 6
      app/ux/WebView.js

4
app/model/Readme.md

@ -18,8 +18,8 @@ Structure of a service entry:
### Setting the unread count
While by default the unread count is determined by looking for ` (COUNT)` to the window title, this describes the preferred way of doing it:
While by default the unread count is determined by looking for `(COUNT)` to the window title, this describes the preferred way of doing it:
Code provided by `js_unread` will be injected into the service website.
You can retrieve the unread count in this JavaScript code e.g. by parsing elements.
Set the unread count by calling `rambox.setUnreadCount(COUNT)` or clear it by calling `rambox.clearUnreadCount()`.
Set the unread count by calling `rambox.setUnreadCount(COUNT)` or clear it by calling `rambox.clearUnreadCount()`.

6
app/ux/WebView.js

@ -477,8 +477,7 @@ Ext.define('Rambox.ux.WebView',{
/**
* Handles 'rambox.setUnreadCount' messages.
* Sets the badge text if the event contains an integer
* or a '•' (indicating non-zero but unknown number of unreads) as first argument.
* Sets the badge text if the event contains an integer or a '•' (indicating non-zero but unknown number of unreads) as first argument.
*
* @param event
*/
@ -500,8 +499,7 @@ Ext.define('Rambox.ux.WebView',{
/**
* Register page title update event listener only for services that don't specify a js_unread
*/
if (Ext.getStore('ServicesList').getById(me.record.get('type')).get('js_unread') === '' &&
me.record.get('js_unread') === '') {
if (Ext.getStore('ServicesList').getById(me.record.get('type')).get('js_unread') === '' && me.record.get('js_unread') === '') {
webview.addEventListener("page-title-updated", function(e) {
var count = e.title.match(/\(([^)]+)\)/); // Get text between (...)
count = count ? count[1] : '0';

Loading…
Cancel
Save