]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Added twitter widget
authorScottDowne <sdowne@learn.senecac.on.ca>
Wed, 23 Jun 2010 15:35:15 +0000 (11:35 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Wed, 23 Jun 2010 15:35:15 +0000 (11:35 -0400)
index.html
popcorn.js
xml/webMadeMovies.xml

index 7c2167e70747c339742ea4a92908092d617a2a6d..dd921726b6ea7e6eaefdcd461a859ff7ff4f2966 100644 (file)
@@ -1,6 +1,7 @@
 <html> 
   <head> 
-    <title>html5 video demo</title>    
+    <title>html5 video demo</title> 
+    <script src="http://widgets.twimg.com/j/2/widget.js"></script>
     <script src="popcorn.js"></script>
     <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
     <style type="text/css" media="screen"> 
   </head> 
   <body> 
     <div id="container">
-      <video src="http://a52.video2.blip.tv/7320003802153/Etherworks-WebMadeMovies3BuildingABetterInternet799.ogg" data-timeline-sources="xml/webMadeMovies.xml" controls></video>
+      <video src="../webMadeMovies.ogg" data-timeline-sources="xml/webMadeMovies.xml" controls></video>
       <div id="sub"></div><br />
       <div id="tagthisvideo">In this video:<span id="inthisvideo"></span></div><br />
-      <div id="map"></div>
-    </div>
+      <div id="map"></div><br />
+      <div id="twitter"></div>
   </body> 
 </html> 
 
index 6eed955b6a27b5927894da6acdbff9470a01fc37..26e4f376eb7740dcc4b8ed370e2a294f059aa1ed 100644 (file)
     };
   };
 
-  var TwitterCommand = function(name, params, text) {}; // http://twitter.com/celinecelines
+  var TwitterCommand = function(name, params, text) {
+    VideoCommand.call(this, name, params, text);
+    // Setup a default, hidden div to hold the feed
+    this.target = document.createElement('div');
+    this.target.setAttribute('id', this.id);
+    document.getElementById(this.params.target).appendChild(this.target);
+    // Div is hidden by default
+    this.target.setAttribute('style', 'display:none');
+    new TWTR.Widget({
+      creator: true,
+      version: 2,
+      type: 'search',
+      id: this.target.getAttribute('id'),
+      search: this.params.source,
+      rpp: 30,
+      width: 250,
+      height: 200,
+      interval: 6000,
+      theme: {
+        shell: {
+          background: '#8ec1da',
+          color: '#ffffff'
+        },
+        tweets: {
+          background: '#ffffff',
+          color: '#444444',
+          links: '#1985b5'
+        }
+      },
+      features: {
+        loop: true,
+        timestamp: true,
+        avatars: true,
+        hashtags: true,
+        toptweets: true,
+        live: true,
+        scrollbar: false,
+        behavior: 'default'
+      }
+    }).render().start();
+
+    this.in = function() {
+      this.target.setAttribute('style', 'display:inline');
+    };
+    this.out = function() {
+      this.target.setAttribute('style', 'display:none');
+    };
+    this.preload = function() {}; // Probably going to need to preload this.
+  }; // http://twitter.com/celinecelines
 
   // Wrapper for accessing commands by name
   // commands[name].create() returns a new command of type name
       create: function(name, params, text) {
         return new MapCommand(name, params, text);
       }
+    },
+    twitter: {
+      create: function(name, params, text) {
+        return new TwitterCommand(name, params, text);
+      }
     }
   };
 
index da740592177e3e297e4de32f749d2ebc052392f0..ee5d5e22299dfa922e626d1d120c5adce9eea05f 100644 (file)
@@ -20,4 +20,6 @@
     <location id="map2" in="0:30" out="1:00" lat="43.771" long="-79.5" target="map" zoom="16"/>
     <location id="map3" in="1:00" out="1:30" lat="41.771" long="-76.5" target="map" zoom="16"/>
   </map>
+  <twitter in="0:10" out="0:30" source="#oilspill" target="twitter"/>
+  <twitter in="0:01" out="0:20" source="from:celinecelines" target="twitter"/>
 </popcorn>