1 var ClientDownloads = function( wrapper, clients, cl_default) {
3 this.clients = clients;
4 this.cl_default = cl_default;
7 ClientDownloads.prototype.update = function() {
10 var current_os = BrowserDetect.OS;
11 //var current_os = "linux";
12 var current_client = _.filter(this.clients, function(el){return el.os == current_os});
14 if (_.isEmpty(current_client)){
15 current_os = this.cl_default;
16 var current_client = _.filter(this.clients, function(el){return el.os == current_os})[0];
20 current_client = current_client[0];
22 this.el.find("#os").html(current_client.os);
23 this.el.find(".btn_01").attr('href',current_client.link);
25 var new_list = _.filter(this.clients, function(el){return el.os != current_os});
27 first = new_list.shift();
28 popped = new_list.pop();
30 this.el.find(".other-clients").append("<a href='"+first.link+"'>"+first.os+"</a>");
32 _.each(new_list, function(client) {
33 self.el.find(".other-clients").append(", <a href='"+client.link+"'>"+client.os+"</a>")
35 this.el.find(".other-clients").append(" and <a href='"+popped.link+"'>"+popped.os+"</a>.");
45 var ClientDownloads = function(wrapper, clients) {
47 this.clients = clients;
49 console.log(this.clients);
50 console.log("end test")
53 ClientDownloads.prototype.update = function() {
54 console.log("updating clients");
56 var current_os = "linux";
57 var current_client = _.filter(this.clients, function(el){return el.os == current_os})[0];
58 this.el.find(".current-os-link").html(current_client.os);
61 _.each(this.clients, function(client) {
62 self.el.find(".other-clients").append("<span>"+client.os+"</span>")
64 console.log(current_client);