Skip to content

Commit

Permalink
Update brewxml.htm
Browse files Browse the repository at this point in the history
  • Loading branch information
LKosoj committed Nov 25, 2022
1 parent 4f4f40e commit 178e6d2
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions data/brewxml.htm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
else return "Нет в рецепте";
}

function check_value(val, type){
if (val != "Нет в рецепте") return val;
if (type == "bt") return 60;
if (type == "pt") return 20;
}

function get_brew_info(xml){
is_program = false;
let recipe = parseXml(xml);
Expand Down Expand Up @@ -161,7 +167,8 @@
dl1.className = "ingredients";

var type = document.createElement("label");
type.textContent = "Солод";
if (get_object_value(ferm.TYPE) == "Adjunct") type.textContent = "Добавка";
else type.textContent = "Солод";
type.className = "ingType";
dl1.appendChild(type);
var name = document.createElement("label");
Expand Down Expand Up @@ -230,25 +237,28 @@
var MISC = [];
if (Array.isArray(recipe.RECIPES.RECIPE.MISCS.MISC)){
MISC = recipe.RECIPES.RECIPE.MISCS.MISC;
} else {MISC.push(recipe.RECIPES.RECIPE.MISCS.MISC) }
} else if (!(recipe.RECIPES.RECIPE.MISCS.MISC === undefined)) {MISC.push(recipe.RECIPES.RECIPE.MISCS.MISC) }
for (let misc of MISC){
var dl1 = document.createElement("div");
dl1.className = "ingredients";
if (get_object_value(misc.TYPE) == "Flavor" || get_object_value(misc.TYPE) == "Fining"){
var dl1 = document.createElement("div");
dl1.className = "ingredients";

var type = document.createElement("label");
type.textContent = "Специи";
type.className = "ingType";
dl1.appendChild(type);
var name = document.createElement("label");
name.textContent = get_object_value(misc.NAME)
name.className = "ingName";
dl1.appendChild(name);
var amount = document.createElement("label");
amount.textContent = get_object_value(misc.AMOUNT,"",-4);
amount.className = "ingAmount";
dl1.appendChild(amount);

dl.appendChild(dl1);
var type = document.createElement("label");
if (get_object_value(misc.TYPE) == "Flavor") type.textContent = "Специи";
else if (get_object_value(misc.TYPE) == "Fining") type.textContent = "Очистка";
type.className = "ingType";
dl1.appendChild(type);
var name = document.createElement("label");
name.textContent = get_object_value(misc.NAME)
name.className = "ingName";
dl1.appendChild(name);
var amount = document.createElement("label");
amount.textContent = get_object_value(misc.AMOUNT,"",-4);
amount.className = "ingAmount";
dl1.appendChild(amount);

dl.appendChild(dl1);
}
}

//show mash step
Expand Down Expand Up @@ -280,7 +290,7 @@
MASH = recipe.RECIPES.RECIPE.MASH.MASH_STEPS.MASH_STEP;
} else {MASH.push(recipe.RECIPES.RECIPE.MASH.MASH_STEPS.MASH_STEP) }
for (let mash of MASH){
var dl1 = document.createElement("div");
var dl1 = document.createElement("div");
dl1.className = "ingredients";

var name = document.createElement("label");
Expand Down Expand Up @@ -309,17 +319,19 @@
ingr.appendChild(dl);

is_program = true;
program = program + "B;0.00;" + get_object_value(recipe.RECIPES.RECIPE.BOIL_TIME) +
"\nC;" + get_object_value(recipe.RECIPES.RECIPE.PRIMARY_TEMP) +
";0\nF;" + get_object_value(recipe.RECIPES.RECIPE.PRIMARY_TEMP) + ";0";
pt = check_value(get_object_value(recipe.RECIPES.RECIPE.PRIMARY_TEMP), "pt");
bt = check_value(get_object_value(recipe.RECIPES.RECIPE.BOIL_TIME), "bt");
program = program + "B;0.00;" + bt +
"\nC;" + pt +
";0\nF;" + pt + ";0";
}

function set_program(){
if (!is_program) {
alert("Error");
return;
}
//alert(program);
alert(program);
document.getElementById("WProgram").value = program;

var server = '/program';
Expand Down

0 comments on commit 178e6d2

Please sign in to comment.