Make Online Float Button Appear if Agent is Online instead of Disappear if Agent is Offline

Make Online Float Button Appear if Agent is Online instead of Disappear if Agent is Offline

We are working to setup Zoho SalesIQ Chat on our website. Our goal is that the chat float button only appear if an agent is online. We tested the script below which hides the chat float button when all agents are offline:

$zoho.salesiq.ready=function()
{
      $zoho.salesiq.chat.offline(function(){$zoho.salesiq.floatbutton.visible("hide");});
}

The problem with this script is the offline float button appears for a second and then disappears. When a user goes to different pages, the offline float button appears and then disappears quickly confusing our website visitors. 

We would like to enable the opposite of this script: make the float button hidden by default and only appear if an agent is online. This would solve our problem of the offline float button appearing and then disappearing which the above script does.

Can you help us figure out how to write a script or adjust the default float button script to make this happen and resolve our problem?