Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

Need help in checking the dom node position for different screen resoultions

  • 1 baphendule
  • 1 inale nkinga
  • 1 view
  • Igcine ukuphendulwa ngu FredMcD

more options

Hi,

We are working on an Open Source Chrome extension: Digital Assistant Client

I am recording the domnode by converting into json by domJson and saving into server. We can find the same recordednode by comparing the json attributes and matching to the original node on the page. We have one problem here when we search for the nodes sometimes we get similar nodes via json which has same property names. In that case we are trying to match the node position that we have recorded. When we try to match the node position in different screen resolutions, it gives us the wrong node. How do we solve this. My code is as given below

// calculate distance between selected node and matching node getDistance: function (node1, node2) {

  const x = node1.x - node2.x;
  const y = node1.y - node2.y;
  const dist = Math.abs(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
  return dist;

},

Hi, We are working on an Open Source Chrome extension: [https://github.com/kcramakrishna/Digital_Assistant_Client Digital Assistant Client] I am recording the domnode by converting into json by domJson and saving into server. We can find the same recordednode by comparing the json attributes and matching to the original node on the page. We have one problem here when we search for the nodes sometimes we get similar nodes via json which has same property names. In that case we are trying to match the node position that we have recorded. When we try to match the node position in different screen resolutions, it gives us the wrong node. How do we solve this. My code is as given below // calculate distance between selected node and matching node getDistance: function (node1, node2) { const x = node1.x - node2.x; const y = node1.y - node2.y; const dist = Math.abs(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))); return dist; },

All Replies (1)

more options

Add-on questions should be posted in the add-ons forum; https://discourse.mozilla-community.org/c/add-ons