mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 21:51:04 +00:00
Update chrome.js
This commit is contained in:
parent
15a6be1ec1
commit
410d77ccdd
|
@ -926,11 +926,16 @@ var ChromeObject = function() {
|
||||||
this.traceMouseClick = 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)});');
|
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() {
|
this.getWindowInnerHeight = function() {
|
||||||
return this.getEvaluatedValue('window.innerHeight');
|
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();
|
this.create();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user