Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. (function(){
  2. var sections = jQuery('#icons').children();
  3. var collector = [];
  4.  
  5. sections.each(function(){
  6.  
  7. var that = jQuery(this);
  8. if(that.attr('id') !== 'new'){
  9.  
  10. jQuery(this).find('i').filter(function(){ return !jQuery(this).siblings('.text-muted').length }).each(function(){
  11. var obj = {};
  12.  
  13. found = _.findWhere(collector, {'icon': jQuery(this).attr('class').replace('fa fa-', '') });
  14.  
  15. if(found !== undefined){
  16. found.category.push(that.attr('id'));
  17. return;
  18. }
  19. obj['icon'] = jQuery(this).attr('class').replace('fa fa-', '');
  20. obj['category']= [];
  21. obj['category'].push(that.attr('id'));
  22. collector.push(obj);
  23. });
  24. }
  25.  
  26.  
  27. });
  28. console.log('Length', collector.length);
  29. console.log(JSON.stringify(collector));
  30.  
  31. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement