mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 13:16:05 +00:00
Update chrome.js
This commit is contained in:
parent
0ce3e87c28
commit
e06e7fac6f
|
@ -559,18 +559,32 @@ var ChromeObject = function() {
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
var p = parseFloat(searchText.substring(searchText.indexOf('(') + 1, searchText.indexOf(')')));
|
var p = parseFloat(searchText.substring(searchText.indexOf('(') + 1, searchText.indexOf(')')));
|
||||||
s += '(function() {'
|
if (p > 0) {
|
||||||
+ ' var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {'
|
s += '(function() {'
|
||||||
+ ' return (Math.random() < ' + p + ');'
|
+ ' var elements = Object.values(document.querySelectorAll("' + selector + '")).filter(function(x) {'
|
||||||
+ ' });'
|
+ ' return (Math.random() < ' + p + ');'
|
||||||
+ ' if (elements.length > 0) {'
|
+ ' });'
|
||||||
+ ' var rect = elements[0].getBoundingClientRect();'
|
+ ' if (elements.length > 0) {'
|
||||||
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(rect.x), parseInt(rect.y), parseInt(rect.right), parseInt(rect.bottom)].join(",");'
|
+ ' var rect = elements[0].getBoundingClientRect();'
|
||||||
+ ' } else {'
|
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(rect.x), parseInt(rect.y), parseInt(rect.right), parseInt(rect.bottom)].join(",");'
|
||||||
+ ' return "";'
|
+ ' } else {'
|
||||||
+ ' }'
|
+ ' return "";'
|
||||||
+ '})()'
|
+ ' }'
|
||||||
;
|
+ '})()'
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
s += '(function() {'
|
||||||
|
+ ' var elements = Object.values(document.querySelectorAll("' + selector + '"));'
|
||||||
|
+ ' if (elements.length > 0) {'
|
||||||
|
+ ' var element = elements[Math.floor(Math.random() * elements.length)];';
|
||||||
|
+ ' var rect = element.getBoundingClientRect();'
|
||||||
|
+ ' return [parseInt(rect.left), parseInt(rect.top), parseInt(rect.x), parseInt(rect.y), parseInt(rect.right), parseInt(rect.bottom)].join(",");'
|
||||||
|
+ ' } else {'
|
||||||
|
+ ' return "";'
|
||||||
|
+ ' }'
|
||||||
|
+ '})()'
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = this.getEvaluatedValue(s);
|
var result = this.getEvaluatedValue(s);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user