Use the sliders below to learn how much environmental impact you can make with Restaurant Technologies Total Oil Management.
let locations; let jibs;
// Create event listener for range const allRanges = document.querySelectorAll(".calc__slider"); allRanges.forEach(wrap => { const range = wrap.querySelector(".calc__range"); const bubble = wrap.querySelector(".calc__bubble");
range.addEventListener("input", () => { setBubble(range, bubble); setData(range); }); setBubble(range, bubble); setData(range); });
// Calculate current range data bubble function setBubble(range, bubble) { const val = range.value; const min = range.min ? range.min : 0; const max = range.max ? range.max : 100; const newVal = Number(((val - min) * 100) / (max - min)); bubble.innerHTML = val;
bubble.style.left = `calc(${newVal}% + (${8 - newVal * 0.16}px))`; }
// Calculate and set data on the right function setData(range) {
if (range.id === 'calc__jibs') { jibs = range.value; } if (range.id === 'calc__loc') { locations = range.value; }
let d1 = document.getElementById("calc__sus-d1"); let d2 = document.getElementById("calc__sus-d2"); let d3 = document.getElementById("calc__sus-d3"); let d4 = document.getElementById("calc__sus-d4"); let d5 = document.getElementById("calc__sus-d5"); let d6 = document.getElementById("calc__sus-d6");
let landfill = ((jibs * 0.59) * (10090 / 14530)) + ((jibs * 0.41) * (6440 / 41900)) * 0.8; let jugsSaved = jibs; let wasteOil = jibs * 35 * 0.51565; let CO2 = ((((wasteOil*((1/3.3112216)*(1/2.20462)))*0.93)*14.559)-((wasteOil*((1/3.3112216)*(1/2.20462)))*2.775))*2.20462; let trash = jibs * 1.534; let cars = (((trash*0.59*3.851)+(trash*0.41*1.064)) + CO2) / 10141.3;
d1.innerHTML = Math.round(landfill * locations).toLocaleString('en', {useGrouping:true}); d2.innerHTML = Math.round(jugsSaved * locations).toLocaleString('en', {useGrouping:true}); d3.innerHTML = Math.round(wasteOil * locations).toLocaleString('en', {useGrouping:true}); d4.innerHTML = Math.round(CO2 * locations).toLocaleString('en', {useGrouping:true}); d5.innerHTML = Math.round(trash * locations).toLocaleString('en', {useGrouping:true}); d6.innerHTML = Math.round(cars * locations).toLocaleString('en', {useGrouping:true}); }