Index: safari/include.youtube.js |
=================================================================== |
--- a/safari/include.youtube.js |
+++ b/safari/include.youtube.js |
@@ -68,23 +68,13 @@ |
player.parentNode.replaceChild(newPlayer, player); |
} |
- function runInPage(fn, arg) |
- { |
- var script = document.createElement("script"); |
- script.type = "application/javascript"; |
- script.async = false; |
- script.textContent = "(" + fn + ")(" + arg + ");"; |
- document.documentElement.appendChild(script); |
- document.documentElement.removeChild(script); |
- } |
- |
document.addEventListener("beforeload", function(event) |
{ |
if ((event.target.localName == "object" || event.target.localName == "embed") && /:\/\/[^\/]*\.ytimg\.com\//.test(event.url)) |
patchPlayer(event.target); |
}, true); |
- runInPage(function(badArgumentsRegex) |
+ runInPage(document, badArgumentsRegex, function(badArgumentsRegex) |
{ |
// If history.pushState is available, YouTube uses the history API |
// when navigation from one video to another, and tells the flash |
@@ -161,5 +151,5 @@ |
ytplayer.config = rawYtplayer.config; |
} |
}); |
- }, badArgumentsRegex); |
+ }); |
})(); |