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