Note that there are some explanatory texts on larger screens.

plurals
  1. POmouse event weirdness
    primarykey
    data
    text
    <p>Here is the greasemonkey script I'm working on (source below): <a href="http://userscripts.org/scripts/show/69722" rel="nofollow noreferrer">http://userscripts.org/scripts/show/69722</a></p> <p>You can test it out on this page: <a href="http://forums.whirlpool.net.au/forum/35" rel="nofollow noreferrer">http://forums.whirlpool.net.au/forum/35</a></p> <p>Hover over a thread title and a div appears with a preview.</p> <p>The weird thing is, when you move your mouse around on the div, the 'mouseout' event is getting fired for some reason.</p> <p>Anyone have any ideas as to why this is happening?</p> <pre><code>// ==UserScript== // @name Whirlpool Mouseover Thread Title // @namespace blurg! // @description Whirlpool Mouseover Thread Title Preview // @include http://forums.whirlpool.net.au/forum/* // @version 0.2 // ==/UserScript== var tPrev={ reginald:document.URL.match(new RegExp(/\/100$|\/82$|\/9$|\/107$|\/135$|\/80$|\/136$|\/125$|\/116$|\/63$|\/127$|\/139$|\/7$|\/129$|\/130$|\/131$|\/10$|\/38$|\/39$|\/91$|\/87$|\/112$|\/132$|\/8$|\/83$|\/138$|\/58$|\/106$|\/126$|\/35$|\/92$|\/137$|\/114$|\/123$|\/128$|\/18$|\/14$|\/15$|\/68$|\/72$|\/69$|\/94$|\/90$|\/102$|\/105$|\/109$|\/119$|\/108$|\/31$|\/67$|\/5$/)), grabTrs:document.querySelectorAll("#threads&gt;table&gt;tbody&gt;tr:not(.pointer):not(.deleted):not(.section) a.title"), element:null, threadNum:null, modal:document.createElement('div'), modalFunc:null, modalReset:null, onModal:null, mouseoot:false, mousePos:{ y:0, x:0 }, tyme:{ over:0, out:0 }, sTo:null }; if(tPrev.reginald){ GM_addStyle('#tPrev_modal{position:absolute;z-index:50;width:500px;height:200px;background-color:white;border:3px solid grey;display:none;overflow:scroll;font-size:0.8em;}.advertising_block{display:none !important;}'); tPrev.modal.setAttribute('id','tPrev_modal'); document.body.appendChild(tPrev.modal); /*console.log(tPrev.onModal); tPrev.modalReset=function(w){ clearInterval(tPrev.sTo); if(w=='link' &amp;&amp; tPrev.onModal){ return; } if(w=='div'){ tPrev.onModal=false; } };*/ [].forEach.call(tPrev.grabTrs, function (item) { item.addEventListener('mouseover',function(e){ tPrev.element=this; //tPrev.findMousePosition(e); tPrev.mousePos.x = e.clientX+window.pageXOffset; tPrev.mousePos.y=(e.clientY+window.pageYOffset)-50; tPrev.threadNum=tPrev.element.href.split('t=')[1]; tPrev.tyme.over=Date.now(); tPrev.sTo=setInterval(function(){ if((Date.now()-tPrev.tyme.over)&gt;2000){ clearInterval(tPrev.sTo); tPrev.modal.style.display='block'; tPrev.modal.style.left=tPrev.mousePos.x+'px'; tPrev.modal.style.top=tPrev.mousePos.y+'px'; //tPrev.onModal=true; GM_xmlhttpRequest({ method: "GET", url: 'http://74.125.155.132/search?q=cache:forums.whirlpool.net.au/forum-replies-archive.cfm/'+tPrev.threadNum+'.html', onload: function(r) { var rt=r.responseText; var inOf = rt.indexOf('&lt;td class="bodyuser"&gt;'); if(inOf&gt;-1){ var iH1=rt.substring(inOf,rt.indexOf('&lt;div class="footbar"&gt;')); tPrev.modal.innerHTML='&lt;tbody&gt;&lt;tr&gt;'+iH1; //console.log('onload '+tPrev.onModal); } else{ tPrev.modal.innerHTML='&lt;p style="font-size:1.5em;"&gt;Preview not available&lt;/p&gt;'; } }, onerror: function(e) { tPrev.modal.innerHTML='&lt;p style="font-size:1.5em;"&gt;Preview not available&lt;/p&gt;'; } }); } },50); }, false); item.addEventListener('mouseout',function(e){ clearInterval(tPrev.sTo); //console.log('item mouseout '+tPrev.onModal); }, false); }); //tPrev.modal.addEventListener('mouseover',function(e){tPrev.onModal=true;console.log('tPrev mouseout '+tPrev.onModal);}, false); tPrev.modal.addEventListener('mouseover',function(e){ console.log('tPrev mouseover '); }, false); tPrev.mouseoot=tPrev.modal.addEventListener('mouseout',function(ev){ console.log('tPrev mouseout '); /*tPrev.element=null; tPrev.modal.innerHTML=''; tPrev.modal.style.display='none'; tPrev.tyme.over=0;*/ //this.removeEventListener('mouseout', tPrev.mouseoot, false); }, false); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload