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

Side by Side Diff: issue-reporter.js

Issue 29587613: Issue 5917 - Improve display of report data in the issue reporter (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Patch Set: Created Oct. 24, 2017, 11:55 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
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 commentElement.parentNode.removeChild(commentElement); 292 commentElement.parentNode.removeChild(commentElement);
293 293
294 let value = event.target.value.trim(); 294 let value = event.target.value.trim();
295 commentElement.textContent = value.substr(0, 1000); 295 commentElement.textContent = value.substr(0, 1000);
296 if (value) 296 if (value)
297 reportData.documentElement.appendChild(commentElement); 297 reportData.documentElement.appendChild(commentElement);
298 document.getElementById("commentLengthWarning") 298 document.getElementById("commentLengthWarning")
299 .setAttribute("data-invisible", value.length <= 1000); 299 .setAttribute("data-invisible", value.length <= 1000);
300 }); 300 });
301 301
302 let showDataOverlay = document.getElementById("showDataOverlay");
302 document.getElementById("showData").addEventListener("click", event => 303 document.getElementById("showData").addEventListener("click", event =>
303 { 304 {
304 event.preventDefault(); 305 event.preventDefault();
305 306
306 // window.open() won't open data: URIs in Chrome 307 showDataOverlay.hidden = false;
307 browser.tabs.getCurrent().then(tab => 308
309 let element = document.getElementById("showDataValue");
310 element.value = serializeReportData();
311 element.focus();
312 });
313
314 document.getElementById("showDataClose").addEventListener("click", event =>
315 {
316 showDataOverlay.hidden = true;
317 document.getElementById("showData").focus();
318 });
319
320 showDataOverlay.addEventListener("keydown", event =>
321 {
322 if (event.key == "Enter" || event.key == "Escape")
308 { 323 {
309 browser.tabs.create({ 324 // Stop propagation to prevent higher level event handler from processing
310 url: "data:text/xml;charset=utf-8," + 325 // this event.
311 encodeURIComponent(serializeReportData()), 326 event.stopPropagation();
312 openerTabId: tab.id 327 document.getElementById("showDataClose").click();
313 }); 328 }
Wladimir Palant 2017/10/24 11:58:29 It would have been possible to merely fix this cal
kzar 2017/10/24 13:39:57 Acknowledged.
314 }); 329 });
330
331 showDataOverlay.addEventListener("click", event =>
332 {
333 if (event.eventPhase == event.AT_TARGET)
334 {
335 // User clicked outside overlay content
336 document.getElementById("showDataClose").click();
337 }
315 }); 338 });
316 339
317 emailField.focus(); 340 emailField.focus();
318 } 341 }
319 342
320 function leaveCommentPage() 343 function leaveCommentPage()
321 { 344 {
322 setCurrentPage("sendPage"); 345 setCurrentPage("sendPage");
323 } 346 }
324 347
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 progress.value = event.loaded; 469 progress.value = event.loaded;
447 } 470 }
448 }); 471 });
449 request.send(serializeReportData()); 472 request.send(serializeReportData());
450 } 473 }
451 474
452 function leaveSendPage() 475 function leaveSendPage()
453 { 476 {
454 window.close(); 477 window.close();
455 } 478 }
OLDNEW
« issue-reporter.html ('K') | « issue-reporter.html ('k') | skin/issue-reporter.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld