Mercurial > hg > webaudioevaluationtool
diff 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 |
line wrap: on
line diff
--- a/js/core.js Thu Jan 19 15:51:49 2017 +0000 +++ b/js/core.js Thu Jan 19 16:15:47 2017 +0000 @@ -3331,6 +3331,31 @@ throw ("Invalid arguments"); } } + + this.getCombinedInterfaces = function (page) { + // Combine the interfaces with the global interface nodes + var global = specification.interfaces, + local = page.interfaces; + local.forEach(function (locInt) { + // Iterate through the options nodes + var addList = []; + global.options.forEach(function (gopt) { + var lopt = locInt.options.find(function (lopt) { + return (lopt.name == gopt.name) && (lopt.type == gopt.type); + }); + if (!lopt) { + // Global option doesn't exist locally + addList.push(gopt); + } + }); + locInt.options = locInt.options.concat(addList); + if (!locInt.scales && global.scales) { + // Use the global default scales + locInt.scales = global.scales; + } + }); + return local; + } } function Storage() {