// Generated by CoffeeScript 1.4.0 (function() { window.clusterColor = d3.scale.category10(); window.tagColor = d3.scale.category20(); window.no_tag = "-"; window.parseTags = function(content) { var tag_lines, tags; tag_lines = d3.csv.parseRows(content); tags = {}; tag_lines.map(function(tag_line) { var values; values = tag_line.slice(1); return tags[tag_line[0]] = values.indexOf(window.no_tag) === -1 ? values : []; }); return tags; }; window.getFrequencies = function(array) { var frequencies; frequencies = {}; _.chain(array).groupBy(function(p) { return p; }).each(function(e, i) { return frequencies[i] = _.size(e); }); return frequencies; }; window.getTagNames = function(tags) { var tagFrequencies, tagValues; tagValues = _.chain(tags).values().flatten(); tagFrequencies = window.getFrequencies(tagValues.value()); return tagValues.unique().sortBy(function(x) { return tagFrequencies[x]; }).value().reverse(); }; window.replace = function(array, replaceItem, replaceWith) { var item, _i, _len, _results; _results = []; for (_i = 0, _len = array.length; _i < _len; _i++) { item = array[_i]; if (item === replaceItem) { _results.push(replaceWith); } else { _results.push(item); } } return _results; }; window.isNumber = function(n) { return !isNaN(parseFloat(n)) && isFinite(n); }; window.getUrlVars = function() { var vars; vars = {}; window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/g, function(m, key, value) { return vars[key] = value; }); return vars; }; window.resetOnClick = function(model) { return d3.select("body").on("click", function() { model.set({ clickedRowId: null }); model.set({ currentTag: null }); d3.selectAll(".tag_name").classed("current", 0); model.set({ currentCluster: null }); return d3.selectAll(".clusters span").classed("current", 0); }); }; window.joinSentence = function(arr) { var arr2, last, sentence; arr2 = arr.slice(0); last = arr2.pop(); if (arr2.length > 0) { sentence = arr2.join(", "); return sentence + " and " + last; } else { return last; } }; }).call(this);