mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 21:21:03 +00:00
Update chrome.js
This commit is contained in:
parent
e8e617658c
commit
04e7dc82af
|
@ -1,6 +1,6 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
// chrome.js
|
||||||
// Google Chrome API
|
// Namhyeon Go <abuse@catswords.net>
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
// https://github.com/gnh1201/welsonjs
|
||||||
|
|
||||||
var STD = require("lib/std");
|
var STD = require("lib/std");
|
||||||
var RAND = require("lib/rand");
|
var RAND = require("lib/rand");
|
||||||
|
@ -234,7 +234,7 @@ var ChromeObject = function(interfaces) {
|
||||||
|
|
||||||
this.open = function(url) {
|
this.open = function(url) {
|
||||||
this.setProfile(this.profileName, this.installedDir);
|
this.setProfile(this.profileName, this.installedDir);
|
||||||
|
|
||||||
// if the file does not exists, Check the 32bit installation folder again
|
// if the file does not exists, Check the 32bit installation folder again
|
||||||
if (!FILE.fileExists(this.binPath)) {
|
if (!FILE.fileExists(this.binPath)) {
|
||||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES(X86)") + "\\Google\\Chrome\\Application";
|
this.workingDirectory = SYS.getEnvString("PROGRAMFILES(X86)") + "\\Google\\Chrome\\Application";
|
||||||
|
@ -808,8 +808,8 @@ var ChromeObject = function(interfaces) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (searchText.indexOf(':text(') == 0) {
|
else if (searchText.indexOf(':text(') == 0) {
|
||||||
this.evaluate(ExtraMath.export_measureSimilarity());
|
this.evaluate(ExtraMath.export_measureSimilarity());
|
||||||
|
|
||||||
searchText = searchText.substring(searchText.indexOf('(') + 1, searchText.lastIndexOf(')'));
|
searchText = searchText.substring(searchText.indexOf('(') + 1, searchText.lastIndexOf(')'));
|
||||||
s += '(function() {'
|
s += '(function() {'
|
||||||
|
@ -1183,17 +1183,22 @@ var ChromeObject = function(interfaces) {
|
||||||
return this.evaluate('__getWindow().addEventListener("click",function(e){var t=e.clientX,n=e.clientY,l=__getDocument().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=__getWindow().pageYOffset+n-10+"px",l.style.left=__getWindow().pageXOffset+t-10+"px",__getDocument().body.appendChild(l)});');
|
return this.evaluate('__getWindow().addEventListener("click",function(e){var t=e.clientX,n=e.clientY,l=__getDocument().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=__getWindow().pageYOffset+n-10+"px",l.style.left=__getWindow().pageXOffset+t-10+"px",__getDocument().body.appendChild(l)});');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Added in 2023-12-27
|
||||||
|
this.getTextsBySelectorAll = function(selector) {
|
||||||
|
return JSON.parse(this.getEvaluatedValue('JSON.stringify(Object.values(__getDocument().querySelectorAll("' + selector + '")).reduce(function(a, x) { a.push(x.innerText); return a; }, []))'));
|
||||||
|
};
|
||||||
|
|
||||||
this.getWindowInnerHeight = function() {
|
this.getWindowInnerHeight = function() {
|
||||||
return parseInt(this.getEvaluatedValue('__getWindow().innerHeight'));
|
return parseInt(this.getEvaluatedValue('__getWindow().innerHeight'));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getWindowPageYOffset = function() {
|
this.getWindowPageYOffset = function() {
|
||||||
return this.getEvaluatedValue('__getWindow().pageYOffset');
|
return this.getEvaluatedValue('__getWindow().pageYOffset');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentBodyOffsetHeight = function() {
|
this.getDocumentBodyOffsetHeight = function() {
|
||||||
return this.getEvaluatedValue('__getDocument().body.offsetHeight');
|
return this.getEvaluatedValue('__getDocument().body.offsetHeight');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDocumentScrollTop = function() {
|
this.getDocumentScrollTop = function() {
|
||||||
return parseInt(this.getEvaluatedValue('__getDocument().documentElement.scrollTop'));
|
return parseInt(this.getEvaluatedValue('__getDocument().documentElement.scrollTop'));
|
||||||
|
@ -1204,9 +1209,9 @@ var ChromeObject = function(interfaces) {
|
||||||
return (elementPosition.y > 0 && (elementPosition.y + elementPosition.h < this.getWindowInnerHeight()));
|
return (elementPosition.y > 0 && (elementPosition.y + elementPosition.h < this.getWindowInnerHeight()));
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isPageScrollEnded = function() {
|
this.isPageScrollEnded = function() {
|
||||||
return (this.getWindowInnerHeight() + this.getWindowPageYOffset()) >= this.getDocumentBodyOffsetHeight;
|
return (this.getWindowInnerHeight() + this.getWindowPageYOffset()) >= this.getDocumentBodyOffsetHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.__escape = function(value) {
|
this.__escape = function(value) {
|
||||||
var pos = value.indexOf("__escaped:");
|
var pos = value.indexOf("__escaped:");
|
||||||
|
@ -1367,7 +1372,7 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.4";
|
exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.5";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user