Browse Source

Merging

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

2
app/model/Readme.md

@ -18,7 +18,7 @@ Structure of a service entry:
### Setting the unread count ### 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. 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. You can retrieve the unread count in this JavaScript code e.g. by parsing elements.

6
app/ux/WebView.js

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

Loading…
Cancel
Save