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:
4f4e5d9
)
extend youtube blocker
author
Jason Woofenden
<jason@jasonwoof.com>
Tue, 8 May 2012 04:14:09 +0000
(
00:14
-0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Tue, 8 May 2012 04:14:09 +0000
(
00:14
-0400)
youtube-html5-hider/script.js
patch
|
blob
|
history
diff --git
a/youtube-html5-hider/script.js
b/youtube-html5-hider/script.js
index
9e6585b
..
ea43d9b
100644
(file)
--- a/
youtube-html5-hider/script.js
+++ b/
youtube-html5-hider/script.js
@@
-18,10
+18,10
@@
var iframes = document.getElementsByTagName('iframe');
for (var i = iframes.length - 1; i >= 0; --i) {
var iframe = iframes[i];
var iframes = document.getElementsByTagName('iframe');
for (var i = iframes.length - 1; i >= 0; --i) {
var iframe = iframes[i];
- var match = iframe.src.match(/^http:\/\/www.youtube.com\/embed\/([^?]*)/)
+ var match = iframe.src.match(/^http:\/\/www.youtube(-nocookie)?.com\/embed\/([^?]*)/)
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[1] + '" 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[1] + '</a>';
+ 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>';
replace(iframe, div);
}
}
replace(iframe, div);
}
}
@@
-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.com\/embed\/([^?]*)/)
+ var match = object.data.match(/^http:\/\/www.youtube(-nocookie)?.com\/embed\/([^?]*)/)
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[1] + '" 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[1] + '</a>';
+ 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>';
replace(object, div);
}
}
replace(object, div);
}
}