// set the style of the iframe
iframe.setAttribute('width', "100%");
iframe.setAttribute('height', "100%");
-
-
-
+ iframe.id= options.id;
+ iframe.src = options.src;
+ var temp = document.getElementById( options.target );
+
// get the options that the user included
if ( typeof options === "object" && "join" in options ) {
page = options;
// loop threw all of the webpages
Popcorn.forEach(page, function ( thispage ) {
- var temp = document.getElementById( thispage.target );
- iframe.setAttribute('id', thispage.id);
+
var exists = document.getElementById( thispage.id );
if ( this.currentTime() >= thispage.start && !exists && this.currentTime() <= thispage.end) {
//div.innerHTML = div.innerHTML + thispage.html;
// set the source of the webpage that this plugin should display
- iframe.setAttribute('src', thispage.src);
+
temp.appendChild(iframe);
}
}
}, this);
});
+
+ return this;
});
})(Popcorn);
\ No newline at end of file
test("Popcorn Webpage Plugin", function () {
+ var popped = Popcorn("#video")
+ expects = 2,
+ count = 0
+ ;
- // needs expectation
-
- var popped = Popcorn("#video"),
- expects = 4,
- count = 0;
-
expect(expects);
-
- function plus (){
- if(++count === expects){
- stop();
+
+ function plus() {
+ if( ++count===expects) {
+ start();
}
}
+ stop();
+
+
+ ok( 'webpages' in popped, "webpages is a mehtod of the popped instance");
+ plus();
+
popped.webpages({
id: "webpages-a",
- start: 0, // seconds
- end: 5, // seconds
+ start: 1, // seconds
+ end: 30, // seconds
src: 'http://www.webmademovies.org',
target: 'webpagediv'
- });
-
- popped.play();
+ }).play();
- ok( 'data' in popped, "popped has the data prop and therefore is a Popcorn object" )
- ok( 'webpages' in popped, "webpages is a mehtod of the popped instance");
+ setTimeout(function() {
+ ok( !!document.getElementsByTagName('iframe')[0], "iframe was created" );
+ plus();
+ }, 5000);
+
- ok( typeof popped.webpages === "function" , "webpages is a function");
- popped.exec(2, function(){
- ok( document.getElementById('webpages-a') , "iframe exists");
- })
});