]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#384] made a few styling changes, and fixed some minor issues
authorDavid Seifried <david.c.seifried@gmail.com>
Tue, 7 Jun 2011 13:30:41 +0000 (09:30 -0400)
committerDavid Seifried <david.c.seifried@gmail.com>
Tue, 7 Jun 2011 13:30:41 +0000 (09:30 -0400)
plugins/timeline/popcorn.timeline.js

index de3a8a730b15ab5f040a41637f6411a1e1149d51..3830fd0591f1bc14a86819416caa19cf6dbd3682 100644 (file)
 
   Popcorn.plugin( "timeline" , function( options ) {
 
+    var target = document.getElementById( options.target );
+
     // create a new div and append it to the parent div so nothing
     // that already exists in the parent div gets overwritten
     var newdiv = document.createElement( "div" );
     newdiv.style.display = "none";
     newdiv.id = "timelineDiv"+i;
 
-    if ( document.getElementById( options.target ) ) {
+    if ( target ) {
 
-      document.getElementById( options.target ).appendChild( newdiv );
+      target.appendChild( newdiv );
 
       // if this isnt the first div added to the target div
       if( i ){
 
         // insert the current div before the previous div inserted
-        document.getElementById( options.target ).insertBefore( newdiv, document.getElementById( "timelineDiv" + ( i - 1 ) ) );
+        target.insertBefore( newdiv, document.getElementById( "timelineDiv" + ( i - 1 ) ) );
        }
     }
     
     //options.innerHTML = options.innerHTML || "";    
 
     newdiv.innerHTML = "<p><span id='big'>" + options.title + "</span><br />" +
-    "<span id='mid'>" + options.text + "<br />" + options.innerHTML;
+    "<span id='mid'>" + options.text + "</span><br />" + options.innerHTML;
     
     return {
 
       start: function( event, options ){
-        newdiv.setAttribute( "style", "display:block" );
+        newdiv.style.display = "block";
       },
  
       end: function( event, options ){
-        newdiv.setAttribute( "style", "display:none" );
+        newdiv.style.display = "none";
       },
 
       _teardown: function( options ) {
-        while ( document.getElementById( options.target ).childNodes.length >= 1 )
-        {
-            document.getElementById( options.target ).removeChild( document.getElementById( options.target ).firstChild );       
+        while ( target.childNodes.length >= 1 ) {
+            target.removeChild( document.getElementById( options.target ).firstChild );       
         }  
       }
     };