]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
final touches [#33 state:peer-review-requested]
authorAnna Sobiepanek <annaopensource@gmail.com>
Wed, 30 Jun 2010 16:59:46 +0000 (12:59 -0400)
committerAnna Sobiepanek <annaopensource@gmail.com>
Wed, 30 Jun 2010 16:59:46 +0000 (12:59 -0400)
index.html
popcorn.js
xml/webMadeMovies.xml

index 88921f5c20a7a51698346c409031abb3d9ba82fc..58f6bbc61a753e688ae75661c4f54797f24b8d3c 100644 (file)
                        </h3> 
                        <a href="#" class="collapse"><span>Collapse</span></a>
 
-                       <div class="content">
-                       Use the #Evernote Fx Add-on to save, organize, & search info you find on the Web http://bit.ly/evernotewebclipper /via @rockyourfirefox
-                       <a href="#" class="more">more</a>
+                       <div class="content" id="wikidiv">
+                       
                        </div>
                        </section>
             <section>
index 089be9b75282f5defc2bf80521b4080bf4cb7d40..7f8ec8a83449c42e10c5961a34fd97285a5e7563 100644 (file)
     };
   };
        
-       ////////////////////////////////////////////////////////////////////////////
+  ////////////////////////////////////////////////////////////////////////////
   // Wiki Command
   ////////////////////////////////////////////////////////////////////////////
   
     VideoCommand.call(this, name, params, text, videoManager);
     
     var src = this.params.src;
+    var length = this.params.numberOfWords;
     // Setup a default, hidden div to hold the images
     var target = document.createElement('div');
     target.setAttribute('id', this.id);
     document.getElementById(this.params.target).appendChild(target);
     // Div is hidden by default
     target.setAttribute('style', 'display:none');
-   
     // This uses jquery
-    $.getJSON("http://en.wikipedia.org/w/api.php?action=parse&props=text&page=" + this.params.title+ "&format=json&callback=?", function(data){
-      //$.each(data.parse, function(i, item) {
+    $.getJSON("http://en.wikipedia.org/w/api.php?action=parse&props=text&page=" + ( this.params.title || src.slice(src.lastIndexOf("/")+1) ) + "&format=json&callback=?", function(data){
+      if( data ) {
+        //make a link to the document
         var link = document.createElement('a');
         link.setAttribute('href', src);
         var p = document.createElement('p');
         p.innerHTML = data.parse.displaytitle;
         link.appendChild(p);
+        // get the first 140 characters of the wiki content
         var desc = document.createElement('p');
-        //((<(.|\n)+?>)|\[(.*?)\]|\((.*?)\))
         var text = data.parse.text.*.substr(data.parse.text.*.indexOf('<p>'));
-        text = text.replace(/(<(.|\n)+?>)|\((.*?)\)|\[(.*?)\]/g, "");
-        alert(text);desc.innerHTML = text;
+        text = text.replace(/((<(.|\n)+?>)|(\((.*?)\) )|(\[(.*?)\]))/g, "");
+        desc.innerHTML = text.substr(0, ( length || 140 )) + " ...";
         target.appendChild(link);
         target.appendChild(desc);
-      //});
+      }
     }); 
     
     this.target = target;
-    //this.onIn = function() {
+    this.onIn = function() {
       this.target.setAttribute('style', 'display:inline');
-    //};
+    };
     this.onOut = function() {
-      //this.target.setAttribute('style', 'display:none');
+      this.target.setAttribute('style', 'display:none');
     };
        };
   ////////////////////////////////////////////////////////////////////////////
index 6adfca6221f82d1a7c6ebd5d862c229e5dda8e7f..22576a289b85da01d19c98dafddb41850d1a9785 100644 (file)
@@ -21,6 +21,7 @@
     <places>
       <place id="acc" type="building" name="Austin Convention Center">
         <resource id="acchomepage" src="http://www.austinconventioncenter.com/" description="Austin Convention Center"/>
+        <resource id="accwiki" src="http://en.wikipedia.org/wiki/Austin_Convention_Center" description="Austin Convention Center Wiki"/>
       </place>
       <place id="saopaulo" type="city" name="Sao Paulo">
         <resource id="saupaulowiki" src="http://en.wikipedia.org/wiki/S%C3%A3o_Paulo" title="S%C3%A3o_Paulo" description="Sao Paulo city, Brazil"/>
@@ -60,7 +61,8 @@
     <resources>
       <twitter source="#oilspill" title="BP Oil Spill" target="twitter" width="238" height="160"/>
       <twitter in="00:00:01:00" out="00:00:20:00" title="Celine Celine" source="from:celinecelines" target="personaltwitter" width="238" height="120"/>
-      <wiki in="00:00:02:00" out="00:01:00:00" resourceid="saupaulowiki" target="wikidiv"/>
+      <wiki in="00:00:02:00" out="00:00:15:00" resourceid="saupaulowiki" numberOfWords="200" target="wikidiv"/>
+      <wiki in="00:00:10:00" out="00:00:25:00" resourceid="accwiki" target="wikidiv"/>
       <attribution in="00:00:1:00" out="00:40:00" target="container5" resourceid="attrib" />
       <attribution in="00:42:00" out="00:00:48:00" target="container5">A Shared Culture, Jesse Dylan</attribution>
       <flickr in="00:01:00" out="00:20:00" target="flickr" userid="13072070" numberofimages="8" padding="4px"/>