| Conditions | 1 |
| Paths | 1 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 15 | function dashboardList(data, state, util, visibility) { |
||
| 16 | let ct = this; |
||
| 17 | ct.data = data; |
||
| 18 | ct.state = state; |
||
| 19 | ct.util = util; |
||
| 20 | ct.searchText = ''; |
||
| 21 | |||
| 22 | ct.resourcesForElement = function(currentElement) { |
||
| 23 | return visibility.visible(data.resources, filter, currentElement); |
||
| 24 | }; |
||
| 25 | |||
| 26 | function filter(name, currentElement) { |
||
| 27 | if(!state.player.resources[name].unlocked){ |
||
| 28 | return false; |
||
| 29 | } |
||
| 30 | if(ct.searchText && name.toLowerCase().indexOf(ct.searchText.toLowerCase()) === -1){ |
||
| 31 | return false; |
||
| 32 | } |
||
| 33 | // This is for global resources e.g. protons, which do not |
||
| 34 | // belong to any element |
||
| 35 | let elements = data.resources[name].elements; |
||
| 36 | if (Object.keys(elements).length === 0 && currentElement === '') { |
||
| 37 | return true; |
||
| 38 | } |
||
| 39 | |||
| 40 | for (let element in elements) { |
||
| 41 | if (currentElement === element) { |
||
| 42 | return true; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | return false; |
||
| 47 | } |
||
| 48 | } |
||
| 49 |