Advertisement
rdsedmundo

calc

Nov 28th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (($) => {
  2.   const prices = Array.from($('.suggested-price'));
  3.   const items = [];
  4.  
  5.   prices.forEach(node => {
  6.    const name = $(node).parents('.item-add-wear').parent().find('.market-name.market-link')[0].innerHTML;
  7.    const price = parseFloat($(node).parents('.item-add-wear').find('.item-amount')[0].innerHTML.replace('$', '').replace(',', ''));
  8.    const suggest = parseFloat(node.innerHTML.replace('$', '').replace(',', ''));
  9.    const profit = suggest - price;
  10.    const amount = 100 * (profit / price);
  11.  
  12.    items.push({
  13.      name,
  14.      price,
  15.      profit,
  16.      amount,
  17.    });
  18.   });
  19.  
  20.   items.sort((a, b) => b.amount - a.amount);
  21.  
  22.   console.log(items.filter(i => i.price < 500));
  23. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement