OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (flashvarsChanged) | 85 if (flashvarsChanged) |
86 player.parentNode.replaceChild(newPlayer, player); | 86 player.parentNode.replaceChild(newPlayer, player); |
87 } | 87 } |
88 | 88 |
89 document.addEventListener("beforeload", function(event) | 89 document.addEventListener("beforeload", function(event) |
90 { | 90 { |
91 if ((event.target.localName == "object" || event.target.localName == "embed"
) && /:\/\/[^\/]*\.ytimg\.com\//.test(event.url)) | 91 if ((event.target.localName == "object" || event.target.localName == "embed"
) && /:\/\/[^\/]*\.ytimg\.com\//.test(event.url)) |
92 patchPlayer(event.target); | 92 patchPlayer(event.target); |
93 }, true); | 93 }, true); |
94 | 94 |
95 runInPage(function(badArgumentsRegexSource) | 95 runInDocument(document, function(badArgumentsRegexSource) |
96 { | 96 { |
97 var badArgumentsRegex = new RegExp(badArgumentsRegexSource); | 97 var badArgumentsRegex = new RegExp(badArgumentsRegexSource); |
98 | 98 |
99 // If history.pushState is available, YouTube uses the history API | 99 // If history.pushState is available, YouTube uses the history API |
100 // when navigation from one video to another, and tells the flash | 100 // when navigation from one video to another, and tells the flash |
101 // player with JavaScript which video and which ads to show next, | 101 // player with JavaScript which video and which ads to show next, |
102 // bypassing our flashvars rewrite code. So we disable | 102 // bypassing our flashvars rewrite code. So we disable |
103 // history.pushState before YouTube's JavaScript runs. | 103 // history.pushState before YouTube's JavaScript runs. |
104 History.prototype.pushState = undefined; | 104 History.prototype.pushState = undefined; |
105 | 105 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 config.args = rawConfig.args; | 166 config.args = rawConfig.args; |
167 } | 167 } |
168 } | 168 } |
169 }); | 169 }); |
170 | 170 |
171 ytplayer.config = rawYtplayer.config; | 171 ytplayer.config = rawYtplayer.config; |
172 } | 172 } |
173 }); | 173 }); |
174 }, badArgumentsRegex.source); | 174 }, badArgumentsRegex.source); |
175 })(); | 175 })(); |
OLD | NEW |