// Skip really small ones, and where width or height ==0
// Skip really small ones, and where width or height ==0
if(bbox['width']*bbox['height']<100){
if(bbox['width']*bbox['height']<10){
continue;
return
}
}
// Don't include elements that are offset from canvas
// Don't include elements that are offset from canvas
if(bbox['top']+scroll_y<0||bbox['left']<0){
if(bbox['top']+scroll_y<0||bbox['left']<0){
continue;
return
}
}
// @todo the getXpath kind of sucks, it doesnt know when there is for example just one ID sometimes
// @todo the getXpath kind of sucks, it doesnt know when there is for example just one ID sometimes
@ -114,46 +143,41 @@ for (var i = 0; i < elements.length; i++) {
// 1st primitive - if it has class, try joining it all and select, if theres only one.. well thats us.
// 1st primitive - if it has class, try joining it all and select, if theres only one.. well thats us.
xpath_result=false;
xpath_result=false;
try{
try{
vard=findUpTag(elements[i]);
vard=findUpTag(element);
if(d){
if(d){
xpath_result=d;
xpath_result=d;
}
}
}catch(e){
}catch(e){
console.log(e);
console.log(e);
}
}
// You could swap it and default to getXpath and then try the smarter one
// You could swap it and default to getXpath and then try the smarter one
// default back to the less intelligent one
// default back to the less intelligent one
if(!xpath_result){
if(!xpath_result){
try{
try{
// I've seen on FB and eBay that this doesnt work
// I've seen on FB and eBay that this doesnt work
// ReferenceError: getXPath is not defined at eval (eval at evaluate (:152:29), <anonymous>:67:20) at UtilityScript.evaluate (<anonymous>:159:18) at UtilityScript.<anonymous> (<anonymous>:1:44)
// ReferenceError: getXPath is not defined at eval (eval at evaluate (:152:29), <anonymous>:67:20) at UtilityScript.evaluate (<anonymous>:159:18) at UtilityScript.<anonymous> (<anonymous>:1:44)