Browse files

added support for previous

  • Loading branch information...
1 parent 2d703ad commit dbdaa2594cb93e95a184ea4ba1877572e4144b61 @chrisb committed Apr 7, 2010
Showing with 12 additions and 2 deletions.
  1. +10 −0 public/javascripts/dubbit.js
  2. +2 −2 views/index.haml
View
10 public/javascripts/dubbit.js
@@ -40,6 +40,16 @@ function nextVideo() {
}
}
+function prevVideo() {
+ currentVideoIndex--;
+ var nextVideo = playlist[currentVideoIndex];
+ if(nextVideo==null) {
+ alert('Out of content :(')
+ } else {
+ embedVideo(nextVideo);
+ }
+}
+
function onytplayerStateChange(newState) {
if(newState==0) {
log('Video has finished playing!')
View
4 views/index.haml
@@ -9,7 +9,7 @@
%h2 /r/dubstep video browser
%h1 What's up, dude?
#controls
- %a.prev{ :href => 'javascript:void(0);', :onClick => 'nextVideo(); return false;' } Previous
+ %a.prev{ :href => 'javascript:void(0);', :onClick => 'prevVideo(); return false;' } Previous
%a.next{ :href => 'javascript:void(0);', :onClick => 'nextVideo(); return false;' } Next
%div.clear
#player-container
@@ -18,6 +18,6 @@
Built w/Ruby + Sinatra:
%a{ :href => 'http://github.com/chrisb/sinatra-reddit-video-player' } Source Code @ GitHub
|
- %a{ :href => 'http://github.com/chrisb/sinatra-reddit-video-player' } Feedback/Discuss
+ %a{ :href => 'http://www.reddit.com/r/dubstep/comments/bnujw/another_rdubstep_player_but_with_continuous_play/' } Feedback/Discuss
:javascript
var playlist = [ #{@db[:videos].all.map { |r| r.to_json }.join(',')} ];

0 comments on commit dbdaa25

Please sign in to comment.