Update chrome.js

This commit is contained in:
Namhyeon Go 2021-11-19 18:06:42 +09:00 committed by GitHub
parent 15a6be1ec1
commit 410d77ccdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -926,11 +926,16 @@ var ChromeObject = function() {
this.traceMouseClick = function() {
return this.evaluate('window.addEventListener("click",function(e){var t=e.clientX,n=e.clientY,l=document.createElement("div");l.style.position="absolute",l.style.width="20px",l.style.height="20px",l.style.backgroundColor="#00ff00",l.style.zIndex=99999,l.style.top=window.pageYOffset+n-10+"px",l.style.left=window.pageXOffset+t-10+"px",document.body.appendChild(l)});');
};
this.getWindowInnerHeight = function() {
return this.getEvaluatedValue('window.innerHeight');
};
// formula: y > 0 and y + h < ih
this.isVisibleElementInViewport = function(elementPosition) {
return (elementPosition.y > 0 && (elementPosition.y + elementPosition.h < this.getWindowInnerHeight());
};
this.create();
};