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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 }); | 76 }); |
77 }, false); | 77 }, false); |
78 | 78 |
79 return button; | 79 return button; |
80 } | 80 } |
81 | 81 |
82 function createRecord(request, filter, template) | 82 function createRecord(request, filter, template) |
83 { | 83 { |
84 let row = document.importNode(template, true); | 84 let row = document.importNode(template, true); |
85 row.dataset.type = request.type; | 85 row.dataset.type = request.type; |
86 | |
87 row.querySelector(".domain").textContent = request.docDomain; | |
88 row.querySelector(".type").textContent = request.type; | 86 row.querySelector(".type").textContent = request.type; |
89 | 87 |
90 let urlElement = row.querySelector(".resource-link"); | 88 let urlElement = row.querySelector(".resource-link"); |
91 let actionWrapper = row.querySelector(".action-wrapper"); | 89 let actionWrapper = row.querySelector(".action-wrapper"); |
92 | 90 |
93 if (request.url) | 91 if (request.url) |
94 { | 92 { |
95 urlElement.textContent = request.url; | 93 urlElement.textContent = request.url; |
96 urlElement.setAttribute("href", request.url); | 94 urlElement.setAttribute("href", request.url); |
97 | 95 |
98 // Firefox 57 doesn't support the openResource API. | 96 // Firefox 57 doesn't support the openResource API. |
99 if (request.type != "POPUP" && "openResource" in ext.devtools.panels) | 97 if (request.type != "POPUP" && "openResource" in ext.devtools.panels) |
100 { | 98 { |
101 urlElement.addEventListener("click", event => | 99 urlElement.addEventListener("click", event => |
102 { | 100 { |
103 if (event.button == 0) | 101 if (event.button == 0) |
104 { | 102 { |
105 ext.devtools.panels.openResource(request.url); | 103 ext.devtools.panels.openResource(request.url); |
106 event.preventDefault(); | 104 event.preventDefault(); |
107 } | 105 } |
108 }, false); | 106 }, false); |
109 } | 107 } |
110 } | 108 } |
111 | 109 |
| 110 if (request.docDomain) |
| 111 row.querySelector(".domain").textContent = request.docDomain; |
| 112 |
112 if (filter) | 113 if (filter) |
113 { | 114 { |
114 let filterElement = row.querySelector(".filter"); | 115 let filterElement = row.querySelector(".filter"); |
115 let originElement = row.querySelector(".origin"); | 116 let originElement = row.querySelector(".origin"); |
116 | 117 |
117 filterElement.textContent = filter.text; | 118 filterElement.textContent = filter.text; |
118 row.dataset.state = filter.whitelisted ? "whitelisted" : "blocked"; | 119 row.dataset.state = filter.whitelisted ? "whitelisted" : "blocked"; |
119 | 120 |
120 if (filter.subscription) | 121 if (filter.subscription) |
121 originElement.textContent = filter.subscription; | 122 originElement.textContent = filter.subscription; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 break; | 259 break; |
259 } | 260 } |
260 }); | 261 }); |
261 | 262 |
262 // Since Chrome 54 the themeName is accessible, for earlier versions we must | 263 // Since Chrome 54 the themeName is accessible, for earlier versions we must |
263 // assume the default theme is being used. | 264 // assume the default theme is being used. |
264 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 | 265 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 |
265 let theme = browser.devtools.panels.themeName || "default"; | 266 let theme = browser.devtools.panels.themeName || "default"; |
266 document.body.classList.add(theme); | 267 document.body.classList.add(theme); |
267 }, false); | 268 }, false); |
OLD | NEW |