|
|
@@ -18,7 +18,7 @@
|
|
|
* along with SingleFile. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
-/* global screen, window, document, dispatchEvent, UIEvent, CustomEvent */
|
|
|
+/* global screen, window, document, dispatchEvent, UIEvent, CustomEvent, Element */
|
|
|
|
|
|
(() => {
|
|
|
|
|
|
@@ -30,6 +30,18 @@
|
|
|
document.documentElement.__defineGetter__("clientWidth", () => document.documentElement.scrollWidth);
|
|
|
screen.__defineGetter__("height", () => document.documentElement.scrollHeight);
|
|
|
screen.__defineGetter__("width", () => document.documentElement.scrollWidth);
|
|
|
+ window._singleFile_getBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
|
+ Element.prototype.getBoundingClientRect = function () {
|
|
|
+ const boundingRect = window._singleFile_getBoundingClientRect.call(this);
|
|
|
+ if (this == document.documentElement) {
|
|
|
+ boundingRect.__defineGetter__("height", () => document.documentElement.scrollHeight);
|
|
|
+ boundingRect.__defineGetter__("bottom", () => document.documentElement.scrollHeight + boundingRect.top);
|
|
|
+ boundingRect.__defineGetter__("width", () => document.documentElement.scrollWidth);
|
|
|
+ boundingRect.__defineGetter__("right", () => document.documentElement.scrollWidth + boundingRect.left);
|
|
|
+ }
|
|
|
+ return boundingRect;
|
|
|
+ };
|
|
|
+ dispatchEvent(new UIEvent("scroll"));
|
|
|
dispatchEvent(new UIEvent("resize"));
|
|
|
dispatchEvent(new UIEvent("scroll"));
|
|
|
dispatchEvent(new CustomEvent(LOAD_OBSERVED_ELEMENTS_EVENT));
|