Created
September 2, 2013 08:50
-
-
Save mickaelandrieu/6410699 to your computer and use it in GitHub Desktop.
Faire clignoter un onglet de navigateur
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
/* variables à paramétrer */ | |
var texteAlert='!!! New Message !!!'; | |
var periodeTest= 0.5; | |
var periodeWink= 0.5; | |
var arretAuto= 60; | |
var numFrame= 0; | |
/* code à ne pas trop toucher sans s'y connaitre */ | |
while(parent.frames[numFrame]&&numFrame<7)numFrame++; if(numFrame<7&&navigator.appName!='Microsoft Internet Explorer'&& document.getElementById('i_icon_mini_logout')){var oldCCB;var oldDCB;var pageTitle=document.title; var INTCB;function stopINT(){ if(INTCB!=undefined){clearInterval(INTCB);document.title=pageTitle;} return true;} function checkCB(){ if(parent.frames[numFrame].connected){ parent.frames[numFrame].document.getElementById('refresh_auto').checked=true; var newDCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFrame].document.getElementById('chatbox').childNodes.length-1].firstChild.innerHTML; if(newDCB!=oldDCB){oldDCB=newDCB;var newCCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFrame].document.getElementById('chatbox').childNodes.length-1].childNodes[2].innerHTML; stopINT();if(newCCB!=oldCCB){ oldCCB=newCCB;INTCB=setInterval("document.title=(document.title==pageTitle)?texteAlert:pageTitle;",periodeWink*1000); setTimeout('stopINT()',arretAuto*1000);}}}else {stopINT();}} window.onload=function() { oldDCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFrame].document.getElementById('chatbox').childNodes.length-1].firstChild.innerHTML;oldCCB= parent.frames[numFrame].document.getElementById('chatbox').childNodes[ parent.frames[numFrame].document.getElementById('chatbox').childNodes.length-1].childNodes[2].innerHTML; setInterval('checkCB()',periodeTest*1000); parent.frames[numFrame].onfocus= parent.frames[numFrame].onkeypress= parent.frames[numFrame].onclick= parent.frames[numFrame].onblur=stopINT;}} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
j'ai du mal à faire fonctionner le script, ne sachant à quel chat il se rapporte...
J'imagine que je dois construire les quelques éléments appelés par getElementById, ce que j'ai fait, mais rien ne bouge. De plus comme je dois coder pour Chrome (sic) qui ne gère pas proprement le window.focus/blur, je suis un peu perdu.
Merci d'avance pour quelques éclaircissements.