Update chrome.js

This commit is contained in:
Namhyeon Go 2023-12-27 01:33:43 +09:00
parent e8e617658c
commit 04e7dc82af

View File

@ -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");
@ -1183,6 +1183,11 @@ 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'));
}; };
@ -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;