From: Daniel Brooks Date: Sat, 19 Feb 2011 19:16:22 +0000 (-0600) Subject: [#336] simplify webpage plugin X-Git-Tag: v0.4~43^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=dd548c4b7cc73583767d8cfba251829d9ccbc586;p=popcorn-js.git [#336] simplify webpage plugin --- diff --git a/plugins/webpage/popcorn.webpage.js b/plugins/webpage/popcorn.webpage.js index 5dc0eff..0d02fad 100644 --- a/plugins/webpage/popcorn.webpage.js +++ b/plugins/webpage/popcorn.webpage.js @@ -26,61 +26,56 @@ } ) * */ - Popcorn.plugin( "webpage" , (function(){ - - return { - manifest: { - about:{ - name: "Popcorn Webpage Plugin", - version: "0.1", - author: "@annasob", - website: "annasob.wordpress.com" - }, - options:{ - id : {elem:'input', type:'text', label:'Id'}, - start : {elem:'input', type:'text', label:'In'}, - end : {elem:'input', type:'text', label:'Out'}, - src : {elem:'input', type:'text', label:'Src'}, - target : 'iframe-container' - } + Popcorn.plugin( "webpage" , { + manifest: { + about:{ + name: "Popcorn Webpage Plugin", + version: "0.1", + author: "@annasob", + website: "annasob.wordpress.com" }, - _setup : function( options ) { - // make an iframe - options._iframe = document.createElement( 'iframe' ), - options._iframe.setAttribute('width', "100%"); - options._iframe.setAttribute('height', "100%"); - options._iframe.id = options.id; - options._iframe.src = options.src; - options._iframe.style.display = 'none'; - // add the hidden iframe to the DOM - if ( document.getElementById( options.target ) ) { - document.getElementById( options.target ).appendChild(options._iframe); - } - - }, - /** - * @member webpage - * The start function will be executed when the currentTime - * of the video reaches the start time provided by the - * options variable - */ - start: function(event, options){ - // make the iframe visible - options._iframe.style.display = 'inline'; - }, - /** - * @member webpage - * The end function will be executed when the currentTime - * of the video reaches the end time provided by the - * options variable - */ - end: function(event, options){ - // make the iframe invisible - options._iframe.style.display = 'none'; + options:{ + id : {elem:'input', type:'text', label:'Id'}, + start : {elem:'input', type:'text', label:'In'}, + end : {elem:'input', type:'text', label:'Out'}, + src : {elem:'input', type:'text', label:'Src'}, + target : 'iframe-container' + } + }, + _setup : function( options ) { + // make an iframe + options._iframe = document.createElement( 'iframe' ), + options._iframe.setAttribute('width', "100%"); + options._iframe.setAttribute('height', "100%"); + options._iframe.id = options.id; + options._iframe.src = options.src; + options._iframe.style.display = 'none'; + // add the hidden iframe to the DOM + if ( document.getElementById( options.target ) ) { + document.getElementById( options.target ).appendChild(options._iframe); } - }; + }, + /** + * @member webpage + * The start function will be executed when the currentTime + * of the video reaches the start time provided by the + * options variable + */ + start: function(event, options){ + // make the iframe visible + options._iframe.style.display = 'inline'; + }, + /** + * @member webpage + * The end function will be executed when the currentTime + * of the video reaches the end time provided by the + * options variable + */ + end: function(event, options){ + // make the iframe invisible + options._iframe.style.display = 'none'; + } - })()); - -})( Popcorn ); \ No newline at end of file + }); +})( Popcorn );