LEFT | RIGHT |
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(badArgumentsRegex) | 95 runInPage(function(badArgumentsRegexSource) |
96 { | 96 { |
| 97 var badArgumentsRegex = new RegExp(badArgumentsRegexSource); |
| 98 |
97 // If history.pushState is available, YouTube uses the history API | 99 // If history.pushState is available, YouTube uses the history API |
98 // when navigation from one video to another, and tells the flash | 100 // when navigation from one video to another, and tells the flash |
99 // player with JavaScript which video and which ads to show next, | 101 // player with JavaScript which video and which ads to show next, |
100 // bypassing our flashvars rewrite code. So we disable | 102 // bypassing our flashvars rewrite code. So we disable |
101 // history.pushState before YouTube's JavaScript runs. | 103 // history.pushState before YouTube's JavaScript runs. |
102 History.prototype.pushState = undefined; | 104 History.prototype.pushState = undefined; |
103 | 105 |
104 // The HTML5 player is configured via ytplayer.config.args. We have | 106 // The HTML5 player is configured via ytplayer.config.args. We have |
105 // to make sure that ad-related arguments are ignored as they are set. | 107 // to make sure that ad-related arguments are ignored as they are set. |
106 var ytplayer = undefined; | 108 var ytplayer = undefined; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 }); | 164 }); |
163 | 165 |
164 config.args = rawConfig.args; | 166 config.args = rawConfig.args; |
165 } | 167 } |
166 } | 168 } |
167 }); | 169 }); |
168 | 170 |
169 ytplayer.config = rawYtplayer.config; | 171 ytplayer.config = rawYtplayer.config; |
170 } | 172 } |
171 }); | 173 }); |
172 }, badArgumentsRegex); | 174 }, badArgumentsRegex.source); |
173 })(); | 175 })(); |
LEFT | RIGHT |