OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 (function() { | 18 (function() { |
19 if (document.domain != "www.youtube.com") | 19 if (document.domain != "www.youtube.com") |
20 return; | 20 return; |
21 | 21 |
22 function rewriteFlashvars(flashvars) | 22 function rewriteFlashvars(flashvars) |
23 { | 23 { |
24 var pairs = flashvars.split("&"); | 24 var pairs = flashvars.split("&"); |
25 for (var i = 0; i < pairs.length; i++) | 25 for (var i = 0; i < pairs.length; i++) |
26 if (/^((ad|afv|adsense|iv)(_.*)?|(ad3|iv3|st)_module|prerolls|interstitial
|infringe|invideo)=/.test(pairs[i])) | 26 if (/^((ad|afv|adsense)(_.*)?|(ad3|st)_module|prerolls|interstitial|infrin
ge|iv_cta_url)=/.test(pairs[i])) |
27 pairs.splice(i--, 1); | 27 pairs.splice(i--, 1); |
28 return pairs.join("&"); | 28 return pairs.join("&"); |
29 } | 29 } |
30 | 30 |
31 function patchPlayer(player) | 31 function patchPlayer(player) |
32 { | 32 { |
33 var newPlayer = player.cloneNode(true); | 33 var newPlayer = player.cloneNode(true); |
34 var flashvarsChanged = false; | 34 var flashvarsChanged = false; |
35 | 35 |
36 var flashvars = newPlayer.getAttribute("flashvars"); | 36 var flashvars = newPlayer.getAttribute("flashvars"); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 { | 94 { |
95 deferred.forEach(patchPlayer); | 95 deferred.forEach(patchPlayer); |
96 onBeforeLoadYoutubeVideo = patchPlayer; | 96 onBeforeLoadYoutubeVideo = patchPlayer; |
97 } | 97 } |
98 else | 98 else |
99 document.removeEventListener("beforeload", onBeforeLoad, true); | 99 document.removeEventListener("beforeload", onBeforeLoad, true); |
100 }); | 100 }); |
101 | 101 |
102 document.addEventListener("beforeload", onBeforeLoad, true); | 102 document.addEventListener("beforeload", onBeforeLoad, true); |
103 })(); | 103 })(); |
OLD | NEW |