BlueCat Address Manager Dynamic Tab Title

Dynamic HTML Tab Title in BlueCat Address Manager

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        BlueCat Address Manager Dynamic Tab Title
// @namespace   *
// @description Dynamic HTML Tab Title in BlueCat Address Manager
// @include     */app*
// @version     6
// @grant       none
// @author      Marius Galm
// @copyright   2018, Marius Galm
// @license		MIT
// @icon        https://www.bluecatnetworks.com/wp-content/uploads/2018/03/cropped-bluecat-favicon-32x32.png
// ==/UserScript==
if (document.readyState === "interactive" ) {
    var page = document.childNodes[2].nodeValue;
    if (/ Page: ConfigurationPage /.test(page)) {
        var subtab = document.getElementsByClassName("TabPanelLabelActive")[0];
        var bamVersion = document.getElementById('versionText');
        var element1 = document.getElementById('pc');
        var element2 = document.getElementById('pageMenu-title');
        if (bamVersion !== null) {
            if (element1 !== null) {
                document.title = element1.innerHTML + " [" + subtab.innerHTML.trim() + "]" + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else if (element2 !== null) {
                var str = element2.getElementsByClassName('title-center')[0].innerHTML;
                document.title = str  + " [" + subtab.innerHTML.trim() + "]" + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else {
                document.title = "BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            }
        } else {
            //probably not a BAM
        }
    } else if (/ Page: GroupList /.test(page)) {
        var subtab = document.getElementsByClassName("TabPanelLabelActive")[0];
        var bamVersion = document.getElementById('versionText');
        var element1 = document.getElementById('pc');
        var element2 = document.getElementById('pageMenu-title');
        if (bamVersion !== null) {
            if (element1 !== null) {
                document.title = element1.innerHTML + " [" + subtab.innerHTML.trim() + "]" + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else if (element2 !== null) {
                var str = element2.getElementsByClassName('title-center')[0].innerHTML;
                document.title = str  + " [" + subtab.innerHTML.trim() + "]" + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else {
                document.title = "BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            }
        } else {
            //probably not a BAM
        }
    } else {
        var bamVersion = document.getElementById('versionText');
        var element1 = document.getElementById('pc');
        var element2 = document.getElementById('pageMenu-title');
        if (bamVersion !== null) {
            if (element1 !== null) {
                document.title = element1.innerHTML + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else if (element2 !== null) {
                var str = element2.getElementsByClassName('title-center')[0].innerHTML;
                document.title = str + " - BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            } else {
                document.title = "BlueCat Address Manager (" + bamVersion.innerHTML + ")";
            }
        } else {
            //probably not a BAM
        }
    }
}