180 }
181};
182
183$(document).ready(function(){184 build_ui();185});
170 // https://stackoverflow.com/questions/7862233
171 // Change hash for page-reload
172 var prefix = "tab_";
173 $('.nav-tabs.maintabs a').on('shown.bs.tab', function (e) {174 window.location.hash = e.target.hash.replace("#", "#" + prefix);175 })176 // Read any hash links
177 var hash = document.location.hash;
178 if (hash) {
55 data.agronomic.push($(elem).val());
56 });
57 // Which soil are checked
58 $('#soil-ui input:checked').each(function(idx, elem){ 59 data.soil.push($(elem).val()); 60 }); 61
62 return data;
63}
51 data.water.push($(elem).val());
52 });
53 // Which agronomic are checked
54 $('#agronomic-ui input:checked').each(function(idx, elem){ 55 data.agronomic.push($(elem).val()); 56 }); 57 // Which soil are checked
58 $('#soil-ui input:checked').each(function(idx, elem){
59 data.soil.push($(elem).val());
47 data.treatments.push($(elem).val());
48 });
49 // Which water are checked
50 $('#water-ui input:checked').each(function(idx, elem){ 51 data.water.push($(elem).val()); 52 }); 53 // Which agronomic are checked
54 $('#agronomic-ui input:checked').each(function(idx, elem){
55 data.agronomic.push($(elem).val());
It is recommended to use arrow functions as callbacks.
Arrow functions can be an attractive alternative to function expressions for callbacks or function arguments.
For example, arrow functions are automatically bound to their surrounding scope/context. This provides an alternative to the pre-ES6 standard of explicitly binding function expressions to achieve similar behavior.
Additionally, arrow functions are:
less verbose, and easier to reason about.
bound lexically regardless of where or when they are invoked.
func(function(a) { return a; }); // ERROR
// prefer: func(a => a)
func(function() { return this.a; }.bind(this)); // ERROR
// prefer: func(() => this.a)
// arrow function callback
func(a => a); // OK
// generator as callback
func(function*() { yield; }); // OK
// function expression not used as callback or function argument
var funcVar = function func(a) { return a; }; // OK
// unbound function expression callback
func(function() { return this.a; }); // OK
// recursive named function callback
func(function recursiveFunc(n) { return n && n + recursiveFunc(n - 1); }); // OK