1//JS for things that are useful 2 3var tiltCaculators = new function () { 4 5 6 function AppViewModel() { 7 var self = this; 8 9 self.firstName = ko.observable('Bob'); 10 self.lastName = ko.observable('Smith'); 11 self.fullName = ko.computed(function () { 12 return self.firstName() + " " + self.lastName(); 13 }); 14 } 15 16 function triathlonCalculator() { 17 var self = this; 18 self.Swim = ko.observable(25); 19 self.T1 = ko.observable(2); 20 self.Bike = ko.observable(400); 21 self.T2 = ko.observable(2); 22 self.Run = ko.observable(300); 23 24 self.TotalMinutes = ko.computed(function () { 25 return (self.Swim() + self.T1() + self.Bike() + self.T2() + self.Run()); 26 }, this); 27 28 self.TotalTimeString = ko.computed(function () { 29 var hours = Math.floor(self.TotalMinutes() / 60); 30 var minutes = self.TotalMinutes() % 60; 31 return hours.toString() + ':' + minutes.toString(); 32 }, this); 33 34 } 35 36 var triathlonCalculatorInstance = null; 37 var kickTriathlonCalculator = function () { 38 39 triathlonCalculatorInstance = new triathlonCalculator(); 40 var element = document.getElementById('triathlonCalculator'); 41 ko.applyBindings(triathlonCalculatorInstance, element); 42 43 } 44 45 46 //expose the functions we want to expose 47 return { 48 kickTriathlonCalculator: kickTriathlonCalculator 49 }; 50 51}
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.