You are going to add the basemap gallery code to your existing. You will need to modify portions of your code in the index.html by adding the following HTML:
<div id="basemapGallery"></div>
in the spot you want the gallery to be located
Then in the map.js file you will need to add the widget code by first adding
dojo.require("esri.dijit.BasemapGallery");
in the require statements list at line 10
then
createBasemapGallery();
within the createMaps
function. In the app you referenced this is under findLayers(layers,i);
code at line 110
finally you are going to need to add the actual widget code from ESRI:
function createBasemapGallery() {
var basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
basemapGallery.startup();
dojo.connect(basemapGallery, "onError", function(msg) {console.log(msg)});
}
This should go near the end of map.js at line 251.
That should get the gallery to work.
I have learned a fair amount of programming just by utilizing the developer tools within the browsers to figure out how people have made things work. Most browsers use F12 to launch this. Using the ESRI Forums and of course GIS StackExchange are great tools as well.