]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Merge commit 'origin/0.4' into 358
authorAnna Sobiepanek <annaopensource@gmail.com>
Thu, 10 Mar 2011 19:46:42 +0000 (14:46 -0500)
committerAnna Sobiepanek <annaopensource@gmail.com>
Thu, 10 Mar 2011 19:46:42 +0000 (14:46 -0500)
Conflicts:
plugins/wikipedia/popcorn.wikipedia.js
plugins/wikipedia/popcorn.wikipedia.unit.js

1  2 
plugins/wikipedia/popcorn.wikipedia.js
plugins/wikipedia/popcorn.wikipedia.unit.js

index a311f9c4cc210dac0f5854220028685cf5a1c8a9,ce143803eea595848c4301c086d2cf769ca1bdaa..e36e41a4272dfebcaab1b2071789a390a58d2a27
@@@ -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 
index 4e0c11830dce306986008774e40e5c7a24b99909,00f651de121436d49dcf3d5ff31c81b7f6ed3ad2..d3497bfda3b226ac09bf06027c22d4ce25483db9
@@@ -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();
 +  });
-    
  });