mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 09:24:58 +00:00
Update chrome.js
This commit is contained in:
parent
7caeed23ed
commit
2a4507f191
|
@ -11,6 +11,7 @@ var HTTP = require("lib/http");
|
|||
var Websocket = require("lib/websocket");
|
||||
var AutoIt = require("lib/autoit");
|
||||
var Toolkit = require("lib/toolkit");
|
||||
var ExtraMath = require("lib/extramath");
|
||||
|
||||
// for remote debugging
|
||||
var pageEventId = 0;
|
||||
|
@ -806,6 +807,30 @@ var ChromeObject = function(interfaces) {
|
|||
;
|
||||
}
|
||||
|
||||
else if (searchText.indexOf(':text(') == 0) {
|
||||
this.evaluate(ExtraMath.export_measureSimilarity());
|
||||
|
||||
searchText = searchText.substring(searchText.indexOf('(') + 1, searchText.lastIndexOf(')'));
|
||||
s += '(function() {'
|
||||
+ ' var elements = Object.values(__getDocument().querySelectorAll("' + selector + '")).filter(function(x) {'
|
||||
+ ' var el = ' + (subSelector == ':self' ? 'x;' : 'x.querySelector("' + subSelector + '");')
|
||||
+ ' var searchText = ' + this.__escape(searchText) + '.trim();'
|
||||
+ ' var text = el instanceof HTMLElement ? el.innerText : "";'
|
||||
+ ' return ExtraMath.measureSimilarity(text, searchText) >= 0.9;'
|
||||
+ ' ' + (startIndex > 0 ? '}).slice(' + startIndex + ');' : '});')
|
||||
+ ' if (elements.length > 0) {'
|
||||
+ ' var element = elements[0];'
|
||||
+ ' var rect = element.getBoundingClientRect();'
|
||||
+ ' var elClassName = "welsonjs_" + parseInt(Math.random() * 1000000000);'
|
||||
+ ' element.setAttribute("class", element.getAttribute("class") + " " + elClassName);'
|
||||
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(__getWindow().pageXOffset + rect.left), parseInt(__getWindow().pageYOffset + rect.top), parseInt(rect.width), parseInt(rect.height), "." + elClassName].join(",");'
|
||||
+ ' } else {'
|
||||
+ ' return "";'
|
||||
+ ' }'
|
||||
+ '})()'
|
||||
;
|
||||
}
|
||||
|
||||
else if (searchText.indexOf(':p(') == 0) {
|
||||
var p = parseFloat(searchText.substring(searchText.indexOf('(') + 1, searchText.lastIndexOf(')')));
|
||||
if (p > 0) {
|
||||
|
@ -1329,6 +1354,7 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i
|
|||
;
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.1";
|
||||
exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.2";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user