UNPKG

tenna

Version:

A node js application that lets you easily stream most videos from any PC/laptop in your home network, to other devices in the network with a browser.

59 lines (54 loc) 1.33 kB
(function() { var decimalFormatter, vueconf; decimalFormatter = function(value, arg) { var amt; amt = arg ? arg[0] : 0; return parseInt(value, 10).toFixed(amt); }; vueconf = { ready: function() { var self; self = this; self.videoname = self.$el.getAttribute("id"); return self.getData(); }, computed: { amtComplete: { $get: function() { return decimalFormatter(this.complete) + "%"; } } }, methods: { getData: function() { var self; self = this; return $.get("/encode/status/" + self.videoname, function(res) { self.eta = res.eta; return self.complete = res.percentComplete; }).done(function(res) { return setTimeout(function() { return self.getData(); }, 300); }).fail(function(res) { if (res.status === 404) { return self.$destroy(); } else { return setTimeout(self.getData, 1500); } }); } }, filters: { decimals: decimalFormatter } }; $(".tile").each(function(i, val) { vueconf.el = "#" + val.getAttribute("id"); vueconf.data = { complete: "0.00%", eta: "eta" }; return new Vue(vueconf); }); }).call(this);