1var app = this.app || {}; 2 3(function(module) { 4 var _sidebar; 5 var _map; 6 var _colorFilter; 7 var _legend; 8 var _speciesFilter; 9 10 function init() { 11 _sidebar = new module.Sidebar(); 12 _map = new module.Map(_sidebar); 13 _speciesFilter = new module.SpeciesFilter(_map); 14 _legend = new module.Legend(_map, _speciesFilter); 15 _colorFilter = new module.ColorFilter(_map, _legend); 16 _geolocation = new module.Geolocation(_map); 17 18 _sidebar.showDefault(); 19 20 21 fetch("https://storage.googleapis.com/public-tree-map/data/map.json") 22 .then((res) => { 23 _sidebar.fillLastUpdate(res.headers.get('Last-Modified')) 24 return res.json()}) 25 .then((trees) => setData(trees)); 26 } 27 28 29 function setData(trees) { 30 var defaultPalette = module.palettes[_colorFilter.filter.item(0).value]; 31 var formattedSelect = _legend.setSelectLegend(_speciesFilter.selectFormatter(trees), defaultPalette); 32 33 _map.setTrees(trees, module.palettes['name_common']); 34 _speciesFilter.setSpecies(formattedSelect); 35 document.getElementById('loading').classList.add('hidden'); 36 } 37 38 39 40 function isTouchDevice(){ 41 return typeof window.ontouchstart !== 'undefined'; 42 } 43 44 function firstTimeDialog(){ 45 let firstTime = localStorage.getItem("firstTimeV2"); 46 if(firstTime==null&&isTouchDevice()){ 47 showFirstTimeDialog(); 48 } 49 } 50 function showFirstTimeDialog(){ 51 let firstTimeDialog = document.getElementById("first-time-dialog"); 52 firstTimeDialog.classList.remove("hidden"); 53 } 54 55 56 // EXPORTS 57 module.init = init; 58 module.setData = setData; 59 60})(app); 61 62function closeFirstTimeDialog(){ 63 let firstTimeDialog = document.getElementById("first-time-dialog"); 64 firstTimeDialog.classList.add("hidden"); 65 localStorage.setItem("firstTimeV2", false); 66}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.