Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: safari/include.youtube.js

Issue 4922142982406144: Implemented blocking of YouTube video ads, by rewriting flashvars, for Safari (Closed)
Left Patch Set: Created Nov. 28, 2013, 5:06 p.m.
Right Patch Set: Forgot to remove include.youtube.js from metadata.common Created Dec. 20, 2013, 10:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « safari/ext/content.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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")
20 return;
21
19 function rewriteFlashvars(flashvars) 22 function rewriteFlashvars(flashvars)
20 { 23 {
21 var pairs = flashvars.split("&"); 24 var pairs = flashvars.split("&");
22 for (var i = 0; i < pairs.length; i++) 25 for (var i = 0; i < pairs.length; i++)
23 if (/^((ad|afv|adsense|iv)(_.*)?|(ad3|iv3|st)_module|prerolls|interstitial |infringe|invideo)=/.test(pairs[i])) 26 if (/^((ad|afv|adsense|iv)(_.*)?|(ad3|iv3|st)_module|prerolls|interstitial |infringe|invideo)=/.test(pairs[i]))
24 pairs.splice(i--, 1); 27 pairs.splice(i--, 1);
25 return pairs.join("&"); 28 return pairs.join("&");
26 } 29 }
27 30
28 function patchPlayer(player) 31 function patchPlayer(player)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 78
76 ext.backgroundPage.sendMessage({type: "get-domain-enabled-state"}, function(re sponse) 79 ext.backgroundPage.sendMessage({type: "get-domain-enabled-state"}, function(re sponse)
77 { 80 {
78 if (response.enabled) 81 if (response.enabled)
79 { 82 {
80 deferred.forEach(patchPlayer); 83 deferred.forEach(patchPlayer);
81 onBeforeLoadYoutubeVideo = patchPlayer; 84 onBeforeLoadYoutubeVideo = patchPlayer;
82 } 85 }
83 else 86 else
84 document.removeEventListener("beforeload", onBeforeLoad); 87 document.removeEventListener("beforeload", onBeforeLoad);
85 }); 88 });
Wladimir Palant 2013/12/06 10:58:35 This code was meant for Chrome where synchronous m
Sebastian Noack 2013/12/10 18:51:35 We only use synchronous messaging under the hood i
86 89
87 document.addEventListener("beforeload", onBeforeLoad, true); 90 document.addEventListener("beforeload", onBeforeLoad, true);
Wladimir Palant 2013/12/06 10:58:35 Adding this listener on non-YouTube websites is to
Sebastian Noack 2013/12/06 11:32:33 I assumed that YouTube videos embedded on other we
Wladimir Palant 2013/12/06 11:38:10 There are two ways to embed YouTube video: 1) The
Sebastian Noack 2013/12/20 09:23:46 Done.
88 })(); 91 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld