(function() { titleMain(); var id=window.setInterval(titleMain,10000); var id2; function titleMain() { //console.log(id); //console.log(id2); if(id2!=undefined) { window.clearInterval(id2); } $.ajax({ type: "POST", url: "__URL__/ajaxTitle/", success: success }); } function success(title) { var num = title.length,i = 0; id2=window.setInterval(titleHandle,200); //console.log("id2:"+id2); function titleHandle() { if(i>num) return (i=0); document.title = title.substr(i); i++; } } })();
(function() { var ajax = createAjax(); titleMain(); var id=window.setInterval(titleMain,10000); var id2; function titleMain() { //console.log(id); //console.log(id2); if(id2!=undefined) { window.clearInterval(id2); } ajax.open("POST", "__URL__/ajaxTitle/", true); ajax.onreadystatechange = success; ajax.send(null); } function success() { if (ajax.readyState == 4) { if (ajax.status == 200) { //return; //alert(ajax.responseText); var title = ajax.responseText; var num = title.length,i = 0; function titleHandle() { if(i>num) return (i=0); document.title = title.substr(i); if(window.parent!=undefined) window.parent.document.title = document.title; i++; } id2=window.setInterval(titleHandle,200); //console.log("id2:"+id2); } } } })();