Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- check: function(mac){
- var cmd = { // The command
- "action": "sdcard",
- "subaction": "info",
- "macaddr": mac
- };
- deviceAjax.send(cmd).then(function(data) { // Ajax call
- var row = $(document.getElementById(mac)).html(); // Updating the row
- var x = parseInt(row) - 1;
- sd.msg.push(data);
- if(data.result == "OK"){ // If already formatted
- $('#forbtn'+row).val("Format again");
- $("#forbtn"+row).addClass("red");
- $('#forbtn'+row).show();
- if (sd.go_to == "sdloop"){sd.x++; sd.loop();}
- else if (sd.go_to == "popup"){popup.unload("YES");}
- }
- else if (data.result == "ERROR"){
- if (deviceinfo.array[x]["sdcard"] == 1){// Is Extended
- $('#forbtn'+row).val("Format");
- $("#forbtn"+row).addClass("green");
- $('#forbtn'+row).show();
- }
- else{// Is Live Or None
- $("#forbtn"+row).hide();
- }
- if (sd.go_to == "sdloop"){sd.x++; sd.loop();}
- else if (sd.go_to == "popup"){popup.unload("YES");}
- }
- else if (data.result == "BUSY"){
- setTimeout(function(){ sd.check(mac); }, 1000);
- }
- })
- .catch(function(error) {
- console.log("SD Error:",error);
- setTimeout(function(){ sd.check(mac); }, 1000);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement