Last active
December 15, 2016 10:31
-
-
Save said-and-done/df82f52e5fc250d25434da0638b8f78e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var current = $('.mainNavTabs li.active a').attr('href').substr(1); | |
| if(current == 'nutrients'){ | |
| var rows = 'Type\tgram'; | |
| var cols = ['Fedt', 'Protein', 'Kulhydrat (tilgængelig)', 'Kostfibre']; | |
| $('tr.nutrient-row td').filter(function(){ | |
| return cols.indexOf($(this).text()) != -1; | |
| }).each(function(){ | |
| var self = $(this); | |
| var name = self.text(); | |
| var g = self.next('td').text().replace(' g', ''); | |
| rows += '\n'+[name, g].join('\t'); | |
| }); | |
| alert(rows) | |
| }else if(current == 'meals'){ | |
| var rows = 'Ingredient\tgram\tkalorier'; | |
| $('tr.food, tr.total').each(function(){ | |
| var self = $(this); | |
| var name = self.find('td:eq(0)').find('.hasMeasurePullRight').remove().end().text(); | |
| var g = self.find('td:eq(1)').text().replace(' g', ''); | |
| var kcal = self.find('td:eq(2)').text().replace(' kcal', ''); | |
| rows += '\n'+[name, g, kcal].join('\t'); | |
| }); | |
| alert(rows) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment