Permalink
Browse files

Fix youtube.

TIL two things: Youtube video ids can have underscores, and i broke
modifiers with this rewrite. Derp.
  • Loading branch information...
1 parent 1a1d094 commit f2ba21e6cb3a34e18503e33f63e318928b110e95 @mythmon committed Jan 12, 2013
Showing with 9 additions and 2 deletions.
  1. +6 −0 manager.js
  2. +3 −2 modifiers.js
View
@@ -83,6 +83,12 @@ cycleScreen = function(screen_id) {
/* Put new content on the next screen in the line up. */
exports.setUrl = function(url, screen_name, callback) {
var screen;
+
+ if (screens.length === 0) {
+ utils.async(callback, {msg: 'No screens.'});
+ return;
+ }
+
if (screen_name) {
screen = findScreen('name', screen_name, true);
}
View
@@ -10,13 +10,14 @@ exports.all.push(function blacklistNoodle(opts) {
}
});
-var youtube_re = RegExp('(youtube.com/watch\\?v=([A-Za-z0-9]+))|(youtu.be/([A-Za-z0-9]+))');
+var youtube_re = RegExp('(youtube.com/watch\\?v=([A-Za-z0-9_]+))|(youtu.be/([A-Za-z0-9]+))');
exports.all.push(function embedYoutube(opts) {
var match = youtube_re.exec(opts.url);
if (match) {
var id = match[2] || match[4];
return {
- url: 'http://www.youtube.com/embed/' + id + '?rel=0&autoplay=1'
+ url: 'http://www.youtube.com/embed/' + id + '?rel=0&autoplay=1',
+ type: 'url'
};
}
});

0 comments on commit f2ba21e

Please sign in to comment.