Mercurial > hg > webaudioevaluationtool
comparison js/core.js @ 2649:8f3ea7ce794b
#6: Added getCombinedInterfaces() to populate the page interface nodes with the global information
author | Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk> |
---|---|
date | Thu, 19 Jan 2017 16:15:47 +0000 |
parents | 781187c743cc |
children | d75db08e5801 |
comparison
equal
deleted
inserted
replaced
2648:781187c743cc | 2649:8f3ea7ce794b |
---|---|
3329 return a; | 3329 return a; |
3330 } else { | 3330 } else { |
3331 throw ("Invalid arguments"); | 3331 throw ("Invalid arguments"); |
3332 } | 3332 } |
3333 } | 3333 } |
3334 | |
3335 this.getCombinedInterfaces = function (page) { | |
3336 // Combine the interfaces with the global interface nodes | |
3337 var global = specification.interfaces, | |
3338 local = page.interfaces; | |
3339 local.forEach(function (locInt) { | |
3340 // Iterate through the options nodes | |
3341 var addList = []; | |
3342 global.options.forEach(function (gopt) { | |
3343 var lopt = locInt.options.find(function (lopt) { | |
3344 return (lopt.name == gopt.name) && (lopt.type == gopt.type); | |
3345 }); | |
3346 if (!lopt) { | |
3347 // Global option doesn't exist locally | |
3348 addList.push(gopt); | |
3349 } | |
3350 }); | |
3351 locInt.options = locInt.options.concat(addList); | |
3352 if (!locInt.scales && global.scales) { | |
3353 // Use the global default scales | |
3354 locInt.scales = global.scales; | |
3355 } | |
3356 }); | |
3357 return local; | |
3358 } | |
3334 } | 3359 } |
3335 | 3360 |
3336 function Storage() { | 3361 function Storage() { |
3337 // Holds results in XML format until ready for collection | 3362 // Holds results in XML format until ready for collection |
3338 this.globalPreTest = null; | 3363 this.globalPreTest = null; |