]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#565] Made some perf changes as well as some style fixes
authorDavid Seifried <david.c.seifried@gmail.com>
Thu, 23 Jun 2011 17:25:51 +0000 (13:25 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Thu, 23 Jun 2011 17:25:51 +0000 (13:25 -0400)
plugins/subtitle/popcorn.subtitle.js

index c1fb4e81d13f5769c2633f70950c7c24a9cc1cfb..37049e89f7e3a84e4f0ef010862fd3e7a01617e8 100755 (executable)
@@ -6,7 +6,7 @@
       i = 0,
       callBack = function( data ) {
 
-        if ( typeof google !== 'undefined' && google.load ) {
+        if ( typeof google !== "undefined" && google.load ) {
 
           google.load( "language", "1", { 
             callback: function() {
 
           // the video element must have height and width defined
           style.fontSize = "18px";
-          style.width = context.media.offsetWidth + "px";
-          style.top = context.position().top  + context.media.offsetHeight - context.container.offsetHeight - 40 + "px";
-          style.left = context.position().left + "px";
+          style.width = media.offsetWidth + "px";
+          style.top = position.top  + media.offsetHeight - ctxContainer.offsetHeight - 40 + "px";
+          style.left = position.left + "px";
 
           setTimeout( updatePosition, 10 );
         };
 
-        var ctxContainer = context.container = document.createElement( 'div' ),
-            style = ctxContainer.style;
+        var ctxContainer = context.container = document.createElement( "div" ),
+            style = ctxContainer.style,
+            position = context.position(),
+            media = context.media;
 
         ctxContainer.id = "subtitlediv";
         style.position = "absolute";
         // if a target is specified, use that
         if ( options.target && options.target !== "subtitle-container" ) {
           options.container = document.getElementById( options.target );
-        } else { // use shared default container
+        } else { 
+          // use shared default container
           options.container = this.container;
         }