Skip to content

Commit

Permalink
Adequate to new TesouroDireto webpage
Browse files Browse the repository at this point in the history
  • Loading branch information
eltonjr committed Jun 24, 2022
1 parent 3d8e736 commit 9d3e9a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Tesouro Direto - Preço teórico",
"version": "2.4.0",
"version": "2.5.0",
"description": "Exibe o preço teórico de um investimento no Tesouro Direto",
"icons": {
"64": "assets/td-icon-64.png"
Expand Down
10 changes: 8 additions & 2 deletions src/theoretical.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ function extractTheoreticalPriceFromTitlePage(doc, rowFn = noop) {

const rows = doc.getElementsByClassName("saldo-table-data-values");
const rowsPromises = Array.from(rows).map(row => {
const onclickAction = row.getAttribute("onclick");
const tds = row.getElementsByTagName("td");
const iconTd = Array.from(tds)[0];
const anchors = iconTd.getElementsByTagName("a");
const iconAnchor = Array.from(anchors)[0];
const onclickAction = iconAnchor.getAttribute("onclick");
const paramsStr = onclickAction.match(onclickActionGetter);
const [
CodigoInstituicaoFinanceira,
Expand Down Expand Up @@ -140,7 +144,9 @@ function brlToNumber(str) {
return Number(str
.replace("R$", "")
.replace(".", "")
.replace(",", "."));
.replace(",", ".")
.replace(";", "")
.trim());
}

function getToken() {
Expand Down

0 comments on commit 9d3e9a4

Please sign in to comment.