diff --git a/src/public/js/stocked.js b/src/public/js/stocked.js index e92fac4..d234ef8 100644 --- a/src/public/js/stocked.js +++ b/src/public/js/stocked.js @@ -1,3 +1,28 @@ +class TimeLogger { + constructor() { + this.logs = []; + this.unlabelled_id = 0; + this.start = this.previous = Date.now(); + this.log('start'); + } + log(label) { + var now = Date.now(); + var log = { + 'when': now, + 'label': label, + 'elapsed': now - this.previous, + 'total': now - this.start + }; + this.logs.push(log); + this.previous = now; + return log; + } +} + +const timelogger = new TimeLogger; + +console.log(timelogger.logs[0]); + var test_data = { "Chattel Setting": { "Born Chattel": { @@ -1594,6 +1619,8 @@ var test_data = { } }; +console.log(timelogger.log("post-data")); + function StockedSetting(name, settingData) { this.isSubsetting = false; if(result = name.match(/(.*) setting/i)) { @@ -1709,6 +1736,13 @@ function StockedCtrl($scope, burningData) { $scope.StockedUtil = StockedUtil; /* testing */ + $scope.general = { + 'Name': '', + 'Stride': 7, + 'CommonTraits': ['foo', 'baz'], + 'selectedTrait': 'bar' + }; + $scope.parseStock = function (stockData){ let settings = []; for (let name in stockData) { @@ -1720,6 +1754,10 @@ function StockedCtrl($scope, burningData) { $scope.settings = $scope.parseStock(test_data); /* end testing */ + $scope.addSetting = function (){ + this.settings.push(new StockedSetting(this.newSettingName, {})); + } + $scope.collapseBody = function(data_target, $event) { $(data_target).collapse("toggle"); if($event) { $event.stopPropagation(); } diff --git a/src/views/partials/stocked.erb b/src/views/partials/stocked.erb index ca39064..1ccecf5 100644 --- a/src/views/partials/stocked.erb +++ b/src/views/partials/stocked.erb @@ -55,7 +55,29 @@