JSFiddle - React, Tailwind, and code Playground
by techunter
HTML
<div id="main">
</div>
CSS
div#main {
position:relative;
}
div.variable {
margin:7px;
width: 700px;
position:relative;
}
.variable label {
left:0px;
}
.variable input {
position:absolute;
right:0px;
width:500px;
}
.variable.locals{
background-color:#EEE;
}
JavaScript
var checkLoop = {
max: {},
running: true,
firstStop: true,
iterators: {},
display:function(){},
start: function (it, max, zeroBased) {
checkLoop.iterators[it] = zeroBased ? -1 : 0;
checkLoop.max[it] = (max !== 'undefined' && max >= 0) ? max : 100;
},
end: function (it) {
delete checkLoop.max[it];
delete checkLoop.iterators[it];
},
onStop: function (it) {
if (checkLoop.firstStop) {
console.log('Max reached, stopped : ' + it + '->' + checkLoop.iterators[it]);
checkLoop.firstStop = false;
checkLoop.display();
debugger;
}
return true;
},
check: function (it, nonBlocking) {
if (checkLoop.running) {
var val = checkLoop.iterators[it];
checkLoop.iterators[it] = ++val;
var out = val >= checkLoop.max[it];
console.log(it + ' --> ' + val);
checkLoop.running = (!out || nonBlocking);
if (out) {
console.log(nonBlocking);
console.log(checkLoop);
}
if (!checkLoop.running) checkLoop.onStop(it);
return checkLoop.running && !out;
}
return false;
}
};
$(function () {
var globals = {
OptimumBlockList: ["BLOC_009", "BLOC_010", "BLOC_009", "BLOC_010", "BLOC_009", "BLOC_012", "BLOC_010", "BLOC_010", "BLOC_009", "BLOC_010"],
Block: ["BLOC_009", "BLOC_009", "BLOC_010", "BLOC_012"],
WhlOptimum: ["260013001", "260013074", "260013025", "260013061"],
NbHum: [2, 4, 5, 2],
NbDMX: [10, 1, 3, 10],
DepthListOrdered: ["110.0", "110.0", "110.0", "110.0", "110.0", "380.0", "110.0", "110.0", "110.0", "110.0"],
ProcessListOrdered: [100000024, 100000027, 100000024, 100000027, 100000024, 100000027, 100000027, 100000027, 100000024, 100000027],
EmptyWHL: ["260013076", "260013079", "260013080", "260013081", "260013039",...