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

Side by Side Diff: popup.js

Issue 29785555: Issue 6684 - Issue Reporter Active Tab Screenshot (Closed)
Patch Set: using active + inlined object literal Created May 22, 2018, 4:13 p.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 | no next file » | 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-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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 { 96 {
97 window.clearTimeout(activateClickHide.timeout); 97 window.clearTimeout(activateClickHide.timeout);
98 activateClickHide.timeout = null; 98 activateClickHide.timeout = null;
99 } 99 }
100 document.body.classList.remove("clickhide-active"); 100 document.body.classList.remove("clickhide-active");
101 browser.tabs.sendMessage(tab.id, {type: "composer.content.finished"}); 101 browser.tabs.sendMessage(tab.id, {type: "composer.content.finished"});
102 } 102 }
103 103
104 function reportIssue() 104 function reportIssue()
105 { 105 {
106 browser.tabs.create({ 106 // capture the current visible tab
Sebastian Noack 2018/05/23 14:48:59 Nit: This comment seems superfluous (it essentiall
a.giammarchi 2018/05/23 15:06:35 Done.
107 url: browser.runtime.getURL("/issue-reporter.html?" + tab.id) 107 browser.tabs.captureVisibleTab(
108 }).then(() => 108 null,
109 { 109 {format: "png"},
110 window.close(); 110 (screenshot) =>
Sebastian Noack 2018/05/23 14:48:59 Nit: We omit the optional parenthesis in arrow fun
a.giammarchi 2018/05/23 15:06:35 Done.
111 }); 111 {
112 // setup a listener to provide once tab url
113 // and base64 screenshot data once asked
114 browser.runtime.onMessage.addListener(
115 function onMessage(event)
116 {
117 if (event.type === "issue-reporter")
Sebastian Noack 2018/05/23 14:48:59 Nit: We prefer == over ===, as per the Mozilla cod
a.giammarchi 2018/05/23 15:06:35 Done.
118 {
119 browser.runtime.onMessage.removeListener(onMessage);
120 return Promise.resolve({url: tab.url, screenshot});
121 }
122 }
123 );
124
125 // create an active/selected issue reporter tab
Sebastian Noack 2018/05/23 14:48:59 Nit: This comment seems superfluous as well.
a.giammarchi 2018/05/23 15:06:36 Done.
126 browser.tabs.create({
127 active: true,
128 url: browser.runtime.getURL("/issue-reporter.html?" + tab.id)
129 });
130 }
131 );
112 } 132 }
113 133
114 function toggleCollapse(event) 134 function toggleCollapse(event)
115 { 135 {
116 let collapser = event.currentTarget; 136 let collapser = event.currentTarget;
117 let collapsible = document.getElementById(collapser.dataset.collapsible); 137 let collapsible = document.getElementById(collapser.dataset.collapsible);
118 collapsible.classList.toggle("collapsed"); 138 collapsible.classList.toggle("collapsed");
119 togglePref(collapser.dataset.option); 139 togglePref(collapser.dataset.option);
120 } 140 }
121 141
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 { 352 {
333 if (event.target.id == "notification-optout") 353 if (event.target.id == "notification-optout")
334 setPref("notifications_ignoredcategories", true); 354 setPref("notifications_ignoredcategories", true);
335 355
336 notificationElement.hidden = true; 356 notificationElement.hidden = true;
337 browser.runtime.sendMessage({type: "notifications.clicked"}); 357 browser.runtime.sendMessage({type: "notifications.clicked"});
338 } 358 }
339 }, true); 359 }, true);
340 }); 360 });
341 }); 361 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld