[xiph-commits] r17411 - websites/xiph.org/video

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Sep 21 20:58:54 PDT 2010


Author: xiphmont
Date: 2010-09-21 20:58:53 -0700 (Tue, 21 Sep 2010)
New Revision: 17411

Modified:
   websites/xiph.org/video/video.js
Log:
More scripting dance to have the Chrome menu pop fixes without 
triggering weird behavior from Firefox, which pops focus/blur events 
when the mouse leaves the browser window.



Modified: websites/xiph.org/video/video.js
===================================================================
--- websites/xiph.org/video/video.js	2010-09-21 21:53:48 UTC (rev 17410)
+++ websites/xiph.org/video/video.js	2010-09-22 03:58:53 UTC (rev 17411)
@@ -175,11 +175,14 @@
     stick=0;
 }
 
+var focused_el = 0;
 function hideControls(el){
     if(!stick && !mousein){
         var wrapper = findUnder(el,'.vcwrapper');
         if(!wrapper)return;
         $(wrapper).animate({opacity: 0.}, {duration: 160, queue: false});
+        el.blur();
+        focused_el=0;
     }
 }
 
@@ -188,6 +191,7 @@
 // mousedown.  Sadly, Chrome does not seem to fire any events at all
 // when a Select box is activated by keyboard, only if an option is
 // selected.
+
 function stickControls(el){
     showControls(el);
     stick=1;
@@ -197,6 +201,13 @@
     stick=0;
 }
 
+function focusControl(el){
+    if(!focused_el || el != focused_el){
+        focused_el = el;
+        stickControls(el);
+    }
+}
+
 $(document).ready(function() {
 
         // Run the Safari conditional applet fix
@@ -216,14 +227,14 @@
                 this.onkeydown=function(){stickControls(this);};
                 this.onblur=function(){unstickControls(this);hideControls(this);};
                 this.onselect=function(){unstickControls(this);};
-                this.onfocus=function(){stickControls(this);};
+                this.onfocus=function(){focusControl(this);};
                 this.onchange=function(){SetSubtitles(this);};
                 SetSubtitles(this);
             });
         $('.video-select').each(function() {
                 this.onmousedown=function(){stickControls(this);};
                 this.onkeydown=function(){stickControls(this);};
-                this.onfocus=function(){stickControls(this);};
+                this.onfocus=function(){focusControl(this);};
                 this.onblur=function(){unstickControls(this);hideControls(this);};
                 this.onselect=function(){unstickControls(this);};
                 this.onchange=function(){SetVideo(this);};
@@ -234,7 +245,7 @@
                 this.onkeydown=function(){stickControls(this);};
                 this.onblur=function(){unstickControls(this);hideControls(this);};
                 this.onselect=function(){unstickControls(this);};
-                this.onfocus=function(){stickControls(this);};
+                this.onfocus=function(){focusControl(this);};
                 this.onchange=function(){SetTime(this);};
             });
     });



More information about the commits mailing list