57 lines
1.3 KiB
Markdown
57 lines
1.3 KiB
Markdown
```js
|
|
// minh se co 2 loai object
|
|
// 1 : Apibids
|
|
// 2 : Producttab
|
|
|
|
const { default: puppeteer } = require("puppeteer");
|
|
|
|
Apibids = {
|
|
type: "Apibid",
|
|
puppeteer_connect: "puppeteer_connect",
|
|
url: "https://www.grays.com/mygrays/auctions/biddingon.aspx",
|
|
listentEvent: function () {
|
|
//action()
|
|
},
|
|
action: function () {},
|
|
};
|
|
|
|
// n Producttab
|
|
Producttab = {
|
|
type: "Producttab",
|
|
url: "https://www.grays.com/mygrays/auctions/biddingon.aspx",
|
|
puppeteer_connect: "puppeteer_connect",
|
|
max_price: "",
|
|
model: "model",
|
|
|
|
action: function () {},
|
|
};
|
|
|
|
manage = {
|
|
Apibids: { Apibids },
|
|
Producttabss: [{ Producttab }, { Producttab }],
|
|
};
|
|
|
|
// 10 goi 1 lan
|
|
recheck = function name() {
|
|
//check thay 2 record
|
|
//tabApibids
|
|
Apibids = new Apibids();
|
|
Apibids.puppeteer_connect();
|
|
Apibids.listentEvent();
|
|
manage.Apibids = Apibids;
|
|
//n Producttab
|
|
};
|
|
```
|
|
|
|
<!-- all bids -->
|
|
<!-- Lấy detail info của sản phẩm -->
|
|
|
|
let data = null; const elements = document.querySelectorAll('.ng-scope');
|
|
for (let i = 0; i < elements.length; i++) {
|
|
const scope = angular.element(elements[i]).scope();
|
|
if (scope && scope.auction) {
|
|
console.log('Found at index:', i, 'Auction:', scope.auction); data = scope.auction;
|
|
break; // dừng vòng lặp khi tìm thấy
|
|
}
|
|
}
|