jeudi 12 février 2015

Chrome Extension to analyze page source code for a number in a specific div


I am trying to build a Chrome extension that is fairly complex so I'm just looking for a high level overview of how I should approach this. Keep in mind I'm brand new to Chrome Extensions.


I need an extension that will analyze the source code of a page, and specifically monitor a number that is in a div on that page. Whenever that number gets over a certain threshold, I will need to take some sort of action (popup, alert, etc).


The source page is refreshed automatically every few seconds with updated info so I will need the extension to run every few seconds as well to capture the most updated data.


As an overview, I'm looking for suggestions on how to do the following:



  1. Retrieve page source for a non-active tab, every 5 seconds. It should run in the background and not need to be "clicked" to be functioning.

  2. Look into that source code to find what number is in a specific div.

  3. Create some sort of alert or notification if that number exceeds a certain threshold.


I have seen various posts about how to get the source of an active page, but nothing about storing that source code to be analyzed. Also, I'm not sure how I should go about looking within the source code (I saw some JQuery recommendations).


One last thought: I was hoping this would be a relatively lightweight extension. Is running through this process every 5/10/15 seconds going to be resource intensive?





Aucun commentaire:

Enregistrer un commentaire