Skip to content

Instantly share code, notes, and snippets.

@krisanalfa
Last active April 2, 2020 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisanalfa/af45a313ad5477699544bc2bdb6d9233 to your computer and use it in GitHub Desktop.
Save krisanalfa/af45a313ad5477699544bc2bdb6d9233 to your computer and use it in GitHub Desktop.
Bukalapak Javascript Toolkits
// Script ini berfungsi untuk menghitung semua "Barang Favorit" kalian. Steps:
// 1. Login
// 2. Buka halaman: https://www.bukalapak.com/bookmarks
// 3. Checklist barang-barang yang ingin kalian hitung
// 4. Buka JS console
// 5. Jalankan script di bawah
[...document.querySelectorAll(".c-inp--checkbox:checked")]
.map(el =>
parseInt(
(
el
.closest(".c-card--grid")
.querySelector(".c-card__product-price--reduced") ||
el.closest(".c-card--grid").querySelector(".c-card__product-price")
).textContent.replace(/[^0-9]/g, ""),
10
)
)
.reduce((a, c) => a + c, 1400000)
.toLocaleString("en-ID", {
style: "currency",
currency: "IDR"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment