From: Anna Sobiepanek Date: Thu, 10 Mar 2011 19:46:42 +0000 (-0500) Subject: Merge commit 'origin/0.4' into 358 X-Git-Tag: v0.4~14^2~2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=43f14ad0eea67a1576dd57719da356d857049dfd;p=popcorn-js.git Merge commit 'origin/0.4' into 358 Conflicts: plugins/wikipedia/popcorn.wikipedia.js plugins/wikipedia/popcorn.wikipedia.unit.js --- 43f14ad0eea67a1576dd57719da356d857049dfd diff --cc plugins/wikipedia/popcorn.wikipedia.js index a311f9c,ce14380..e36e41a --- a/plugins/wikipedia/popcorn.wikipedia.js +++ b/plugins/wikipedia/popcorn.wikipedia.js @@@ -87,11 -87,7 +87,8 @@@ var wikiCallback options._fired = true; }; - var head = document.getElementsByTagName( "head" )[0]; - var script = document.createElement( "script" ); - script.src = "http://" + options.lang + ".wikipedia.org/w/api.php?action=parse&props=text&page=" + ( options.src.slice( options.src.lastIndexOf("/")+1) ) + "&format=json&callback=wikiCallback" + _guid; + Popcorn.getScript("http://" + options.lang + ".wikipedia.org/w/api.php?action=parse&props=text&page=" + ( options.title || options.src.slice( options.src.lastIndexOf("/")+1) ) + "&format=json&callback=wikiCallback" + _guid); + - head.insertBefore( script, head.firstChild ); }, /** * @member wikipedia diff --cc plugins/wikipedia/popcorn.wikipedia.unit.js index 4e0c118,00f651d..d3497bf --- a/plugins/wikipedia/popcorn.wikipedia.unit.js +++ b/plugins/wikipedia/popcorn.wikipedia.unit.js @@@ -36,30 -41,40 +36,29 @@@ test("Popcorn wikipedia Plugin", functi } ) .volume(0) .play(); + + popped.exec( 5, function() { + ok (theArticle.innerHTML !== "", "wikidiv now contains information" ); + plus(); + equals (theArticle.childElementCount, 2, "wikidiv now contains two child elements" ); + plus(); + equals (theArticle.childElement[0].innerHTML, "this is an article", "wikidiv has the right title" ); + plus(); + equals (theArticle.childElement[1].innerHTML, "Cape Town metropolitan municipality. It is the provincial capital and primate city ...", "wikidiv has the right content" ); + plus(); + }); + popped.exec( 10, function() { + equals (theArticle.innerHTML, "", "wikidiv was cleared properly" ); + plus(); + }); - wikiInterval = setInterval( function() { - if( popped.currentTime() > 5 && popped.currentTime() <= 10 ) { - ok (theArticle.innerHTML !== "", "wikidiv now contains information" ); - plus(); - equals (theArticle.childElementCount, 2, "wikidiv now contains two child elements" ); - plus(); - equals (theArticle.childElement[0].innerHTML, "this is an article", "wikidiv has the right title" ); - plus(); - equals (theArticle.childElement[1].innerHTML, "Cape Town is the second-most populous city in South Africa, and the largest in land area, forming part of the City of Cape Town metropolitan municipality. It is the provincial capital and primate city ...", "wikidiv has the right content" ); - plus(); - clearInterval( wikiInterval ); - } - }, 3000); - - wikiInterval2 = setInterval( function() { - if( popped.currentTime() > 10 && popped.currentTime() < 12 ) { - equals (theArticle.innerHTML, "", "wikidiv was cleared properly" ); - plus(); - clearInterval( wikiInterval2 ); - } - }, 3000); - - wikiInterval3 = setInterval( function() { - if( popped.currentTime() > 13 && popped.currentTime() <= 20 ) { - ok (theArticle.innerHTML !== "", "wikidiv now contains information" ); - plus(); - equals (theArticle.childElementCount, 2, "wikidiv now contains two child elements" ); - plus(); - equals (theArticle.childElement[1].innerHTML, "São Paulo is the largest city in Brazil, the largest city in the southern hemisphere, and the world's 7th largest metropolitan area. The city is the capital of the state of São Paulo, the most populou ...", "wikidiv has the right content" ); - plus(); - clearInterval( wikiInterval3 ); - } - }, 3000); - + popped.exec( 13, function() { + ok (theArticle.innerHTML !== "", "wikidiv now contains information" ); + plus(); + equals (theArticle.childElementCount, 2, "wikidiv now contains two child elements" ); + plus(); + equals (theArticle.childElement[1].innerHTML, "São Paulo is the largest city in Brazil, the largest city in the southern hemisphere, and the world's 7th largest metropolitan area. The city is the capital of the state of São Paulo, the most populou ...", "wikidiv has the right content" ); + plus(); + }); - });