"use strict"; (function($) { var supporters = {}; var weights = {}; var types = ["enterprise", "professional", "patron"]; function shuffle(array) { var i = 0, j = 0, temp = null; for (i = array.length - 1; i > 0; i -= 1) { j = Math.floor(Math.random() * (i + 1)); temp = array[i]; array[i] = array[j]; array[j] = temp; } } function pad(number) { return number < 10 ? '0' + number : number; } function fromDate(d) { return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()); } function toDate(s) { var x = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s); if (x) return new Date(parseInt(x[1]), parseInt(x[2]) - 1, parseInt(x[3])); return null; } function Supporter(type, json) { this.type = type; this.name = json.name; this.logo = json.logo; this.url = json.url; this.showName = json.showName; this.start = json.range ? toDate(json.range[0]) : null; this.end = json.range ? toDate(json.range[1]) : null; this.weight = (!json.weight && json.weight !== 0.0) ? 1.0 : json.weight; } Supporter.prototype.inRange = function(d) { return (!this.start || this.start <= d) && (!this.end || this.end > d); }; Supporter.prototype.render = function() { var d = $("
").addClass("supportItem").addClass(this.type); var a = d; if (this.url) { a = $("").attr("href", this.url).attr("rel", "noopener").attr("target", "_blank"); d.append(a); } var n = $("").text(this.name); a.append(n); if (this.logo) { a.addClass("logo"); var i = new Image(); var showName = this.showName; i.onload = function() { var w = i.width; var h = i.height; var wf = w / 162; var hf = h / 80; var f = hf > wf ? hf : wf; var wt = Math.round(w / f); var ht = Math.round(h / f); i.width = wt; i.height = ht; var ji = $(i); if (!showName) a.empty(); ji.css("width", wt + "px"); ji.css("height", ht + "px"); ji.attr("alt", n.text()); ji.attr("title", n.text()); a.prepend(ji); }; i.src = 'files/' + this.logo; } return d; } function errorHandler(xhr, statusText, err) { var errMsg = "Can't connect to projectlombok.org to fetch the list of licensees and supporters."; if (console && console.log) { console.log("AJAX error for loading list of supporters:"); console.log(err); } var errBox = $("").addClass("errorBox").text(errMsg); $(".supporters").text("").append(errBox); } function successHandler(data) { $.each(types, function() { var t = this; supporters[t] = []; if (data && data[t]) $.each(data[t], function() { supporters[t].push(new Supporter(t, this)); }); }); weights = data.modWeight; if (typeof weights !== 'object') weights = {}; updatePage(); } function build() { var spinner = $("