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

Side by Side Diff: common.js

Issue 29496555: Noissue - Fix setLinks related ESLint errors (Closed)
Patch Set: Created July 24, 2017, 9:08 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | firstRun.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 16 matching lines...) Expand all
27 function getDocLink(link, callback) 27 function getDocLink(link, callback)
28 { 28 {
29 ext.backgroundPage.sendMessage({ 29 ext.backgroundPage.sendMessage({
30 type: "app.get", 30 type: "app.get",
31 what: "doclink", 31 what: "doclink",
32 link 32 link
33 }, callback); 33 }, callback);
34 } 34 }
35 35
36 function setLinks(id, ...args) 36 function setLinks(id, ...args)
37 {
kzar 2017/07/24 09:10:02 The diff here looks ugly, but really I just remove
Thomas Greiner 2017/07/24 10:26:18 Acknowledged. Thanks for pointing that out.
38 let element = E(id);
39 if (!element)
37 { 40 {
38 let element = E(id); 41 return;
39 if (!element) 42 }
43
44 let links = element.getElementsByTagName("a");
45
46 for (let i = 0; i < links.length; i++)
47 {
48 if (typeof args[i] == "string")
40 { 49 {
41 return; 50 links[i].href = args[i];
51 links[i].setAttribute("target", "_blank");
42 } 52 }
43 53 else if (typeof args[i] == "function")
44 let links = element.getElementsByTagName("a");
45
46 for (let i = 0; i < links.length; i++)
47 { 54 {
48 if (typeof args[i] == "string") 55 links[i].href = "javascript:void(0);";
49 { 56 links[i].addEventListener("click", args[i], false);
50 links[i].href = args[i];
51 links[i].setAttribute("target", "_blank");
52 }
53 else if (typeof args[i] == "function")
54 {
55 links[i].href = "javascript:void(0);";
56 links[i].addEventListener("click", args[i], false);
57 }
58 } 57 }
59 } 58 }
59 }
60 60
61 function checkShareResource(url, callback) 61 function checkShareResource(url, callback)
62 { 62 {
63 ext.backgroundPage.sendMessage({ 63 ext.backgroundPage.sendMessage({
64 type: "filters.blocked", 64 type: "filters.blocked",
65 url, 65 url,
66 requestType: "SCRIPT", 66 requestType: "SCRIPT",
67 docDomain: "adblockplus.org", 67 docDomain: "adblockplus.org",
68 thirdParty: true 68 thirdParty: true
69 }, callback); 69 }, callback);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 window.removeEventListener("message", popupMessageListener); 170 window.removeEventListener("message", popupMessageListener);
171 } 171 }
172 172
173 iframe.removeEventListener("load", popupLoadListener); 173 iframe.removeEventListener("load", popupLoadListener);
174 }; 174 };
175 iframe.addEventListener("load", popupLoadListener, false); 175 iframe.addEventListener("load", popupLoadListener, false);
176 176
177 iframe.src = url; 177 iframe.src = url;
178 glassPane.className = "visible"; 178 glassPane.className = "visible";
179 } 179 }
OLDNEW
« no previous file with comments | « no previous file | firstRun.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld