| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 param.setAttribute("value", newValue); | 79 param.setAttribute("value", newValue); |
| 80 flashvarsChanged = true; | 80 flashvarsChanged = true; |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 if (flashvarsChanged) | 85 if (flashvarsChanged) |
| 86 player.parentNode.replaceChild(newPlayer, player); | 86 player.parentNode.replaceChild(newPlayer, player); |
| 87 } | 87 } |
| 88 | 88 |
| 89 function runInPage(fn, arg) | |
| 90 { | |
| 91 var script = document.createElement("script"); | |
| 92 script.type = "application/javascript"; | |
| 93 script.async = false; | |
| 94 script.textContent = "(" + fn + ")(" + arg + ");"; | |
| 95 document.documentElement.appendChild(script); | |
| 96 document.documentElement.removeChild(script); | |
| 97 } | |
| 98 | |
| 99 document.addEventListener("beforeload", function(event) | 89 document.addEventListener("beforeload", function(event) |
| 100 { | 90 { |
| 101 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)) |
| 102 patchPlayer(event.target); | 92 patchPlayer(event.target); |
| 103 }, true); | 93 }, true); |
| 104 | 94 |
| 105 runInPage(function(badArgumentsRegex) | 95 runInPage(function(badArgumentsRegex) |
| 106 { | 96 { |
| 107 // If history.pushState is available, YouTube uses the history API | 97 // If history.pushState is available, YouTube uses the history API |
| 108 // when navigation from one video to another, and tells the flash | 98 // when navigation from one video to another, and tells the flash |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 config.args = rawConfig.args; | 164 config.args = rawConfig.args; |
| 175 } | 165 } |
| 176 } | 166 } |
| 177 }); | 167 }); |
| 178 | 168 |
| 179 ytplayer.config = rawYtplayer.config; | 169 ytplayer.config = rawYtplayer.config; |
| 180 } | 170 } |
| 181 }); | 171 }); |
| 182 }, badArgumentsRegex); | 172 }, badArgumentsRegex); |
| 183 })(); | 173 })(); |
| OLD | NEW |