var pl, initSVG, bulildButton, logAction, showUrl, initURL; pl = require("prelude-ls"); initSVG = function(){ var f, build, i$; f = {}; f.margin = { top: 30, left: 30, right: 30, bottom: 30 }; f.w = 650 - f.margin.left - f.margin.right; f.h = 350 - f.margin.top - f.margin.bottom; build = function(){ var svg; svg = d3.select(".interaction").append("svg").attr({ "width": f.w + f.margin.left + f.margin.right, "height": f.h + f.margin.top + f.margin.bottom }).append("g").attr({ "transform": "translate(" + f.margin.left + "," + f.margin.top + ")", "width": f.w, "height": f.h }); svg.append("g").attr({ "class": "xAxis axis", "transform": "translate(0," + f.h + ")" }); svg.append("g").attr({ "class": "yAxis axis", "transform": "translate(" + f.w + ",0)" }); return svg; }; for (i$ in f) { (fn$.call(this, i$)); } return build; function fn$(it){ build[it] = function(v){ f[it] = v; return build; }; } }; bulildButton = function(){ var f, build, i$; f = {}; f.mousedownAct = function(){}; build = function(selection){ return selection.each(function(data, index){ return d3.select(this).selectAll("button").data(data).enter().append("button").attr({ "class": "btn btn-default" }).text(function(it){ return it; }).on("mousedown", function(it){ logAction(f.mousedownAct, it); return f.mousedownAct(it); }); }); }; for (i$ in f) { (fn$.call(this, i$)); } return build; function fn$(it){ build[it] = function(v){ f[it] = v; return build; }; } }; logAction = function(action, it){ return d3.select(".menuBar").append("button").attr({ "class": "btn btn-info" }).text(action.name + "(" + it + ")"); }; showUrl = function(url, descript){ return "" + descript + ""; }; initURL = function(defaultURL){ var link; link = {}; if (window.location.href.indexOf("?") === -1) { window.location = window.location + defaultURL; } pl.map(function(part){ return link[part.split("=")[0]] = part.split("=")[1]; })( window.location.href.split("?")[1].split("&")); d3.selectAll(".sourceFile").html(showUrl(link["data"], "Data") + " with " + showUrl(link["descript"], "Narrative")); return link; };