SwVitaliy

Untitled

Jul 20th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* http://www.ozon.ru/default.aspx?context=cart */
  2. r = [];
  3. $('.cartTable').filter(':not(:last)').each(function() {
  4. r.push((function(b){
  5.  
  6. var t=[];
  7. b.find('.hr').each(function() {
  8. var c=$(this), s='';
  9. t.push({
  10. 'link': (d=c.find('.photo a')).attr('href'),
  11. 'photo': d.find('img').attr('src'),
  12. 'name': (s=c.find('.name a').text().trim()),
  13. 'author': c.find('.name h3').text().trim().substr(s.length).trim(),
  14. 'weight': c.find('.weight').text().trim(),
  15. 'delivery': c.find('.delivery').text().trim(),
  16. 'qty': c.find('.qty .btn').text().trim(),
  17. 'total': c.find('.total').text().trim()
  18. });
  19. });
  20. return t;
  21.  
  22. })($(this)));
  23. });
  24. h = ['photo','name','author','weight','delivery','qty','total']; console.log(h.join('    ')); v = function(d){ var r=[]; for(var i in h) { r.push(d[h[i]]); } return r; }
  25. for(var i in r) { if (!r.hasOwnProperty(i)) continue; var t=r[i]; for(var j in t) { if (!t.hasOwnProperty(j)) continue; var d=t[j]; console.log(v(d).join('    ')) } };
Advertisement
Add Comment
Please, Sign In to add comment