| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 | 372 |
| 373 // Init canvas settings | 373 // Init canvas settings |
| 374 context.fillStyle = "rgb(0, 0, 0)"; | 374 context.fillStyle = "rgb(0, 0, 0)"; |
| 375 context.strokeStyle = "rgba(255, 0, 0, 0.7)"; | 375 context.strokeStyle = "rgba(255, 0, 0, 0.7)"; |
| 376 context.lineWidth = 3; | 376 context.lineWidth = 3; |
| 377 context.lineJoin = "round"; | 377 context.lineJoin = "round"; |
| 378 }, | 378 }, |
| 379 | 379 |
| 380 get enabled() | 380 get enabled() |
| 381 { | 381 { |
| 382 return this._enabled | 382 return this._enabled; |
| 383 }, | 383 }, |
| 384 set enabled(enabled) | 384 set enabled(enabled) |
| 385 { | 385 { |
| 386 if (this._enabled == enabled) | 386 if (this._enabled == enabled) |
| 387 return; | 387 return; |
| 388 | 388 |
| 389 this._enabled = enabled; | 389 this._enabled = enabled; |
| 390 this._canvas.style.opacity = this._enabled ? "" : "0.3" | 390 this._canvas.style.opacity = this._enabled ? "" : "0.3" |
| 391 E("screenshotMarkButton").disabled = !this._enabled; | 391 E("screenshotMarkButton").disabled = !this._enabled; |
| 392 E("screenshotRemoveButton").disabled = !this._enabled; | 392 E("screenshotRemoveButton").disabled = !this._enabled; |
| 393 E("screenshotUndoButton").disabled = !this._enabled || !this._undoQueue.leng th; | 393 E("screenshotUndoButton").disabled = !this._enabled || !this._undoQueue.leng th; |
| 394 }, | 394 }, |
| 395 | 395 |
| 396 get selectionType() | 396 get selectionType() |
| 397 { | 397 { |
| 398 return this._selectionType | 398 return this._selectionType; |
| 399 }, | 399 }, |
| 400 set selectionType(type) | 400 set selectionType(type) |
| 401 { | 401 { |
| 402 if (this._selectionType == type) | 402 if (this._selectionType == type) |
| 403 return; | 403 return; |
| 404 | 404 |
| 405 // Abort selection already in progress | 405 // Abort selection already in progress |
| 406 this.abortSelection(); | 406 this.abortSelection(); |
| 407 | 407 |
| 408 this._selectionType = type; | 408 this._selectionType = type; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 { | 612 { |
| 613 let file = FileUtils.getDir(pathID, [], false); | 613 let file = FileUtils.getDir(pathID, [], false); |
| 614 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; | 614 censored[file.path.replace(/[\\\/]+$/, '')] = placeholder; |
| 615 let uri = Utils.ioService.newFileURI(file); | 615 let uri = Utils.ioService.newFileURI(file); |
| 616 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; | 616 censored[uri.spec.replace(/[\\\/]+$/, '')] = placeholder; |
| 617 } catch(e) {} | 617 } catch(e) {} |
| 618 } | 618 } |
| 619 | 619 |
| 620 function str2regexp(str, flags) | 620 function str2regexp(str, flags) |
| 621 { | 621 { |
| 622 return new RegExp(str.replace(/(\W)/g, "\\$1"), flags); | 622 return new RegExp(str.replace(/\W/g, "\\$&"), flags); |
|
Thomas Greiner
2016/01/12 17:53:39
You can avoid the creation of the capturing group
Wladimir Palant
2016/01/12 17:59:12
Done.
| |
| 623 } | 623 } |
| 624 | 624 |
| 625 let errors = reportElement("errors"); | 625 let errors = reportElement("errors"); |
| 626 for (let i = 0; i < messages.length; i++) | 626 for (let i = 0; i < messages.length; i++) |
| 627 { | 627 { |
| 628 let message = messages[i]; | 628 let message = messages[i]; |
| 629 | 629 |
| 630 let text = message.errorMessage; | 630 let text = message.errorMessage; |
| 631 for (let path in censored) | 631 for (let path in censored) |
| 632 text = text.replace(str2regexp(path, "gi"), censored[path]); | 632 text = text.replace(str2regexp(path, "gi"), censored[path]); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1554 | 1554 |
| 1555 function censorURL(url) | 1555 function censorURL(url) |
| 1556 { | 1556 { |
| 1557 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); | 1557 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 function encodeHTML(str) | 1560 function encodeHTML(str) |
| 1561 { | 1561 { |
| 1562 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"). replace(/"/g, """); | 1562 return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"). replace(/"/g, """); |
| 1563 } | 1563 } |
| LEFT | RIGHT |