contentscript_pfg.js 550 B

12345678910111213141516171819
  1. function getInvoice() {
  2. let invoice = Array.from(document.getElementsByClassName("css-8tkdem")).map(row => {
  3. return Array.from(row.children).map(container => {
  4. return container.textContent;
  5. })
  6. });
  7. x = {};
  8. invoice.forEach((row) => {
  9. x[row[0]] = { qty: row[4].substring(13), cost: row[6] }
  10. });
  11. console.log(x);
  12. return x;
  13. }
  14. browser.runtime.onMessage.addListener(function (message, sender, sendResponse) {
  15. if (message["action"] === "get") {
  16. sendResponse(getInvoice());
  17. }
  18. });