| Total Complexity | 5 |
| Complexity/F | 1 |
| Lines of Code | 47 |
| Function Count | 5 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 8 | var Resources = function() { |
||
| 9 | this.data = []; |
||
| 10 | }; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Return the number of resources |
||
| 14 | * @returns {Number} |
||
| 15 | */ |
||
| 16 | Resources.prototype.count = function() { |
||
| 17 | return this.data.length; |
||
| 18 | }; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Add a resource to the list. Given a <pre> element, this function will extract |
||
| 22 | * all the attributes beginning with 'miv-' and the element's content and insert |
||
| 23 | * it to the list of resources. |
||
| 24 | * |
||
| 25 | * @param {DOMElement} pre |
||
| 26 | */ |
||
| 27 | Resources.prototype.add = function(pre) { |
||
| 28 | this.data.push($.extend({}, |
||
| 29 | Mivhak.resourceDefaults,{ |
||
|
|
|||
| 30 | pre:pre, |
||
| 31 | content: pre.textContent |
||
| 32 | }, |
||
| 33 | readAttributes(pre) |
||
| 34 | )); |
||
| 35 | }; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Get a resource by a given index |
||
| 39 | * @param {Number} i |
||
| 40 | * @returns {Object} |
||
| 41 | */ |
||
| 42 | Resources.prototype.get = function(i) { |
||
| 43 | return this.data[i]; |
||
| 44 | }; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Update the content of the resource corresponding to the given index. |
||
| 48 | * |
||
| 49 | * @param {number} i |
||
| 50 | * @param {string} content |
||
| 51 | */ |
||
| 52 | Resources.prototype.update = function(i, content) { |
||
| 53 | this.data[i].content = content; |
||
| 54 | }; |
||
| 55 | |||
| 56 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.