UNPKG

geopack

Version:

This is a npm package for the geoglows package

51 lines (42 loc) 1.6 kB
//HELPER FUNCTION FOR THE HYDROVIEWER var $ = require("jquery"); require('jquery-ui'); module.exports={ addContentToTabs: function(tab, tabContent){ tab.addEventListener("click", function (){ console.log("entering the forecast tab"); //remove buttonElement or create Button if( document.getElementById ("download") != null){ console.log("remove button?"); $("#download").remove(); } else{ var buttonElement=document.createElement("button"); buttonElement.innerHTML="Donwload Forecast Data"; buttonElement.setAttribute("id", "download"); divContainer.appendChild(buttonElement); } var divContainer=document.getElementById(tabContent); divContainer.style.display='block'; //Define the content of the tab if(tabContent=='forecast'){ geoglows.forecast.graph_f(reachid,tabContent); document.getElementById ("download").addEventListener("click", function() { geoglows.forecast.downloadData(reachid); } , false); } else if(tabContent=='historical'){ geoglows.historical.graph_h(reachid,tabContent); document.getElementById ("download").addEventListener("click", function() { geoglows.historical.downloadData(reachid); } , false); } else if(tabContent=='seasonal'){ geoglows.seasonal.graph_s(reachid,tabContent); document.getElementById ("download").addEventListener("click", function() { geoglows.seasonal.downloadData(reachid); } , false); } }); } }