// Generated by LiveScript 1.2.0
var ref$, unique, keys, objToLists, values, filter, ggl, fltCo2, fltCntCo2, getData, setCntName, svg, fmt000, tblCountry, rvTblCountry, obj, nm, sclVwcntX, sclVwcntY;
ref$ = require("prelude-ls"), unique = ref$.unique, keys = ref$.keys, objToLists = ref$.objToLists, values = ref$.values, filter = ref$.filter;
ggl = {};
ggl.node = [];
ggl.margin = {
  top: 70,
  left: 50,
  right: 100,
  bottom: 50
};
ggl.w = 750 - ggl.margin.left - ggl.margin.right;
ggl.h = 670 - ggl.margin.top - ggl.margin.bottom;
ggl.red = "rgb(158,6,6)";
ggl.country = "taiwan";
ggl.queryls = [];
ggl.rwTopMrgn = 10;
fltCo2 = [];
fltCntCo2 = [];
ggl.screenh = $(window).height();
ggl.view = "vwtyp";
ggl.unit = "abs";
ggl.dscrpts = null;
ggl.hghidx = 0;
getData = function(dataset, incol, outcol, inidx){
  var i$, len$, itm;
  for (i$ = 0, len$ = dataset.length; i$ < len$; ++i$) {
    itm = dataset[i$];
    if (itm[incol] === inidx) {
      return itm[outcol];
    }
  }
};
setCntName = function(){
  return d3.selectAll(".cntname").text(getData(lsCntView, "enname", "text", ggl.country));
};
(function(){
  var s;
  if (window.location.search) {
    s = window.location.search.split("?")[1].split("&");
    s.map(function(d, i){
      var t;
      t = d.split("=");
      if (ggl[t["0"]] !== undefined) {
        ggl[t["0"]] = t["1"];
        return ggl.queryls.push(t["0"]);
      }
    });
  }
  return setCntName();
})();
d3.selection.prototype.moveToFront = function(){
  return this.each(function(){
    return this.parentNode.appendChild(this);
  });
};
svg = d3.select("body").select(".svgholder").append("svg").attr("width", ggl.w + ggl.margin.left + ggl.margin.right).attr("height", ggl.h + ggl.margin.top + ggl.margin.bottom).append("g").attr("transform", "translate(" + ggl.margin.left + ", " + ggl.margin.top + ")");
svg.append("text").text("hello").attr({
  "class": "explain",
  "x": ggl.w / 2,
  "y": 200
}).style({
  "font-size": "50px",
  "text-anchor": "middle",
  "opacity": 0
});
fmt000 = d3.format(".2s");
tblCountry = {};
rvTblCountry = {};
(function(){
  var col, ls, len, unit;
  col = 3;
  ls = ["taiwan", "uk", "australia", "germany", "japan", "usa"];
  len = ls.length;
  unit = (ggl.w + ggl.margin.left + ggl.margin.right) / col;
  return ls.map(function(d, i){
    return tblCountry[d] = {
      "x": i % col * unit,
      "y": ~~(i / col) * unit
    };
  });
})();
for (obj in tblCountry) {
  nm = tblCountry[obj].x + "_" + tblCountry[obj].y;
  rvTblCountry[nm] = obj;
}
sclVwcntX = function(country){
  return tblCountry[country].x;
};
sclVwcntY = function(country){
  return tblCountry[country].y;
};
d3.tsv("./data/co2_" + ggl.country + ".tsv", function(err, tsvData){
  var errHandle, getCtgry, getUnqitm, co2, lsYear, lsCtgr, lsPname, lsGas, sclVwindX, sclVwindY, sclVwsbindY, sclVwtypY, sclVwitmY, sclR, tw_only, setxy, force, shrtName, byCountry, exline, exline2, extext, extext2, clearOpacity, mouseAction, init, red, green, blue, grey, purple, lightblue, watergreen, fill, filling, setTitle, collide, setLine, link, setHighlight, setNote, setExlpain, setList, substringMatcher, clickView, clickCnt, showNHideCircle, updateSvg, ticking, scrolling, scrollingTo, actInit, actShowco2, actShowch4, actShowperind, actShowabsco2, actShowsubind, actMacro, lsExplain, initiateData;
  errHandle = {
    "No": 0,
    "Na": 0,
    "NE": 0,
    "NO": 0,
    "NA": 0,
    "IE": 0,
    "C": 0,
    "": 0,
    "-": 0
  };
  console.log(errHandle);
  getCtgry = function(it){
    return it.split("-")[0];
  };
  getUnqitm = function(it){
    return it.pname + "-" + it.type;
  };
  tsvData = tsvData.filter(function(it){
    if (+it.year === 1992 || +it.year === 1997 || +it.year === 2002 || +it.year === 2007 || +it.year === 2012) {
      return true;
    } else {
      return false;
    }
  });
  co2 = tsvData.filter(function(it){
    var blank, itm, r;
    blank = true;
    if (it.pname === "-") {
      return false;
    }
    for (itm in it) {
      itm = itm.trim();
      if (itm !== "name" && itm !== "pname") {
        r = errHandle[it[itm]];
        if (r === undefined && isNaN(it[itm]) === false) {
          it[itm] = +it[itm];
          if (itm !== "year" && it[itm] !== 0 && itm !== "total") {
            blank = false;
            fltCo2.push({
              "country": it.country,
              "pname": it.pname,
              "type": +it[itm] < 0 ? "吸收" + itm : itm,
              "year": it.year,
              "mt": {
                "abs": (+it[itm]) / 1000,
                "ppl": (+it[itm] / 1000) / getData(tw_gdp_ppl, "year", "ppl", +it.year),
                "km2": (+it[itm] / 1000) / 35980,
                "gdp": (+it[itm] / 1000) / getData(tw_gdp_ppl, "year", "gdp", +it.year)
              },
              "category": getCtgry(it.pname),
              "xy": null
            });
          }
        } else {
          it[itm] = r;
        }
      }
    }
    return true;
  });
  lsYear = unique(fltCo2.map(function(it){
    return it.year;
  }));
  lsCtgr = fltCo2.map(function(it){
    return getCtgry(it.pname);
  });
  lsPname = fltCo2.map(function(it){
    return it.pname;
  });
  lsGas = ["CO2", "CH4", "N2O", "HFCs", "PFCs", "SF6", "吸收CO2"];
  sclVwindX = d3.scale.ordinal().rangeBands([0, ggl.w]).domain(lsYear.sort(function(a, b){
    return (+a) - (+b);
  }));
  sclVwindY = d3.scale.ordinal().rangeBands([0, ggl.h]).domain(lsCtgr);
  sclVwsbindY = d3.scale.ordinal().rangeBands([0, ggl.h]).domain(lsPname);
  sclVwtypY = d3.scale.ordinal().rangeBands([0, ggl.h]).domain(lsGas);
  sclVwitmY = d3.scale.ordinal().rangeBands([0, ggl.h]).domain(fltCo2.map(function(it){
    return getUnqitm(it);
  }));
  sclR = d3.scale.sqrt().domain([
    0, d3.max(fltCo2, function(it){
      return it.mt[ggl.unit];
    })
  ]).range([1, 20]);
  tw_only = function(it){
    return sclVwindX(it.year);
  };
  setxy = function(it){
    return {
      "vwtyp": {
        "x": tw_only(it),
        "y": sclVwtypY(it.type)
      },
      "vwyer": {
        "x": tw_only(it),
        "y": 10
      },
      "vwind": {
        "x": tw_only(it),
        "y": sclVwindY(getCtgry(it.pname))
      },
      "vwsbind": {
        "x": tw_only(it),
        "y": sclVwsbindY(it.pname)
      },
      "vwitm": {
        "x": tw_only(it),
        "y": sclVwitmY(getUnqitm(it))
      },
      "vwcnt": {
        "x": it.country === "taiwan" && it.year !== "2012"
          ? -400
          : sclVwcntX(it.country),
        "y": sclVwcntY(it.country)
      }
    };
  };
  fltCo2.map(function(it){
    return it.xy = setxy(it);
  });
  console.log(co2);
  console.log(fltCo2);
  force = d3.layout.force().nodes(fltCo2).links([]).gravity(0).charge(0).size([ggl.w, ggl.h]).on("tick", tick);
  function tick(it){
    var k, q, i, n;
    k = 0.1 * it.alpha;
    fltCo2.forEach(function(o, i){
      o.y += (o["xy"][ggl.view].y - o.y) * k;
      return o.x += (o["xy"][ggl.view].x - o.x) * k;
    });
    q = d3.geom.quadtree(fltCo2);
    i = 0;
    n = fltCo2.length;
    while (++i < n) {
      q.visit(collide(fltCo2[i]));
    }
    return ggl.node.attr({
      "cx": function(it){
        return it.x;
      },
      "cy": function(it){
        return it.y;
      }
    });
  }
  shrtName = function(it){
    var ar, l;
    ar = it.split("-");
    l = ar.length;
    return ar[l - 1];
  };
  byCountry = function(it){
    return it.each(function(d, i){
      d.x = i * 15;
      return d.y = 20;
    });
  };
  exline = svg.append("line");
  exline2 = svg.append("line");
  extext = svg.append("text");
  extext2 = svg.append("text");
  clearOpacity = function(){
    d3.selectAll(".node").style({
      "opacity": 1
    });
    exline.style({
      "opacity": 0
    });
    exline2.style({
      "opacity": 0
    });
    extext.style({
      "opacity": 0
    });
    return extext2.style({
      "opacity": 0
    });
  };
  mouseAction = function(it){
    var s;
    s = null;
    if (ggl.view === "vwyer") {
      s = d3.selectAll(".y" + it.year);
    } else if (ggl.view === "vwtyp") {
      s = d3.selectAll(".t" + it.type);
    } else if (ggl.view === "vwind") {
      s = d3.selectAll(".c" + getCtgry(it.pname));
    } else if (ggl.view === "vwsbind") {
      s = d3.selectAll(".sb" + it.pname);
    } else if (ggl.view === "vwitm") {
      s = d3.selectAll(".it" + it.pname + "-" + it.type);
    } else if (ggl.view === "vwcnt") {
      s = d3.selectAll(".node");
    }
    d3.selectAll(".node").style({
      "opacity": 0.3
    });
    s.style({
      "opacity": 1
    });
    exline.attr({
      "x1": it.x,
      "y1": it.y,
      "x2": it.x + 30,
      "y2": it.y + 30
    }).style({
      "stroke": ggl.red,
      "stroke-width": "1.5px",
      "opacity": 1
    });
    exline2.moveToFront().attr({
      "x1": it.x + 30,
      "y1": it.y + 30,
      "x2": it.x + 40,
      "y2": it.y + 30
    }).style({
      "stroke": ggl.red,
      "stroke-width": "1.5px",
      "opacity": 1
    });
    return extext2.moveToFront().attr({
      "x": it.x + 40,
      "y": it.y + 35
    }).style({
      "fill": ggl.red,
      "font-family": "monospace",
      "font-size": "15px",
      "text-shadow": "-1px -1px white",
      "opacity": 1
    }).text(shrtName(it.pname) + ":" + fmt000(it.mt[ggl.unit]));
  };
  init = function(){
    return ggl.node = svg.selectAll("circle").data(fltCo2).enter().append("circle").attr({
      "class": function(it){
        return "node sb" + it.pname + " y" + it.year + " c" + getCtgry(it.pname) + " t" + it.type + " it" + it.pname + "-" + it.type;
      },
      "id": function(d, i){
        return "id" + i;
      },
      "r": function(it){
        return sclR(Math.abs(it.mt[ggl.unit]));
      }
    }).on("mouseover", function(it, i){
      return mouseAction(it, i);
    });
  };
  red = "rgb(255, 0, 71)";
  green = "rgb(0,249,153)";
  blue = "rgb(104,126,255)";
  grey = "rgb(59,50,78)";
  purple = "rgb(164, 51, 216)";
  lightblue = "rgb(23, 190, 207)";
  watergreen = "rgb(188, 189, 34)";
  fill = d3.scale.ordinal().range([watergreen, purple, lightblue, blue, grey, red, green]).domain(lsGas);
  filling = function(it){
    return it.style({
      "fill": function(it){
        return fill(it.type);
      },
      "stroke-width": "1.5px"
    });
  };
  setTitle = function(){
    var lsLabel, lsSum, setText, setRowname, t, setX, setY, onlyNotSbind, setGridsum, sm, mktPath, callPath, ndata, smpth;
    svg.selectAll(".colname").data(lsYear).enter().append("text").attr({
      "class": "colname",
      "x": function(it){
        return sclVwindX(it);
      },
      "y": -55
    }).style({
      "text-anchor": "start",
      "font-size": "18px",
      "cursor": "default",
      "font-family": "georgia",
      "fill": ggl.red
    }).text(function(it){
      return it;
    });
    lsLabel = {};
    lsSum = {};
    fltCo2.map(function(it){
      var cy, cx, cxy;
      cy = it.xy[ggl.view].y;
      cx = it.xy[ggl.view].x;
      cxy = cx + "_" + cy;
      if (lsLabel[cy] === undefined) {
        lsLabel[cy] = it;
      }
      if (ggl.view === "vwyer" || ggl.view === "vwtyp" || ggl.view === "vwind" || ggl.view === "vwcnt" || ggl.view === "vwsbind") {
        if (lsSum[cxy] === undefined) {
          return lsSum[cxy] = it.mt[ggl.unit];
        } else {
          return lsSum[cxy] += it.mt[ggl.unit];
        }
      }
    });
    setText = function(it){
      if (ggl.view === "vwyer") {
        return "排放部門加總";
      } else if (ggl.view === "vwtyp") {
        return it.type;
      } else if (ggl.view === "vwind") {
        return getCtgry(it.pname);
      } else if (ggl.view === "vwsbind") {
        return it.pname;
      } else if (ggl.view === "vwitm") {
        return it.pname + "(" + it.type + ")";
      } else if (ggl.view === "vwcnt") {
        return it.country;
      }
    };
    setRowname = function(it){
      return it.attr({
        "class": function(it){
          return "rowname node sb" + it.pname + " y" + it.year + " c" + getCtgry(it.pname) + " t" + it.type + " it" + it.pname + "-" + it.type;
        },
        "x": ggl.w - 50 + 40,
        "y": function(it){
          return it.xy[ggl.view].y + ggl.rwTopMrgn;
        }
      }).style({
        "text-anchor": "start",
        "cursor": "default",
        "fill": ggl.red,
        "font-family": "georgia"
      }).text(function(it){
        return shrtName(setText(it));
      });
    };
    t = svg.selectAll(".rowname").data(values(lsLabel));
    t.transition().call(setRowname);
    t.enter().append("text").call(setRowname).on("mouseover", function(it, i){
      return mouseAction(it, i);
    });
    t.exit().remove();
    setX = function(it){
      return (+it.key.split("_")[0]) + 30;
    };
    setY = function(it){
      return (+it.key.split("_")[1]) + 50;
    };
    onlyNotSbind = function(it){
      if (ggl.view !== "vwsbind") {
        return fmt000(it.value);
      } else {
        return "";
      }
    };
    setGridsum = function(it){
      return it.text(function(it){
        return (ggl.view === "vwcnt" ? rvTblCountry[it.key] + ": " : "") + onlyNotSbind(it);
      }).attr({
        "x": function(it){
          return setX(it);
        },
        "y": function(it){
          return setY(it);
        },
        "class": "gridsum",
        "text-anchor": "end"
      }).style({
        "font-family": "monospace",
        "fill": ggl.red,
        "text-shadow": "2px 2px white"
      });
    };
    sm = svg.selectAll(".gridsum").data(d3.entries(lsSum));
    sm.transition().call(setGridsum);
    sm.enter().append("text").call(setGridsum);
    sm.exit().remove();
    mktPath = function(it){
      var w, h, margin, sclX, sclY, p;
      w = 40;
      h = 15;
      margin = {};
      margin.top = -13 + ggl.rwTopMrgn;
      margin.left = 0;
      sclX = d3.scale.linear().domain([0, ggl.w]).range([0, w]);
      sclY = d3.scale.linear().domain([
        0, d3.max(it, function(it){
          return Math.abs(it.value);
        })
      ]).range([h, 0]);
      p = d3.svg.area().interpolate("basis").x(function(it){
        return sclX(+it.key.split("_")[0]) + ggl.w - 50 + margin.left;
      }).y1(function(it){
        return sclY(Math.abs(it.value)) + (+it.key.split("_")[1]) + margin.top;
      }).y0(function(it){
        return (+it.key.split("_")[1]) + h + margin.top;
      });
      return it.d = p(it);
    };
    callPath = function(it){
      return it.each(mktPath).attr({
        "class": "sumpath",
        "d": function(it){
          return it.d;
        }
      }).style({
        "fill": "orange",
        "opacity": 0.7
      });
    };
    ndata = d3.nest().key(function(it){
      return it.key.split("_")[1];
    }).entries(d3.entries(lsSum)).map(function(it){
      return it.values;
    });
    smpth = svg.selectAll(".sumpath").data(ndata);
    smpth.transition().call(callPath);
    smpth.enter().append("path").call(callPath);
    smpth.exit().remove();
    if (ggl.view === "vwcnt") {
      d3.selectAll(".rowname").style({
        "display": "none"
      });
      return d3.selectAll(".colname").style({
        "display": "none"
      });
    } else {
      d3.selectAll(".rowname").style({
        "display": "inline"
      });
      return d3.selectAll(".colname").style({
        "display": "inline"
      });
    }
  };
  collide = function(it){
    var r, nx1, nx2, ny1, ny2;
    r = sclR(Math.abs(it.mt[ggl.unit]));
    nx1 = it.x - r;
    nx2 = it.x + r;
    ny1 = it.y - r;
    ny2 = it.y + r;
    return function(quad, x1, y1, x2, y2){
      var x, y, l, r;
      if (quad.point && quad.point !== it) {
        x = it.x - quad.point.x;
        y = it.y - quad.point.y;
        l = Math.sqrt(x * x + y * y);
        r = sclR(Math.abs(it.mt[ggl.unit])) + sclR(Math.abs(quad.point.mt[ggl.unit]));
        if (l < r) {
          l = (l - r) / l * 0.5;
          it.x -= x *= l;
          it.y -= y *= l;
          quad.point.x += x;
          quad.point.y += y;
        }
      }
      return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1;
    };
  };
  init().call(filling).call(force.drag);
  force.start();
  setLine = function(x1, y1, x2, y2){
    return svg.append("line").attr({
      "x1": x1,
      "y1": y1,
      "x2": x2,
      "y2": y2
    }).style({
      "stroke": ggl.red,
      "stroke-width": "1px"
    });
  };
  link = function(startX, startY, endX, endY){
    var curvature, x0, x1, y0, y1, xi, x2, x3;
    curvature = 0.5;
    x0 = startX;
    x1 = endX;
    y0 = startY;
    y1 = endY;
    xi = d3.interpolateNumber(x0, x1);
    x2 = xi(curvature);
    x3 = xi(1 - curvature);
    return "M" + x0 + "," + y0 + "C" + x2 + "," + y0 + " " + x3 + "," + y1 + " " + x1 + "," + y1;
  };
  setHighlight = function(x, y, w, h){
    setLine(x, y, x + w, y);
    setLine(x, y + h, x + w, y + h);
    return setLine(x + w, y, x + w, y + h);
  };
  setNote = function(startX, startY, endX, endY){
    return svg.append("path").attr({
      "d": link(startX, startY, endX, endY)
    }).style({
      "stroke": ggl.red,
      "stroke-width": "1px",
      "fill": "none"
    });
  };
  setExlpain = function(x, y, w, h, explainX, explainY){
    setHighlight(x, y - h / 2, w, h);
    return setNote(x + w, y, explainX, explainY);
  };
  setList = function(holderName, listData, onClick){
    var uls;
    uls = d3.selectAll(holderName).append("ul").attr("class", "dropdown-menu").attr("role", "menu");
    return uls.selectAll("li").data(listData).enter().append("li").attr("class", function(it){
      if (it.act === null) {
        return "divider";
      }
      if (it.act === "header") {
        return "disabled dropdown-header ";
      }
      if (it.type === "viewsubind") {
        return "disabled subind-able";
      }
    }).append("a").style("cursor", "pointer").attr("data-target", "#").attr("class", "dropdown-action").attr("id", function(it){
      return "action" + it.act;
    }).text(function(it){
      return it.text;
    }).on("click", function(it){
      return onClick(it);
    });
  };
  substringMatcher = function(strs){
    return function(q, cb){
      var matches, substrRegex;
      matches = [];
      substrRegex = new RegExp(q, 'i');
      $.each(strs, function(i, str){
        if (substrRegex.test(str)) {
          return matches.push({
            value: str
          });
        }
      });
      return cb(matches);
    };
  };
  clickView = function(it){
    ggl.view = it.act;
    force.resume();
    d3.selectAll(".chooseclasification").text(it.text);
    return setTitle();
  };
  clickCnt = function(it){
    return window.open('./show.html?country=' + it.enname, '_blank');
  };
  setList(".clasification-holder", lsView, clickView);
  setList(".country-holder", lsCntView, clickCnt);
  showNHideCircle = function(){
    return d3.selectAll(".p-indc").style({
      "background-color": function(it, i){
        if (i === ggl.hghidx) {
          return "black";
        } else {
          return "white";
        }
      }
    });
  };
  updateSvg = function(){
    return lsExplain[ggl.hghidx].act();
  };
  ticking = function(i){
    ggl.hghidx = i;
    showNHideCircle();
    return updateSvg();
  };
  scrolling = function(){
    return ggl.dscrpts.map(function(it, i){
      var b, m, lm;
      b = it.getBoundingClientRect();
      m = b.top;
      lm = ggl.screenh / 2;
      return d3.select(it).style("opacity", function(){
        if (m < lm) {
          ticking(i);
          if (m < 100) {
            d3.selectAll(".scroll-down").transition().style("display", "none");
          }
          return m / 100;
        } else {
          return 1;
        }
      });
    });
  };
  scrollingTo = function(i){
    return $("body").scrollTop($(ggl.dscrpts[i]).position().top);
  };
  actInit = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwtyp") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return clearOpacity();
  };
  actShowco2 = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwtyp") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return mouseAction(fltCo2.filter(function(it){
      if (it.type === "CO2" && it.year === "2012" && it.pname === "能源-燃燒-能源工業") {
        return true;
      } else {
        return false;
      }
    })[0]);
  };
  actShowch4 = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwtyp") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return mouseAction(fltCo2.filter(function(it){
      if (it.type === "CH4" && it.year === "1997" && it.pname === "廢棄物-垃圾掩埋場") {
        return true;
      } else {
        return false;
      }
    })[0]);
  };
  actShowperind = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwind") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return clearOpacity();
  };
  actShowabsco2 = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwind") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return mouseAction(fltCo2.filter(function(it){
      if (it.type === "吸收CO2" && it.year === "2012" && it.pname === "土地") {
        return true;
      } else {
        return false;
      }
    })[0]);
  };
  actShowsubind = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwsbind") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return clearOpacity();
  };
  actMacro = function(){
    clickView(lsView.filter(function(it){
      if (it.act === "vwyer") {
        return true;
      } else {
        return false;
      }
    })[0]);
    return clearOpacity();
  };
  lsExplain = [
    {
      "act": actInit,
      "text": "不同顏色的泡泡表示不同的排放氣體別，泡泡大小表示不同來源排放量的多寡"
    }, {
      "act": actShowco2,
      "text": "排放氣體以 CO2 為大宗，其排放量一直處於成長狀況，一直至 2007 年後成長才趨緩，相較於其他先進國家晚"
    }, {
      "act": actShowch4,
      "text": "甲烷的量逐年減少，最主要與垃圾掩埋場的處理程序改善有關"
    }, {
      "act": actShowperind,
      "text": "將氣體依排放源切換，可以看到能源部門的排放量最多、工業次之，兩者皆以二氧化碳排放為主。而農業、廢棄物則是甲烷主要的排放源"
    }, {
      "act": actShowabsco2,
      "text": "土地是主要吸收二氧化碳的來源，但吸收的量在過去幾年都相當固定"
    }, {
      "act": actShowsubind,
      "text": "全部展開，可以觀察到各細項的排放種類都相對固定：比方能源工業一直都是一顆大泡泡跟著兩顆小泡泡（二氧化碳 + 甲烷 + 二氧化氮）"
    }, {
      "act": actMacro,
      "text": "整體來講，台灣的溫室氣體從 2007 後就趨於穩定"
    }
  ];
  initiateData = function(){
    d3.selectAll(".cnt-description").selectAll(".description").data(lsExplain).enter().append("h3").attr({
      "class": "description"
    }).text(function(it){
      return it.text;
    });
    d3.selectAll(".p-holder").selectAll(".p-indc").data(lsExplain).enter().append("div").attr({
      "class": "p-indc"
    }).style({
      "cursor": "pointer"
    }).on("mousedown", function(d, i){
      return scrollingTo(i);
    });
    return ggl.dscrpts = [].slice.call(document.getElementsByClassName("description"));
  };
  (function(){
    initiateData();
    setTitle();
    return scrolling();
  })();
  return $(window).scroll(function(){
    return scrolling();
  });
});