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

Delta Between Two Patch Sets: devtools-panel.js

Issue 29375899: Issue 4871 - Start using ESLint for adblockplusui (Closed)
Left Patch Set: Addressed the rest of Sebastian's feedback Created March 1, 2017, 5:35 a.m.
Right Patch Set: Avoid violating operator-linebreak rule Created March 15, 2017, 4:43 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 | « common.js ('k') | ext/background.js » ('j') | 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 <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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 { 172 {
173 let container = document.getElementById("items"); 173 let container = document.getElementById("items");
174 let table = container.querySelector("tbody"); 174 let table = container.querySelector("tbody");
175 let template = document.querySelector("template").content.firstElementChild; 175 let template = document.querySelector("template").content.firstElementChild;
176 176
177 document.getElementById("reload").addEventListener("click", () => 177 document.getElementById("reload").addEventListener("click", () =>
178 { 178 {
179 ext.devtools.inspectedWindow.reload(); 179 ext.devtools.inspectedWindow.reload();
180 }, false); 180 }, false);
181 181
182 document.getElementById("filter-state").addEventListener("change", event => 182 document.getElementById("filter-state").addEventListener("change", (event) =>
183 { 183 {
184 container.dataset.filterState = event.target.value; 184 container.dataset.filterState = event.target.value;
185 }, false); 185 }, false);
186 186
187 document.getElementById("filter-type").addEventListener("change", event => 187 document.getElementById("filter-type").addEventListener("change", (event) =>
188 { 188 {
189 container.dataset.filterType = event.target.value; 189 container.dataset.filterType = event.target.value;
190 }, false); 190 }, false);
191 191
192 ext.onMessage.addListener(message => 192 ext.onMessage.addListener((message) =>
193 { 193 {
194 switch (message.type) 194 switch (message.type)
195 { 195 {
196 case "add-record": 196 case "add-record":
197 table.appendChild(createRecord(message.request, message.filter, 197 table.appendChild(createRecord(message.request, message.filter,
198 template)); 198 template));
199 break; 199 break;
200 200
201 case "update-record": 201 case "update-record":
202 let oldRow = table.getElementsByTagName("tr")[message.index]; 202 let oldRow = table.getElementsByTagName("tr")[message.index];
203 let newRow = createRecord(message.request, message.filter, template); 203 let newRow = createRecord(message.request, message.filter, template);
204 oldRow.parentNode.replaceChild(newRow, oldRow); 204 oldRow.parentNode.replaceChild(newRow, oldRow);
205 newRow.classList.add("changed"); 205 newRow.classList.add("changed");
206 container.classList.add("has-changes"); 206 container.classList.add("has-changes");
207 break; 207 break;
208 208
209 case "remove-record": 209 case "remove-record":
210 let row = table.getElementsByTagName("tr")[message.index]; 210 let row = table.getElementsByTagName("tr")[message.index];
211 row.parentNode.removeChild(row); 211 row.parentNode.removeChild(row);
212 container.classList.add("has-changes"); 212 container.classList.add("has-changes");
213 break; 213 break;
214 214
215 case "reset": 215 case "reset":
216 table.innerHTML = ""; 216 table.innerHTML = "";
217 container.classList.remove("has-changes"); 217 container.classList.remove("has-changes");
218 break; 218 break;
219 } 219 }
220 }); 220 });
221 221
222 window.addEventListener("message", event => 222 window.addEventListener("message", (event) =>
223 { 223 {
224 switch (event.data.type) 224 switch (event.data.type)
225 { 225 {
226 case "performSearch": 226 case "performSearch":
227 performSearch(table, event.data.queryString); 227 performSearch(table, event.data.queryString);
228 lastFilterQuery = event.data.queryString; 228 lastFilterQuery = event.data.queryString;
229 break; 229 break;
230 case "cancelSearch": 230 case "cancelSearch":
231 cancelSearch(table); 231 cancelSearch(table);
232 lastFilterQuery = null; 232 lastFilterQuery = null;
233 break; 233 break;
234 } 234 }
235 }); 235 });
236 236
237 // Since Chrome 54 the themeName is accessible, for earlier versions we must 237 // Since Chrome 54 the themeName is accessible, for earlier versions we must
238 // assume the default theme is being used. 238 // assume the default theme is being used.
239 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869 239 // https://bugs.chromium.org/p/chromium/issues/detail?id=608869
240 let theme = chrome.devtools.panels.themeName || "default"; 240 let theme = chrome.devtools.panels.themeName || "default";
241 document.body.classList.add(theme); 241 document.body.classList.add(theme);
242 }, false); 242 }, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld