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

Delta Between Two Patch Sets: popup.js

Issue 29785555: Issue 6684 - Issue Reporter Active Tab Screenshot (Closed)
Left Patch Set: added issue reporter new icons Created May 24, 2018, 10:38 a.m.
Right Patch Set: removed checkbox.png Created June 20, 2018, 12:42 p.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 | « metadata.chrome ('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 <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.captureVisibleTab( 106 // the issue reporter needs to take a screenshot of the
107 null, 107 // currently active tab, which is why active is explicitly
108 {format: "png"}, 108 // set as false, in case option defaults will ever change.
109 screenshot => 109 browser.tabs.create({
110 { 110 active: false,
111 // setup a listener to provide once tab url 111 url: browser.runtime.getURL("/issue-reporter.html?" + tab.id)
112 // and base64 screenshot data once asked 112 }).then(() =>
113 browser.runtime.onMessage.addListener( 113 {
114 function onMessage(event) 114 window.close();
115 { 115 });
116 if (event.type == "issue-reporter")
117 {
118 browser.runtime.onMessage.removeListener(onMessage);
119 return Promise.resolve({url: tab.url, screenshot});
120 }
121 }
122 );
123
124 browser.tabs.create({
125 active: true,
126 url: browser.runtime.getURL("/issue-reporter.html?" + tab.id)
127 });
128 }
129 );
130 } 116 }
131 117
132 function toggleCollapse(event) 118 function toggleCollapse(event)
133 { 119 {
134 let collapser = event.currentTarget; 120 let collapser = event.currentTarget;
135 let collapsible = document.getElementById(collapser.dataset.collapsible); 121 let collapsible = document.getElementById(collapser.dataset.collapsible);
136 collapsible.classList.toggle("collapsed"); 122 collapsible.classList.toggle("collapsed");
137 togglePref(collapser.dataset.option); 123 togglePref(collapser.dataset.option);
138 } 124 }
139 125
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 { 336 {
351 if (event.target.id == "notification-optout") 337 if (event.target.id == "notification-optout")
352 setPref("notifications_ignoredcategories", true); 338 setPref("notifications_ignoredcategories", true);
353 339
354 notificationElement.hidden = true; 340 notificationElement.hidden = true;
355 browser.runtime.sendMessage({type: "notifications.clicked"}); 341 browser.runtime.sendMessage({type: "notifications.clicked"});
356 } 342 }
357 }, true); 343 }, true);
358 }); 344 });
359 }); 345 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld