// ----------------------------------------------------------------------------------- // Atendimento Online 2.0 // ----------------------------------------------------------------------------------- // Janela function janela( url, nome, W, H, bln_scroll, bln_resize ){ // Centralizando var T = (screen.height/2)-(H/2); var L = (screen.width/2)-(W/2); // Configs var configs = "width="+W+", height="+H+", scrollbars="+bln_scroll+", left="+L+", top="+T+", resizable="+bln_resize; // Janela var janela = window.open(url,nome,configs); // Focus if( janela ) janela.focus(); return janela; } // Cliente // janela de atendimento function Atendimento(){ janela( "https://petclinicaveterinaria.com.br/suporte/", "AtendimentoOnline", 450, 650, 0, 0 ); } // Cliente // imprime botão de atendimento // Utilizacao :
< script > BotaoAtendimento( 'bt_atendimento' );
function BotaoAtendimento( local ){ var local = document.getElementById(local); local.innerHTML = "Contato"; } // Status de Atendimento Online // Se houver ao menos um atendente disponível retorna 1 senão retorna 0 // callback = funcao de retorno. Recebe o status 0 ou 1 /* Ex. utilizacao de retorno : function AtendimentoStatusCallback( status ){ if( status == 1 ) alert("Atendimento Online"); else alert("Atendimento Offline"); } */ function AtendimentoStatus( callback ){ var xmlhttp; if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest(); else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function() { if ( xmlhttp.readyState==4 && xmlhttp.status == 200 ) { var resp = xmlhttp.responseText.replace(/^\s+|\s+$/g, ''); if( callback && typeof(callback) === "function" ) callback(resp); return resp; } } xmlhttp.open("GET","https://petclinicaveterinaria.com.br/suporte/status.php",true); xmlhttp.send(); } // -----------------------------------------------------------------------------------