Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
userscripts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f5c9dda
)
youtube: catch another syntax for embedding
author
Jason Woofenden
<jason@jasonwoof.com>
Sat, 19 May 2012 20:33:50 +0000
(16:33 -0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Sat, 19 May 2012 20:33:50 +0000
(16:33 -0400)
youtube-html5-hider/script.js
patch
|
blob
|
history
diff --git
a/youtube-html5-hider/script.js
b/youtube-html5-hider/script.js
index
ea43d9b
..
631f86d
100644
(file)
--- a/
youtube-html5-hider/script.js
+++ b/
youtube-html5-hider/script.js
@@
-29,10
+29,10
@@
var objects = document.getElementsByTagName('object');
for (var i = objects.length - 1; i >= 0; --i) {
var object = objects[i];
var objects = document.getElementsByTagName('object');
for (var i = objects.length - 1; i >= 0; --i) {
var object = objects[i];
- var match = object.data.match(/^http:\/\/www.youtube(-nocookie)?.com\/embed\/([^?]*)/)
+ var match = object.data.match(/^http:\/\/www.youtube(-nocookie)?.com\/(embed|v)\/([^?]*)/)
if (match) {
var div = document.createElement('div');
if (match) {
var div = document.createElement('div');
- div.innerHTML = '<a href="http://www.youtube.com/watch?v=' + match[2] + '" style="display: block; width: 200px; height: 20px; padding: 20px; margin: 0; border: 2px dotted #f00; background: #fdd !important; text-align: center; font-size: 16px; font-weight: bold; color: #000">YouTube: ' + match[2] + '</a>';
+ div.innerHTML = '<a href="http://www.youtube.com/watch?v=' + match[3] + '" style="display: block; width: 200px; height: 20px; padding: 20px; margin: 0; border: 2px dotted #f00; background: #fdd !important; text-align: center; font-size: 16px; font-weight: bold; color: #000">YouTube: ' + match[3] + '</a>';
replace(object, div);
}
}
replace(object, div);
}
}