From ecb8fb0230cffaa13d3361c96f6597e4219db7c3 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Tue, 7 Jun 2011 09:30:41 -0400 Subject: [PATCH] [#384] made a few styling changes, and fixed some minor issues --- plugins/timeline/popcorn.timeline.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/timeline/popcorn.timeline.js b/plugins/timeline/popcorn.timeline.js index de3a8a7..3830fd0 100644 --- a/plugins/timeline/popcorn.timeline.js +++ b/plugins/timeline/popcorn.timeline.js @@ -38,21 +38,23 @@ 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 ) ) ); } } @@ -62,22 +64,21 @@ //options.innerHTML = options.innerHTML || ""; newdiv.innerHTML = "

" + options.title + "
" + - "" + options.text + "
" + options.innerHTML; + "" + options.text + "
" + 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 ); } } }; -- 2.43.0