Browser Tab get matching name(s) of viewing page(s)

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
mzonneveld
Posts: 5
Joined: Wednesday 18 November 2020 10:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Browser Tab get matching name(s) of viewing page(s)

Post by mzonneveld »

A small jQuery addition to set the browtitle to the current page.
So when opening mulitple tabs, it's easy to see which tab shows which DZ-page.

Image

Code: Select all

$(function () {
    // Init Events
    $(window).on('hashchange', function () { UpdateOnNavigate(); });
    $("#appnavbar a[href]").click(function () { UpdateOnNavigate(); });
    UpdateOnNavigate();
}); // Doc Ready

function UpdateOnNavigate() {
    // Update browser titel
    titel = location.href;
    if (titel.indexOf('#') >= 0) {
        titel = titel.split('#')[1].replace('/', '') + ' - DZ';
        titel = titel.trim(' ').trim('-');
        document.title = titel;
    }
}
User avatar
waltervl
Posts: 5738
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Browser Tab get matching name(s) of viewing page(s)

Post by waltervl »

I would suggest you make a PR in the github repositories so this will be part of all releases. Else you have to update the scripts at every Domoticz (beta) update.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest