Pendigard's picture
Upload folder using huggingface_hub (part 7)
ae4627d verified
Raw History Blame Contribute Delete
1.68 kB
(function() {
var Device, FakeDevice;
Device = (function() {
function Device(ip, port) {
this.ip = ip;
this.port = port;
}
Device.prototype.getBusinessMusics = function() {
return this.get("http://" + this.ip + ":" + this.port + "/bm", function() {});
};
Device.prototype.setLevel = function(id, level) {
return this.put("http://" + this.ip + ":" + this.port + "/bm/" + id, function() {});
};
return Device;
})();
FakeDevice = (function() {
function FakeDevice(ip, port) {
this.ip = ip;
this.port = port;
this.programs = [
{
id: 1,
name: "Program 1",
zones: [1, 2, 3]
}, {
id: 2,
name: "Program 1",
zones: []
}, {
id: 3,
name: "Program 1",
zones: [100]
}, {
id: 4,
name: "Program 1",
zones: []
}
];
}
FakeDevice.prototype.getBusinessMusics = function(success) {
return success(this.programs);
};
FakeDevice.prototype.setLevel = function(id, level) {
console.log("Set level " + level + " to device " + id);
return this.programs[0];
};
FakeDevice.prototype.setZones = function(id, zones) {
var text;
text = "This program is currently not assigned to any zone!";
if (zones.length > 0) {
return $(".program-container[data-id=" + id + "] .program-zones").html("This zone is currently assigned to " + zones.length + " zones: " + (zones.sort().join(", ")));
}
};
return FakeDevice;
})();
window.FakeDevice = FakeDevice;
}).call(this);