| 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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 let copyHeight = Math.min(wndHeight, 30000, copyWidth * 5); | 359 let copyHeight = Math.min(wndHeight, 30000, copyWidth * 5); |
| 360 let copyX = Math.max(Math.min(wnd.scrollX - copyWidth / 2, wndWidth - copyWi
dth), 0); | 360 let copyX = Math.max(Math.min(wnd.scrollX - copyWidth / 2, wndWidth - copyWi
dth), 0); |
| 361 let copyY = Math.max(Math.min(wnd.scrollY - copyHeight / 2, wndHeight - copy
Height), 0); | 361 let copyY = Math.max(Math.min(wnd.scrollY - copyHeight / 2, wndHeight - copy
Height), 0); |
| 362 | 362 |
| 363 let scalingFactor = (this._canvas.width - this.imageOffset * 2) / copyWidth; | 363 let scalingFactor = (this._canvas.width - this.imageOffset * 2) / copyWidth; |
| 364 this._canvas.height = copyHeight * scalingFactor + this.imageOffset * 2; | 364 this._canvas.height = copyHeight * scalingFactor + this.imageOffset * 2; |
| 365 | 365 |
| 366 this._context.save(); | 366 this._context.save(); |
| 367 this._context.translate(this.imageOffset, this.imageOffset); | 367 this._context.translate(this.imageOffset, this.imageOffset); |
| 368 this._context.scale(scalingFactor, scalingFactor); | 368 this._context.scale(scalingFactor, scalingFactor); |
| 369 this._context.drawWindow(wnd, copyX, copyY, copyWidth, copyHeight, "rgb(255,
255,255)"); | 369 try |
| 370 { |
| 371 this._context.drawWindow(wnd, copyX, copyY, copyWidth, copyHeight, "rgb(25
5,255,255)"); |
| 372 } |
| 373 catch (e) |
| 374 { |
| 375 Cu.reportError(e); |
| 376 } |
| 370 this._context.restore(); | 377 this._context.restore(); |
| 371 | 378 |
| 372 // Init canvas settings | 379 // Init canvas settings |
| 373 this._context.fillStyle = "rgb(0, 0, 0)"; | 380 this._context.fillStyle = "rgb(0, 0, 0)"; |
| 374 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)"; | 381 this._context.strokeStyle = "rgba(255, 0, 0, 0.7)"; |
| 375 this._context.lineWidth = 3; | 382 this._context.lineWidth = 3; |
| 376 this._context.lineJoin = "round"; | 383 this._context.lineJoin = "round"; |
| 377 | 384 |
| 378 // Reduce colors asynchronously | 385 // Reduce colors asynchronously |
| 379 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff
set, | 386 this._pixelData = this._context.getImageData(this.imageOffset, this.imageOff
set, |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 | 1584 |
| 1578 function censorURL(url) | 1585 function censorURL(url) |
| 1579 { | 1586 { |
| 1580 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); | 1587 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); |
| 1581 } | 1588 } |
| 1582 | 1589 |
| 1583 function encodeHTML(str) | 1590 function encodeHTML(str) |
| 1584 { | 1591 { |
| 1585 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); | 1592 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").
replace(/"/g, """); |
| 1586 } | 1593 } |
| OLD | NEW |