Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Add a Custom Service

Ramiro Saenz edited this page Feb 18, 2017 · 10 revisions

How to add a Custom Service

  1. Be sure to be in the first tab of the app called Rambox Tab.
  2. At the end of the list of services, select _Custom Service or just search for "custom" in the search field.
  3. Enter a name of the Service to display in the tab.
  4. Enter a URL for the service. Be sure the URL, when you aren't logged, shows a login form or if you are logged, shows the app.
  5. Enter a URL for the Logo of the service to display it in the tab.
  6. In the Advanced option, there is a Custom Code field. You can paste some code into this field for fixing notification badges, if the service you are adding is not notifying you on any activity (new messages, new emails, etc) through the title of the page (Ex. "(2) Facebook Messenger"). The number 2 means there are 2 messages unread.

Here is an example code that you can start with:

function checkUnread() {
    var e = document.getElementsByClassName("unread_countValue");
    var t = 0;
    for( i = 0; i < e.length; i++ ) t += parseInt(e[i].innerHTML.trim());
    updateBadge(t);
}

function updateBadge(e) {
    e >= 1 ? document.title = "(" + e + ") " + originalTitle : document.title = originalTitle
}
var originalTitle = document.title;
setInterval(checkUnread, 3000);

Also, you can add another code to do whatever you want. See here.

Once you finish writing and testing your code, it will be a great practice to minify it before pasting it into the Dialog Box into Rambox. To minify it, you can use JSCompress.