Skip to content

Commit

Permalink
Remove repetitive bit of item code
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyestein committed Dec 31, 2023
1 parent a076cb7 commit a42065d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Better styling.

Make initialisation less hacky.

Should be a userscript not an extension?

4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function dataItemFromBI(bi) {
var stock_status_span = bi.querySelector('.badge-label');
var item_code = bi.querySelector('.basket-item__code');

let match = item_code.innerText.match('Code: (.*)');
let stripped_code = match[1];

try {
// these might not exist if item is out of stock
Expand All @@ -22,7 +24,7 @@ function dataItemFromBI(bi) {
}
var item = {
wine: wine_desc,
code: item_code.innerText,
code: stripped_code,
url: abs_url,
stock: stock_status_span.innerText,
price: price,
Expand Down

0 comments on commit a42065d

Please sign in to comment.