From d5ccd4c8ae4ce30e51aae60af9b35b4639644d79 Mon Sep 17 00:00:00 2001 From: Kate Roe Date: Tue, 30 Jul 2013 10:50:05 -0400 Subject: [PATCH] wait the last one didn't work --- perfectSteak.js | 236 ------------------------------------------------ 1 file changed, 236 deletions(-) diff --git a/perfectSteak.js b/perfectSteak.js index 2bc6f32..05632b0 100644 --- a/perfectSteak.js +++ b/perfectSteak.js @@ -275,242 +275,6 @@ var perfectSteak = function (div) { return { setup: setup }; -var perfectSteak=function(div){ - - -function Model(div){ -var meatTemp=23; -var thickness=6; -var data=[]; -var timeStep=15; -var inputTable=$(".inputTable"); - -var changeThickness=function(newVal){ - -thickness=newVal; - -} - -var changeMeatTemp=function(newVal){ -meatTemp=newVal; -} - -//OK THIS WORKS NOW -var dataClear=function(){ -while(data.length>0){ -data.pop(); -} -} - -//THIS ADDS AN ELEMENT TO THE DATA ARRAY -var dataAdd=function(item){ - -data.push(item); -} - -//THIS IS FOR CHANGING THE ENTIRE DATA ARRAY -var dataChange=function(array){ -data=array; -for (var d=0; d"); -var displayDiv = $("
"); -displayDiv.append(inputTable); -div.append(displayDiv); - -div.append -var addButton; -var subButton; -var flipButton; -var cookButton; - -var numRows=2; - -var buildTable=function(){ -var inpTabHeader=$("Time (s)Side 1 (°C)Side 2 (°C)"); -inputTable.append(inpTabHeader); -var timeStep=model.timeStep; - -var len=model.data.length; -var newData=[] -$("#cookButton").remove(); - -for(var i=0; i+"); -subButton=$(""); -flipButton=$(""); -cookButton=$(""); - -var row=$(""); -var timeCol=$(""); -var inp1=$(""); -var inp2=$(""); -var step1Col=$(""); -step1Col.append(inp1); -var step2Col=$(""); -step2Col.append(inp2); -step1Col.append(flipButton); -row.append(timeCol, step1Col, step2Col); -inputTable.append(row); -if (i == numRows-1){ -inputTable.append(addButton, subButton); -displayDiv.append(cookButton); -} -if (len==0){ - -inp1.val(23); -inp2.val(23); -model.dataAdd([parseFloat($("#row"+i+"time").val()), parseFloat($("#inp1_"+i).val()), parseFloat($("#inp2_"+i).val())]) - -} else if (i<=len){ - -inp1.val(model.data[i][1]); -inp2.val(model.data[i][2]); - -model.dataAdd([parseFloat($("#row"+i+"time").val()), parseFloat($("#inp1_"+i).val()), parseFloat($("#inp2_"+i).val())]) -} else{ - -inp1.val(model.data[i-1][1]); -inp2.val(model.data[i-1][2]); -model.dataAdd([parseFloat($("#row"+i+"time").val()), parseFloat($("#inp1_"+iminus).val()), parseFloat($("#inp2_"+iminus).val())]) -} -timeFun(i); -flipButtonFun(i); -} -model.dataClear(); -addButtonFun(); -subButtonFun(); -CookButtonFun(); -}; - var addRow=function(table) - { -flipButton=$(""); -var row=$(""); -var i=numRows-1; -var timeCol=$(""); -var inp1=$(""); -var inp2=$(""); -var step1Col=$(""); -step1Col.append(inp1); -var step2Col=$(""); -step2Col.append(inp2); -step1Col.append(flipButton); -row.append(timeCol, step1Col, step2Col); -timeFun(i); -flipButtonFun(i); -table.append(row); -inp1.val(23); -inp2.val(23); -model.dataAdd([parseFloat($("#row"+i+"time").val()), parseFloat($("#inp1_"+i).val()), parseFloat($("#inp2_"+i).val())]) - } - var delRow=function(table) - { - - $('.'+table.class+' tr:last').remove(); - } -var addButtonFun=function(){ -addButton.on("click", function(){ -numRows++; -addRow($(".inputTable")); -}); -}; - -var subButtonFun=function(){ - -subButton.on("click", function(){ -numRows--; -delRow($(".inputTable")); -if (numRows == 1){ -$(".inputTable").empty(); -buildTable(numRows); -subButton.remove(); -}else{ - -$(".inputTable").empty(); -buildTable(numRows); -} -}); -}; - -var CookButtonFun=function(){ - cookButton.on("click", function(){ -d3.select("svg") - .remove(); -model.dataClear(); -for (var e=0; e Meat Thickness (cm) ")); -$("#thicknessInp").val("6"); -var steakTemp=($("
Meat Temperature (°C)
")); - -// thicknessInp.change(function(){ -// model.changethickness(thicknessInp.val()); -// }) - -div.append(thicknessInp, steakTemp); -}; -return {setup:setup}; - }();