Code:
/**
* Detect the first empty space without a click
*
**/
function CheckStatus (m) {//++ (m = 0 as defined above)
var slots = Document.queryselectorall (". Slot");
var statusement = Document.queryselector (". slot[data-ind= '" + (M + 1) + "']");//slot for the next index
for (var i = 0; i < slots.length; i++) {
Miglobals.removeclass (Slots[i], "Freom");//move out of the Freom added in the previous slot
};
if (statusement) {//
if (Statusement.getattribute ("data-status") = = "n") {//data-status is a property value, when empty in the slot Data-status = n is added Freom
Miglobals.addclass (statusement, "Freom");
}else{
Comparearray ();//* gets the minimum value of NUM, and then adds the Freom class name
}
}
}
/**
* Get the minimum value of num and add the Freom class name.
* Added to the current click in the package function
**/
function Comparearray () {
var num=[];//creating an array
var slots = Document.queryselectorall (". slot[data-status= ' n ')");//Get all slots with a property value of [data-status= ' n ']
for (var i = 0; i < slots.length; i++) {//looping through the contents of the slot is the number of empty times
Miglobals.removeclass (Slots[i], "Freom");//move out of Freom in the slot
Num[i] = Slots[i].getattribute ("Data-ind");//bar The value of the property that is traversed into the data-ind to this array
};
var index = Math.min.apply (null, num);//Gets the minimum value in the array
var indexement = Document.queryselector (". slot[data-ind= '" + Index + "']");//Gets the smallest slot in the array to add Freom
Miglobals.addclass (indexement, "Freom");
}
Dynamic Add virtual box (hint with:) (click on the content when there is a virtual box hint, point down when there are hints, but are to click on the first add)