mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-08 08:43:32 +02:00
Fix sanitizer.
--HG-- branch : testing
This commit is contained in:
@@ -1490,8 +1490,8 @@ const Buffer = Module("buffer", {
|
|||||||
|
|
||||||
liberator.assert(elements.length > 0);
|
liberator.assert(elements.length > 0);
|
||||||
let elem = elements[util.Math.constrain(count, 1, elements.length) - 1];
|
let elem = elements[util.Math.constrain(count, 1, elements.length) - 1];
|
||||||
elem.scrollIntoView();
|
|
||||||
buffer.focusElement(elem);
|
buffer.focusElement(elem);
|
||||||
|
util.scrollIntoView(elem);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|||||||
@@ -1034,7 +1034,7 @@ const CommandLine = Module("commandline", {
|
|||||||
sanitize: function (timespan) {
|
sanitize: function (timespan) {
|
||||||
let range = [0, Number.MAX_VALUE];
|
let range = [0, Number.MAX_VALUE];
|
||||||
if (liberator.has("sanitizer") && (timespan || options["sanitizetimespan"]))
|
if (liberator.has("sanitizer") && (timespan || options["sanitizetimespan"]))
|
||||||
range = sanitizer.getClearRange(timespan || options["sanitizetimespan"]);
|
range = Sanitizer.getClearRange(timespan || options["sanitizetimespan"]);
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
this.store.mutate("filter", function (item) {
|
this.store.mutate("filter", function (item) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const Sanitizer = Module("sanitizer", {
|
|||||||
init: function () {
|
init: function () {
|
||||||
const self = this;
|
const self = this;
|
||||||
liberator.loadScript("chrome://browser/content/sanitize.js", Sanitizer);
|
liberator.loadScript("chrome://browser/content/sanitize.js", Sanitizer);
|
||||||
|
Sanitizer.getClearRange = Sanitizer.Sanitizer.getClearRange;
|
||||||
this.__proto__.__proto__ = new Sanitizer.Sanitizer; // Good enough.
|
this.__proto__.__proto__ = new Sanitizer.Sanitizer; // Good enough.
|
||||||
|
|
||||||
// TODO: remove this version test
|
// TODO: remove this version test
|
||||||
|
|||||||
@@ -673,6 +673,20 @@ const Util = Module("util", {
|
|||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrolls an element into view if and only if it's not already
|
||||||
|
* fully visible.
|
||||||
|
*
|
||||||
|
* @param {Node} elem The element to make visible.
|
||||||
|
*/
|
||||||
|
scrollIntoView: function scrollIntoView(elem) {
|
||||||
|
let win = elem.ownerDocument.defaultView;
|
||||||
|
let rect = elem.getBoundingClientRect();
|
||||||
|
if (!(rect && rect.top < win.innerHeight && rect.bottom >= 0 && rect.left < win.innerWidth && rect.right >= 0))
|
||||||
|
elem.scrollIntoView();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of URLs parsed from <b>str</b>.
|
* Returns an array of URLs parsed from <b>str</b>.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user